Android game in Java
grade: 97/100
Thanks to my teammate Kewei & Chendga. It is a great journey.
I am responsible for persisting data & recovering.
We use IntelliJ IDEA for editing & debugging
It is much better than Emacs
login
room view
add room
choose territory
play
action
3 parts:
RiscClient/app/src/main/java/edu/duke/ece651/riskclient
server/src/main/java/edu/duke/ece651/risk/server
shared/src/main/java/edu/duke/ece651/risk/shared
I use Postgres to store the User name & password
I use MongoDB for storing gaming data, because the data is more like document.
I use Morphia for ODM, and use annotation to store the data.
db config:
server/src/main/java/edu/duke/ece651/risk/server/Mongo.java
save & recover
server/src/main/java/edu/duke/ece651/risk/server/Room.java
save in Room.java mainGame
Mongo m = new Mongo();
m.morCon().save(this);
recover in Room.java recover
Server has thread pool to handle the incoming request.
Each room has 1 main thread, and each player thread has its own player thread & its own chat thread.
We use barrier to make sure all info for all thread are up to date
Print out the info can help, but I think setting break point is much better
My vm may stop working at this moment, and you need to config the MongoDB & Postgres to make it works.
in
RiscClient/app/src/main/java/edu/duke/ece651/riskclient/Constant.java
//local ip for debug, change it to where you run the server
public static final String HOST = "192.168.0.132";
public static final int PORT = 12345;
change the host