adelie.cx...

LCA 2005 Hackfest notes

Random notes about the linux.conf.au 2005 Hackfest, by Russell Steicke, russells@adelie.cx.

The hackfest was based around the game spellcast. Two parts of the hackfest were to:

I only entered the GUI section.

Here is the man page from the original X spellcast game, on which the hackfest competition is modelled, and lacking original thought, my entry resembles it quite a lot. The game itself is older than this, which is detailed in the man page.

My entry

Screenshot of Ecar (my spellcast gui entry) playing against the test AI. Note the amazingly crappy gesture icons. I got used to them, and only remembered how bad they were about 30 minutes before closing. And here's the code

There are lots more things that need doing and cleaning up, but the time for the hackfest ran out, so that's what got submitted.

Things to do, in no particular order:

The curious among you can get a current copy of the source from my arch archive:
Archive: russells@adelie.cx--hackfest-2005
URL: http://adelie.cx/archives/russells@adelie.cx--hackfest-2005

You'll need these steps to get a working copy that works (until I set up an arch config or something):

Results

OMG, I won the GUI section! Stephen Thorne won the AI section. Many thanks to
IBM and Terra Soft Solutions.

Protocol

Message-based. Messages have this format:

So, look for the start marker. Read the length. Read that many bytes (including markers). Check the end marker. Interpret the message.

Some details follow about the different message types. Each of these is preceded by the start marker, message length and message type, and followed by the end marker.

In here I've randomly confused "player" and "wizard". They mostly mean the same thing.

MSG_ASK_WELCOME

(1, 0x1, server -> player)
Protocol version and welcome message.

MSG_RCV_CLIENT_DETAILS

(2, 0x2, player -> server)
Reply to MSG_ASK_WELCOME

MSG_SEND_NEWPLAYER_INFO

(13, 0xd, server -> player)
Sent to all connected players when a new player joins. Sent once for each player(?). Sent to new player once for each existing player. Each player gets message once for himself as well as once each for all the other players.

A warning... this message is sent in an the same order to each player, so the player has to remember his name, and figure out from the name in each message which player he is. This also means that each player must have a unique name for the game to work properly.

MSG_SEND_CREATURE_STATE

(11, 0xb, server -> player)
Sent to all connected players to tell them about the health of a creature (player or monster).

MSG_ASK_FOR_GESTURES

(3, 0x3, server -> player)
Ask the player what gestures will be used this round. No data.

MSG_RCV_GESTURES_USED

(4, 0x4, player -> server)
Tells the server what gestures we are using this round. Don't assume that the gestures you send are the ones that your wizard will actually use, as the wizard may be paralysed, confused, charmed etc.

MSG_SEND_GESTURES_SEEN

(7, 0x7, player -> server)
Tells us what gestures were used by a player. Our own gestures come back to us in a message as well.

MSG_ASK_FOR_SPELLS_CAST

(5, 0x5, server -> player)
Ask the player what spells are to be cast with each hand.

MSG_RCV_SPELLS_CAST

(6, 0x6, player -> server)
Tell the server what spells are to be cast with each hand.

MSG_ASK_SPELL_DIRECTIONS

(8, 0x8, server -> player)
Ask the player where the spells are to be cast.

MSG_RCV_SPELL_DIRECTIONS

(9, 0x9, player -> server)
Tell the server where we're casting our spells.

MSG_SEND_SPELL_CAST

(10, 0xa, server -> player)
Tell the player about a spell that has been cast.

MSG_SEND_EVENT_INFO

(19, 0x13, server -> player)
Tell us about something that happened. Text message, no significance in game.

MSG_SEND_START_GAME

(20, 0x14, server -> player)
Tell the player that the game has started, and the turn timeout. This message is sent before the MSG_SEND_NEWPLAYER_INFO messages.

MSG_SEND_END_GAME

(12, 0xc, server -> player)
Tell the player that the game has ended, and who won.

MSG_SEND_NEW_MONSTER_INFO

(17, 0x11, server -> player)
Tell us about a new monster.

MSG_SEND_MONSTER_ATTACK_INFO

(18, 0x12, server -> player)
Tell who a monster attacks.

MSG_ASK_MONSTER_DIRECTIONS

(15, 0xf, server -> player)
Ask a player what he wants to do with his monsters.

MSG_RCV_MONSTER_DIRECTIONS

(16, 0x10, player -> server)
Tell the server what our monsters are to do.

MSG_ASK_CHARM_PERSON_CTRL_HAND

(21, 0x15, server -> player)

MSG_ASK_PARALYSIS_CTRL_HAND

(22, 0x16, server -> player)

MSG_RCV_CHARM_PERSON_CTRL_GESTURE

(23, 0x17, server -> player)

MSG_RCV_CHARM_PERSON_CTRL_HAND

(24, 0x18, player -> server)

MSG_RCV_PARALYSIS_CTRL_HAND

(25, 0x19, player -> server)

MSG_RCV_CHARM_PERSON_CTRL_GESTURE

(26, 0x1a, player -> server)

MSG_USERNAME_IN_USE_ALREADY

(27, 0x1b, server -> player)
No data.

MSG_SEND_ROUND_BEGIN

(28, 0x1c, server -> player)

Running multiple player games

Here's how to run multiple player games on one Debian box and one MS Windows box:

Here's a screenshot of the windowsbox desktop with a four-player game going.

Notes

Helpers

Everyone needs a secret weapon. I'm learning tactics by watching my children play. :)
Helper one Helper two