Download presentation
Presentation is loading. Please wait.
Published byAlberta Singleton Modified over 9 years ago
1
Medieval Netwars By: Josh Allman, David Keegan www.cs.rit.edu/~jra1315
2
The Plan The Game Design o pattern o client (uml) o server (uml) Protocol o message encoding o messages o sequence Demo o 2 player o 4 player (2 in each session) Questions
3
The game
4
The Game (for real) Medieval assault recreated on (pseudo)graph paper Troops o Men -- Mobile utility unit o Catapult -- Good against forts o Fort -- Good defensive structure Actions o Move o Rest -- Regain HP o Forage -- Search for new men, fort or catapult o Attack Win o Kill all enemy units
5
Client Server Design pattern All game logic handled on server o prevents malicious clients 'Thin' client; only responsible for updating the display Standard interface-proxy-session design pattern Server broadcasts game state updates to all session clients
6
Client Design
7
Server Design
8
Protocol Encoding & Transmission Serialized message objects passed via TCP
9
Messages To Client: turn(...) o tells whose turn it is win(...) o tells who won lose(...) o tells who lost set(...) o updates/adds/removes a unit forage(...) o tells clients that a spot has been foraged message(...) o user interaction message close() o closes the client To Server: forage(...) o tries to find new units move(...) o tries to move a unit to a new spot attack(...) o tries to attack a spot with a unit rest(...) o increases the HP of a unit join(...) o adds a client to the game close(...) o closes the connection with the client
10
Message Sequence: Join client1->server join(this,"client1","session1") client2->server join(this,"client2","session1") server->clients in session1 set("client1",Men(1,5,20)) set("client2",Men(6,36,20)) turn("client1")
11
Message Sequence: Move client->server move("client1", Men(1, 2, 20), 3, 4) server->clients set("client1", Men(1, 2, 0)) set("client1", Men(1, 2, 20)) turn("client2") alternate (move too far, already occupied) message("Invalid move.") turn("client1")
12
Message Sequence: Attack client->server attack("client1",Men(1,5,20),7,6) server->clients set("client2",Men(7,6,0)) set("client1",Men(1,5,3)) turn("client2") alternate (if (7,6) is empty, too far, etc) message("Invalid attack") turn("client1")
13
Message Sequence: Rest client->server rest("client1", Men(1, 2, 1)) server-> clients set("client1", Men(1, 2, 20)) turn("client2")
14
Message Sequence: Forage client->server forage("client1", Men(1, 2), Catapult(3, 4)) server->clients forage(3, 4) set("client1", Catapult(3, 4)) turn("client2") alternate (if distance is too far, etc) message("Invalid forage.") turn("client1")
15
Demo
16
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.