Skip to content

0guanhua0/RISC

Repository files navigation

ece651-spr20-RISC

Android game in Java

grade: 97/100

prelude

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

video demo for evo.2

evo.2

preview

login

login

room view

room

add room

addroom

choose territory

init

play

play

action

action

UML

link

evo.2

code structure

3 parts:

frontend

RiscClient/app/src/main/java/edu/duke/ece651/riskclient

backend

server/src/main/java/edu/duke/ece651/risk/server
shared/src/main/java/edu/duke/ece651/risk/shared

suggestions

persist & recover

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

Threading strategy

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.

synchronization

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

run game

My vm may stop working at this moment, and you need to config the MongoDB & Postgres to make it works.

client

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

About

2020 Spring ECE 651 RISC java game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages