Saturday, October 9, 2010

LazerTag Team Ops Packet - Part 4



I figured out the final scoring details and completed the GUI. You can host a complete game from the GUI now and get all the score readouts.

The fields worked out as follows:

COMMAND_CODE_PLAYER_REPORT_SCORE_RECORDS
0x041-0x043, //command code (last two bits are the team number)
0x00, //game id
0x10, // team_number << 4 | player_number
0xXX, //player hit mask
0xXX, //hits from player indicated by first set bit in mask
0xXX, //hits from player indicated by second set bit in mask
... (the hit bytes sum to count_ones(mask_byte)
0x100, //checksum

The secret to determine the SCORE_RECORD was noticing that COUNTDOWN varied more then I noticed in my initial testing.

COMMAND_CODE_COUNTDOWN_TO_GAME_START
0x000, //command code
0x00, //game id
0x30, //seconds left in digit hex
0x08, //players on team 1
0x08, //players on team 2
0x08, //players on team 3
0x100, //checksum

If t2p0 shoots t1p0 and "players on team 2" == 0, then t1p0's gun will ignore the shot. Hence, those shots won't show up in the score report.

The following packets still have unknown values:
COMMAND_CODE_SCORE_ANNOUNCEMENT
COMMAND_CODE_PLAYER_REPORT_SCORE
COMMAND_CODE_GAME_OVER

Hey you, decode!

As always, get the code here.

No comments: