In this post I am going to talk about implementing a self playing
isometric tank game client. First of all lets focus on what is isometric
means?. In the context of gaming, isometric refers to some sort of
parallel projection. View point of the game will be rotated and will
show a side view of the game. This technique can be used to create a 3d
game using 2d game programming features. Following is an image of an
isometric view. In an isometric view, camera is angled from 60 degrees to all three xy,yz,zx planes.
This game is a multilayer game. Game has a server which will send game initialization, ending and update messages.
In
this post I am describing how to implement game client. Game client
will play the game itself by deciding on messages received by the game
server.
A screenshot of game UI. |
Network Layer
Layers of my game |
Game Protocol
Joining
the game
The client will have to send a request to
the Server saying JOIN#
The server will reply with one of the
following replies
- Join accept message (explained in the next slide)
- PLAYERS_FULL# - The maximum number of players are already added
- ALREADY_ADDED# - The player is already added
- GAME_ALREADY_STARTED# - The player tries to join an already started game
Joining
the game – Acceptance
If the client’s request can be honoured,
the server replies with a message in the following format. S:P:
< player location
x>,< player
location y>:#
For an example the first player to
register in a game instance may get a message like,
S:P1: 1,1:0#
Game
Initiation
- A timer gets initiated when the first player resister for a game.
- When the 5th player joins the game or in the event of the timer expiring, the server will issue the game starting message to all the players that are already registered with the server.
- As discussed before, any join request by a client hereafter until the end of the game instance will be rejected.
- The game will be played in a 20x20 grid.
-
All other map details vary with each game
instance and will be sent in the following format
I:P1; < player location x>,< player location y>;: ...: P5< player location x>,< player location y>;: < x>,;< x>,;< x>,…..< x>,: < x>,;< x>,;< x>,…..< x>,: < x>,;< x>,;< x>,…..< x>,#Moving and ShootingOnce per second the server will broadcast a global update to all the clients documenting its internal variables about the clientsG:P1;< player location x>,< player location y>;;< whether shot>;;< coins>;< points>: …. P5;< player location x>,< player location y>;;< whether shot>;;< coins>;< points>: < x>,,;< x>,,;< x>,,;< x>,,…..< x>,,
Acquiring
coins
The server will send the following
message to signal the appearing event of a pile of coins.
C:,::#
- x - <int>
- y - <int>
- LT -<int> the time that the pile of coins will be on the map before it automatically disappears
- Val – value of the coins
Life
Packs
The server will send the following
message to signal the appearing event of a Life Pack.
L:,:#
- x - <int>
- y - <int>
- LT -<int> the time that the life pack will be on the map before it automatically disappears