Key Feature of JGroups TankWar Demo
- Demonstrate more advanced JGroups concepts
- Tank Battle Game
- Modular ClassLoader
JGroups is a toolkit for reliable multicast communication, It can be used to create groups of processes whose members can send messages to each other. More detail please refer to http://www.jgroups.org/
What's TankWar Demo?
TankWar is troditional battle game, which tanks be separate to 2 groups: Alliance tanks, Enemy tanks, these 2 kinds tanks plan different role, emit missile attack each other. Every Tank in Groups need know other Tank's Status, so every tank need send itself's status to other member, Tank status contain:
- Tank's Direction, Position, Cannon Dorection, Life
- Missile's Direction, Position, Life
- Blood's Direction, Position, Life
- Explode's Direction, Position, Life
The TankWar Demo architecture as below:
MainFrame - TankWar UI
Communication - Control Data Transfer bewteen MainFrame and JGroups Channel
Channel - Using multiple channels(3) for enhance performance,
Protocal Stack - Sharing a transport between multiple channels in a JVM for performance
How to build JGroups TankWar Code?
- clone code from github
git clone firstname.lastname@example.org:kylinsoong/cluster.git
2. maven build(under cluster folder)
mvn clean install dependency:copy-dependencies
3. ant build(under cluster/bootstrap)
Demo folder generated, the path is cluster/bootstrap/build/Demo, The Demo folder:
bin - contain all bootstrap scripts
conf - contain all configuration files
modules - contain all modules
jboss-modules-1.1.2.GA.jar - is startup jar
How to run TankWar Demo?
Run startup script start TankWar with different role, name
./tankwar.sh -n node1 isGood
./tankwar.sh -n node2
So far, TankWar bootstrap is finished, next we start plan TankWar.
How to play TankWar?
As Showed in above Screenshot:
- Use arrow(up, down, left. right) move Tank, Tank can move to 8 direction
- Use space emit missile
- Use F2 for generating a new Tank if current Tank exploded