Battleship Server Technical Reference page 1
BattleshipServer Technical Reference Version 1.0 1 Who should read this?
- wants to write his own BattleshipClient
- wants to know what exactly this software is doing- wants to make sure this software doesn’t send the contents of your harddisk to
the CIA, the FBI or to assorted viagra dealers
- has looked at the source and needs some directions because it is so poorly
At the time of this writing, there is only one quickly-hacked-together client for MacOS X, so writing fancy clients for all kinds of OS’es is strongly encouraged. Oh yeah,and a OpenGL-enabled 3D client for OS X would be nice. 2 How it works
Theoretically (and equipped with a pen and some paper), a game could be played over
a telnet connection, as the server responds to more or less simple ASCII-stringcommands.
These commands can be classified into four categories:
(which let you log on or create an account on the server)
(which let you chat, see the rules, invite other players, see the high scores etc.)
Battleship Server Technical Reference page 2
(which let you create a map for gameplay), and, finally
(which let you place shots on the opponent’s map)
To play a game, the player needs to have an account on the server. A new account is created with the caccount command.
When the player has logged in with the correct login/password combination, he can query other users on the server (who), take a look at the highscore list (scores) or at the server rules (getrules). He can even chat with other users. But he still won’t be able to play, cause he hasn’t got a map with ships on it yet.
A map is created with the create command and populated with the addship command.
On receiving the addship commmand, the server checks if the ship has a legal positionand size.
As soon as the server rules concerning the number and sizes of ships on a map are satisfied, the player receives a !map complete message and is marked available, which
means that he is able to invite other players and can be invited by other players. 3 Commands 3.1 Server meta commands 3.1.1 login <player_login> <player_password>
purpose:logs in the player <player_login> with password <player_password>.
Battleship Server Technical Reference page 3
3.1.2 caccount <player_login> <player_password>
purpose:create the new account <player_login> with password <player_password>
3.1.3 daccount <player_login> <player_password>
purpose:delete the account <player_login> with password <player_password>
3.1.4 logout 3.2 Session meta commands 3.2.1 who
Battleship Server Technical Reference page 4
return values:(see "server messages")
3.2.2 avail
purpose:display who is available for a game
return values:(see "server messages")
3.2.3 invite <player_login>
invite <player_login> to play a game
<player_login> has no competed map or is participating in a game already
3.2.4 msg <player_login> <message>
purpose:send <player_login> the message <message>
Battleship Server Technical Reference page 5
3.2.5 help 3.2.6 license 3.2.7 getrules
the server rules (see "server messages")
Battleship Server Technical Reference page 6
3.2.8 scores
return values:the server highscore list (see “server messages”)
3.3 Map creation commands 3.3.1 create
purpose:create a new, empty map for gameplay
3.3.2 dispose
Battleship Server Technical Reference page 7
3.3.3 addship <x> <y> <size> <orientation>
purpose:add a ship to the map<x> the ship’s x-position<y> the ship’s y-position<size> the ship’s size<orientation> 2 for horizontal, 1 for vertical
the ship is out of bounds or too close to ist neighbour
the server rules don’t allow that many ships of that type
3.4 Game commands 3.4.1 shoot <x> <y> 3.4.2 forefit
Battleship Server Technical Reference page 8
4 Server messages
After the client has sent a command, the server always sends bss_ready when it has finished processing the new input. 4.1 General messages
At any time, the server may send one of the following messages:
player_login has just logged into the server
player_login has become unavailable
!msg from player_login: msgplayer_login sends you the message msg
the score of player_login has been updated to score
Note that the server also sends the !player, !avail and !score messages if it is specifically asked to via the who, avail and scores commands. In this case the server may send more than one messages concurrently. 4.2 Server information
These messages are only sent if the client requests the information via the getrules command:
The rules may also include ship quantities, if the server doesn’t allow freestyle games:
q ships of the size s have to be present on a map
Battleship Server Technical Reference page 9
4.3 Gameplay messages
These messages are only sent during gameplay:
one of your ships got sunk at x,y
your opponent hit the water at x,y
Battleship Server Technical Reference page 10
5 A sample session
To give you an idea of how it all works together, here’s a sample battleship session. Server output is marked with “srvr>”, client output with “clnt>”.
srvr> *** Welcome to the BattleshipServer Version 0.1 ***
srvr> Stephan Kleinert <stephan@ubisonic.de>
srvr> and Martin Giese <giese@cs.chalmers.se>
srvr>srvr> Copyright (c) 2003. All rights reserved. srvr> 5 player(s) on this server!srvr> !issuesrvr> What's all this now?!srvr> What you are reading now is thesrvr> "standard BattleshipServer Welcome Text (tm)" ;-)srvr>srvr> The administrator of the server is encouraged to change this text to his/her liking. srvr>srvr> But, as she/he hasn't done so yet, let us take the wonderful opportunity to tell youwho brought you this wonderful piece of software. srvr>srvr> This wonderful piece of software is brought to you bysrvr> Martin Giese <giese@cs.chalmers.se> andsrvr> Stephan Kleinert <stephan@ubisonic.de>. srvr>srvr> The standard Mac OS X client was written by Stephan Kleinert, mostly whiletravelling by late and overpriced trains, but as the source of both the server and theclient is GPL'ed, maybe you're connecting with a different, fancier client already. srvr>srvr> Have lots and lots of fun!srvr>srvr> !issue_endsrvr> bss_ready
log you in automatically. So, you have to do this by
srvr> !oksrvr> !player hurglersrvr> bss_ready
Battleship Server Technical Reference page 11
srvr> !fieldsize 10srvr> !maxships 8srvr> !maxshipsize 5srvr> !quantity 2 2srvr> !quantity 3 3srvr> !quantity 4 2srvr> !quantity 5 1srvr> bss_ready
srvr> !score Steph 18srvr> !score Ani 23srvr> !score Iane 34srvr> !score Alex 42srvr> !score Blarg 33srvr> !score Helmut 1srvr> !score Angela 1srvr> bss_ready
srvr> Players on this server:srvr> !player Stephsrvr> !player Blargsrvr> !player hurglersrvr> !player pepperpotsrvr> !player Helmutsrvr> 5 player(s) on this server. srvr> bss_ready
srvr> Available players on this server:srvr> !avail Stephsrvr> !avail Blargsrvr> !avail Helmutsrvr> 3 available player(s) on this server. srvr> bss_ready
Battleship Server Technical Reference page 12
first ship. Luckily, theserver is smart enough to
occur anytime during a session. Inthis example, Iane has just logged
available. There’s no way around this.
they’re playing a game of some sorts.
c) Broadcast messages (like !unavail Steph) can occur after the server has sent bss_ready. The server is ready for
input nevertheless. bss_ready only tells
srvr> !unavail Stephsrvr> !unavail Iane
srvr> Available players on this server:srvr> !avail Blarg
Battleship Server Technical Reference page 13
srvr> !avail Helmutsrvr> 2 available player(s) on this server. srvr> bss_ready
to invite the inviting player back, ascan be seen here.
srvr> !unavail Blargsrvr> !unavail hurgler
srvr> ?not your turnsrvr> bss_ready
srvr> !g_miss at 1 8srvr> !your turn
srvr> !g_miss at 2 7srvr> !your turn
srvr> !your turnsrvr> !hitsrvr> bss_ready
srvr> !your turnsrvr> !hitsrvr> bss_ready
srvr> !your turnsrvr> !hitsrvr> bss_ready
srvr> !your turnsrvr> !sunksrvr> bss_ready
srvr> !msg from Blarg: Hey, that’s unfair!!!
Battleship Server Technical Reference page 14
srvr> !g_hit at 1 9srvr> !g_hit at 2 9srvr> !g_sunk at 3 9srvr> !g_miss at 0 8srvr> !your turn
(we’ll cut things here a little… just imagine, the players shoot on each other like crazy, until…)
srvr> !sunksrvr> !wonsrvr> !score hurgler 1srvr> bss_ready
srvr> !msg from Blarg: ok, till then…srvr> !logout Blarg
If you still have questions, feel free to contact us at stephan@ubisonic.de or
MEDECIN EPIDEMIOLOGISTE, BIOSTATISTICIEN PHARMACO-EPIDEMIOLOGISTE, 25 ANS D'EXPERIENCE PROFESSIONNELLE PRATIQUE PROFESSIONNELLE Dépuis 2003: Gérant majoritaire de la société ARCOSA: conseil sur toutes les activités post-AMM (réflexion stratégique, protocole, questionnaire d'étude, soutien discussion des projets auprès de l'administration, aide méthodologique
Faculté de Médecine de Marseille Rétention aiguë d'urine (216) • Diagnostiquer une rétention aiguë d’urine. • Identifier les situations d’urgence et planifier leur prise en charge. La rétention aiguë d'urine c'est l'impossibilité brutale et totale d'uriner. Il s'agit d'une urgence diagnostique et thérapeutique. 2. Diagnostic L'interrogatoire et l'examen clinique des pat