RAINWATER HARVESTING SYSTEMS - Residential Oil Tanks, Septic Tanks
Tanks
description
Transcript of Tanks
![Page 1: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/1.jpg)
For Programming Challenge
Tanks
N. H. N. D. de Silva
![Page 2: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/2.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 3: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/3.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and Shooting Acquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 4: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/4.jpg)
Cross domain projectsSoftware engineeringDatabasesNetworkingGraphics AI!
Same Game so tougher grading The LMS will be available....Soon
Introduction
![Page 5: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/5.jpg)
Introduction
![Page 6: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/6.jpg)
Introduction
![Page 7: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/7.jpg)
Introduction
![Page 8: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/8.jpg)
Introduction
![Page 9: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/9.jpg)
The game objective is; clients acting as “tanks” accumulating points while making sure of their own survival.
The tanks are capable of shooting shells (bullets) and these bullets will move 3 times faster than a tank.
The environment is made out of four kinds of blocksBrick wall Stone wallWaterBlank cell
Introduction
![Page 10: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/10.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and Shooting Acquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 11: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/11.jpg)
Server
Client 1
Client 2
Client 3
Client 4
Client 5
General Game Architecture
![Page 12: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/12.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and Shooting Acquiring coinsAcquiring pointsLife Packs Killing!Penalties and DeathEndgame
Game in brief
![Page 13: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/13.jpg)
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.
Game Initiation
![Page 14: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/14.jpg)
UI layer
Game Engine
Network Layer
Server Architecture
![Page 15: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/15.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and Shooting Acquiring coinsAcquiring pointsLife Packs Killing!Penalties and DeathEndgame
Game in brief
![Page 16: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/16.jpg)
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
![Page 17: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/17.jpg)
If the client’s request can be honoured, the server replies with a message in the following format.
S:P<num>: < player location x>,< player location y>:<Direction>#
For an example the first player to register in a game instance may get a message like,
S:P1: 1,1:0#Direction
0 North1 East,2 South 3 West
Joining the game – Acceptance
![Page 18: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/18.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and Shooting Acquiring coinsAcquiring pointsLife Packs Killing!Penalties and DeathEndgame
Game in brief
![Page 19: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/19.jpg)
All other map details vary with each game instance and will be sent in the following formatI:P1; < player location x>,< player location
y>;<Direction>: ...: P5< player location x>,< player location y>;<Direction>: <
x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>#
Game Initiation
![Page 20: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/20.jpg)
All other map details vary with each game instance and will be sent in the following formatI:P1; < player location x>,< player location
y>;<Direction>: ...: P5< player location x>,< player location y>;<Direction>: <
x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>#
The highlighted part will have the initialization data for player 1
Game Initiation
![Page 21: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/21.jpg)
All other map details vary with each game instance and will be sent in the following formatI:P1; < player location x>,< player location
y>;<Direction>: ...: P5< player location x>,< player location y>;<Direction>: <
x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>#
The highlighted part will have the initialization data for player 5
Game Initiation
![Page 22: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/22.jpg)
All other map details vary with each game instance and will be sent in the following formatI:P1; < player location x>,< player location
y>;<Direction>: ...: P5< player location x>,< player location y>;<Direction>: <
x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>#
The highlighted part will have the Brick co-ordinates
Game Initiation
![Page 23: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/23.jpg)
All other map details vary with each game instance and will be sent in the following formatI:P1; < player location x>,< player location
y>;<Direction>: ...: P5< player location x>,< player location y>;<Direction>: <
x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>#
The highlighted part will have the Stone co-ordinates
Game Initiation
![Page 24: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/24.jpg)
All other map details vary with each game instance and will be sent in the following formatI:P1; < player location x>,< player location
y>;<Direction>: ...: P5< player location x>,< player location y>;<Direction>: <
x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>: < x>,<y>;< x>,<y>;< x>,<y>…..< x>,<y>#
The highlighted part will have the Water co-ordinates
Game Initiation
![Page 25: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/25.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 26: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/26.jpg)
If the request direction is the same as the current direction, the server will try to move the client 1 cell in the said direction.
Otherwise the tank will be rotated to face the requested directionE.g.:
If the tank is facing North and the client issues the command UP#, the server will try to move the tank up by 1 cell
If the tank is facing North and the client issues the command DOWN#, the server change the tank direction to South.
Moving and Shooting
![Page 27: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/27.jpg)
When the client want to move/rotate their tank or shoot, it must issue the relevant command from the following list.UP# DOWN#RIGHT#LEFT#SHOOT#
A client can issue one of these commands each second
Moving and Shooting
![Page 28: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/28.jpg)
If the request of the client cannot be honoured due to some reason, it will be immediately communicated.OBSTACLE# CELL_OCCUPIED#DEAD#TOO_QUICK#INVALID_CELL#GAME_HAS_FINISHED#GAME_NOT_STARTED_YET#NOT_A_VALID_CONTESTANT#
Otherwise the server will update its internal variables
Moving and Shooting
![Page 29: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/29.jpg)
Once per second the server will broadcast a global update to all the clients documenting its internal variables about the clients.G:P1;< player location x>,< player location y>;<Direction>;< whether shot>;<health>;<
coins>;< points>: …. P5;< player location x>,< player location y>;<Direction>;<
whether shot>;<health>;< coins>;< points>: < x>,<y>,<damage-level>;<
x>,<y>,<damage-level>;< x>,<y>,<damage-level>;< x>,<y>,<damage-level>…..<
x>,<y>,<damage-level>#
Moving and Shooting
![Page 30: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/30.jpg)
G:P1;< player location x>,< player location y>;<Direction>;< whether shot>;<health>;< coins>;< points>: …. :P5;< player location x>,< player location y>;<Direction>;< whether
shot>;<health>;< coins>;< points>: < x>,<y>,<damage-level>;< x>,<y>,<damage-level>;< x>,<y>,<damage-level>;<
x>,<y>,<damage-level>…..< x>,<y>,<damage-level>#
Moving and Shooting
![Page 31: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/31.jpg)
G:P1;< player location x>,< player location y>;<Direction>;< whether shot>;<health>;< coins>;< points>: …. :P5;< player location x>,< player location y>;<Direction>;< whether
shot>;<health>;< coins>;< points>: < x>,<y>,<damage-level>;< x>,<y>,<damage-level>;< x>,<y>,<damage-level>;<
x>,<y>,<damage-level>…..< x>,<y>,<damage-level>#
Moving and Shooting
![Page 32: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/32.jpg)
G:P1;< player location x>,< player location y>;<Direction>;< whether shot>;<health>;< coins>;< points>: …. :P5;< player location
x>,< player location y>;<Direction>;< whether shot>;<health>;< coins>;< points>:
< x>,<y>,<damage-level>;< x>,<y>,<damage-level>;< x>,<y>,<damage-level>;<
x>,<y>,<damage-level>…..< x>,<y>,<damage-level>#
0 (no damage) , 1 (25% damage), 2 (50% damage), 3 (75% Damage), 4 (100% Damage).
Moving and Shooting
![Page 33: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/33.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife Packs Killing!Penalties and DeathEndgame
Game in brief
![Page 34: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/34.jpg)
Acquiring coinsFor two reasons coins will
appear on the map. Random treasuresSpoils of war
The players are supposed to collect them by moving to the cell where the coin pile is.
When a player collect a pile of coins, their coin count and the point count will get increased by that amount.
![Page 35: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/35.jpg)
The server will send the following message to signal the appearing event of a pile of coins.
C:<x>,<y>:<LT>:<Val>#x - <int> y - <int> LT -<int> the time that the pile of coins will be
on the map before it automatically disappearsVal – value of the coins
Acquiring coins
![Page 36: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/36.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 37: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/37.jpg)
There are three ways to acquire points Breaking bricks
Each time a shell (bullet) from a player damages a brick wall, a constant amount of points is added to the player’s point count.
Collecting coinsAs described in the previous topic
Spoils of warWill be discussed in a subsequent topic
Acquiring points
![Page 38: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/38.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 39: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/39.jpg)
Similar to the piles of coins, life packs will appear on empty cells.
The method of taking a life pack is similar to the method of taking a treasure.
When a client takes a life pack, 20% of the initial health will be added to their health.
Note that it is possible for a client, at some point of the game, to have a health value which is greater than the initial health value.
Life Packs
![Page 40: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/40.jpg)
The server will send the following message to signal the appearing event of a Life Pack.
L:<x>,<y>:<LT>#x - <int> y - <int> LT -<int> the time that the life pack will be on
the map before it automatically disappears
Life Packs
![Page 41: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/41.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 42: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/42.jpg)
A bullet hit will reduce the health of a tank by 10% of the initial health
A player who has health of 0% (or less) will die and drop their coins at the point of death. But they will not lose the current points. However 25% of the points of the victim will be added to the killer.
The dropped pile of coins is no different from a randomly created pile of coins. Thus the killer do not have a claim on it, it can be picked up by any remaining client.
Killing!
![Page 43: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/43.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 44: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/44.jpg)
If a client hits an obstacle (a standing brick wall or a stone wall), a fixed number of points will be deducted from the client.
The deduction takes place per each turn, thus if a client keeps hitting an obstacle, it will continuously lose points.
Penalties and Death
![Page 45: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/45.jpg)
As described in a previous slide, clients can shoot over water. But if the client tries to move the tank in to a cell with water, the client will be killed.
Since there is no killer here other than the environment, no body will be credited with points and the coins of the slain client will not drop to the ground.
But they will get their coin count set to zero nevertheless.
Penalties and Death
![Page 46: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/46.jpg)
IntroductionGeneral Game Architecture Server ArchitectureJoining the gameGame initiation Moving and ShootingAcquiring coinsAcquiring pointsLife PacksKilling!Penalties and DeathEndgame
Game in brief
![Page 47: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/47.jpg)
The game ends if one of the following happens;All the clients are deadThe game lifetime counter expiresAll the coin piles (random or otherwise) finished
appearing on the map and all the appeared coin piles either has been claimed by a client or disappeared.
When the game ends, the player with most points will be declared the winner. And the message GAME_FINISHED# will be broadcasted to all the clients.
Endgame
![Page 48: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/48.jpg)
Q & A
![Page 49: Tanks](https://reader036.fdocuments.net/reader036/viewer/2022062723/56813d29550346895da6ecf4/html5/thumbnails/49.jpg)
Thank you!
“Live long and prosper”