Saturday, November 13, 2010

Clearanced-based Hierarchical Pathfinding (HPA*)

Aigamedev.com seems to always have something interesting to read. This week it is using Annotated A* to find a path of at least minimum clearance through a graph. They also go into how you can reduce the graph to an annotated hierarchical pathfinding graph for near-optimal results at much greater speeds. The article is well explained and comes out with a very practical result.

If your not convinced maybe their talk on zombie brain AI from last month will convince you.

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.

Wednesday, September 29, 2010

LazerTag Team Ops Packet - Part 3

More features working, more fields decoded. Still no score reporting. I found the 'damage' field and the 'still alive' field but not the who hit you with a candlestick in the library section. Get the Code.

COMMAND_CODE_SCORE_ANNOUNCEMENT
0x031, //command code
0x00, //game id
0x11, // team_number << 4 | player_number
0x0F, //unknown
0x100, //checksum

COMMAND_CODE_PLAYER_REPORT_SCORE
0x040, //command code
0x00, //game id
0x10, // team_number << 4 | player_number
0x00, //damage received
0x01, //still alive
0x00, //unknown
0x00, //unknown
0x00, //unknown
0x02, //unknown
0x100, //checksum

COMMAND_CODE_PLAYER_REPORT_SCORE_RECORDS
0x041, //command code
0x00, //game id
0x10, // team_number << 4 | player_number
0xXX, //unknown
0xXX, //unknown
0xXX, //unknown, looks like hits from a certain player but unable to determine which
0x100, //checksum

I also determined that 0x41 is actually sent by the gun. I am pretty sure it contains the hit report but I have been unable to decode it. With 3 guns it is sometimes 2 bytes of unknown data and sometimes 3. Lastly the 'rank' announce that cycles through all the players.

COMMAND_CODE_GAME_OVER
0x042, //command code
0x00, //game id
0x10, // team_number << 4 | player_number
0x00, //player rank
0x01, //team rank
0x00, //unknown
0x00, //unknown
0x00, //unknown
0x00, //unknown
0x100, //checksum

Tuesday, September 28, 2010

LazerTag Team Ops Packet - Part 2

Good progress with the LTTO hosting gun!

The hosting packets are composed of:

9 bit command packet
[ 1 bit zero ] [ 8 bit command code]
8 bit data packet * n
9 bit crc packet
[ 1 bit one ] [ 8 bit sum of previous bytes ]

All of which use the 3000 ms mark, 6000 ms sleep, 3000 ms mark header.

The command codes discovered so far are:
COMMAND_CODE_CUSTOM_GAME_MODE_HOST = 0x02,
COMMAND_CODE_PLAYER_JOIN_GAME_REQUEST = 0x10,
COMMAND_CODE_ACK_PLAYER_JOIN_RESPONSE = 0x01,
COMMAND_CODE_CONFIRM_PLAY_JOIN_GAME = 0x11,
COMMAND_CODE_COUNTDOWN_TO_GAME_START = 0x00,
COMMAND_CODE_SCORE_ANNOUNCEMENT = 0x31,
COMMAND_CODE_PLAYER_REPORT_SCORE = 0x40,

The packet groups look like:
COMMAND_CODE_CUSTOM_GAME_MODE_HOST

0x002, //command code
0x00, //Game ID
0x10, //game time minutes
0x10, //tags
0xFF, //reloads
0x15, //sheild
0x10, //mega
0x20, //unknown
0x01, //unknown
0x100, //checksum

Where the first and last packets are 9 bits. The known values are base 10 hex where 9=0x09 but 10=0x10 and 0xff is 'unlimited'.

The join game request is sent by the joining gun on recv of the above advertisement.

COMMAND_CODE_PLAYER_JOIN_GAME_REQUEST
0x010, //command code
0x00, //game id
0x00, //player id
0x00, //unknown
0x100 //checksum

The host then confirms the join by sending back the ids and team/player numbers

COMMAND_CODE_ACK_PLAYER_JOIN_RESPONSE
0x001, //command code
0x00, //game id
0x00, //player id
0x09, //some combination of team/player number
0x100 //checksum

The gun must then confirm this join to be part of the game by sending back both id's

COMMAND_CODE_CONFIRM_PLAY_JOIN_GAME
0x011, //command code
0x00, //game id
0x00, //player id
0x100 //checksum

If the host goes 60 seconds without getting another player it starts the game countdown at 30 seconds and starts sending countdown announcements once a second.

COMMAND_CODE_COUNTDOWN_TO_GAME_START
0x000, //command code
0x00, //game id
0x30, //seconds left in digit hex
0x02, //unknown
0x00, //unknown
0x00, //unknown
0x100, //checksum

Once the game starts the LTTO gun sends the 5 bit, all zero, 3k,6k,6k pulse once a second but it is not required. All guns will end the game after the timeout in the game announce. Then the host gun starts the score announce beacon.

COMMAND_CODE_SCORE_ANNOUNCEMENT
0x031, //command code
0x00, //game id
0x11, //unknown
0x0F, //unknown
0x100, //checksum

The player gun response is still a mystery but it looks like:

COMMAND_CODE_PLAYER_REPORT_SCORE
0x040, //command code
0x00, //game id
0x10, //unknown,
0x00, //unknown, hits?
0x01, //unknown
0x00, //unknown
0x00, //unknown
0x00, //unknown
0x00, //unknown
0x100, //checksum

More then one similar looking packet is exchanged. Determining the meanings will require multi-gun controlled tests. After the score is reported the host sends back command 0x41 which appears to report the hits per player. When all players have checked in the host spits out command 0x32 periodically, with still contents of unknown meaning.

Sunday, September 26, 2010

LazerTag Team Ops Packet - Part 1

Phoenix LTX

[ 3 bits - zero ] [ 2 bits - team ] [ 2 bits - damage ]

Team:
0x00 = Solo
0x01-0x03 = Team 1-3

Damage:
0x00-0x03 = Damage 1-4 (3-4 are only usable by LTTO as Mega-Tag)

LTTO

[ 5 bits - zero (for solo at least) ]

Location Pulse

#define LTTO_HDR_MARK_ONE 3000
#define LTTO_HDR_MARK_TWO 6000
#define LTTO_HDR_SPACE 6000
#define LTTO_ONE_MARK 2000
#define LTTO_ZERO_MARK 1000
#define LTTO_SPACE 2000

Thursday, September 2, 2010

Goal-Oriented Action Planning

I found a very good paper on AI planning by the guy that did the F.E.A.R. AI architecture.

Jeff Orkin's page on GOAP contains lots more links to even more details.

Learn something!

Monday, August 23, 2010

Phoenix LTX

Hey look I made a lazer tag gun! It runs on Arduino using the IRremote library.

Send:
void IRsend::sendPHOENIX_LTX(unsigned long data, int nbits) {

enableIROut(36);
//HEAD
mark(PHOENIX_HDR_MARK);
space(PHOENIX_HDR_SPACE);
mark(PHOENIX_HDR_MARK);
int i = 0;
for (i = 0; i < 7; i++) {
if (i % 2 == 0) {
space(PHOENIX_LTX_SPACE);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
}
//DATA
if ((data >> 2) & 1 == 1) {
mark(PHOENIX_LTX_ONE_MARK);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
space(PHOENIX_LTX_SPACE);
if ((data >> 0) & 1 == 1) {
mark(PHOENIX_LTX_ONE_MARK);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
//TAIL
for (i = 0; i < 4; i++) {
if (i % 2 == 0) {
space(PHOENIX_LTX_SPACE);
} else {
mark(PHOENIX_LTX_ZERO_MARK);
}
}
space(PHOENIX_LTX_SPACE);

}

Receive:
long IRrecv::decodePHOENIX_LTX(decode_results *results) {

long data = 0;

int offset = 1;

int i = 0;

//HEAD

if (results->rawlen != 18) {

return ERR;

}

if (!MATCH_MARK(results->rawbuf[offset], PHOENIX_HDR_MARK)) {

return ERR;

}

offset++;

if (!MATCH_SPACE(results->rawbuf[offset], PHOENIX_HDR_SPACE)) {

return ERR;

}

offset++;

if (!MATCH_MARK(results->rawbuf[offset], PHOENIX_HDR_MARK)) {

return ERR;

}

offset++;

for (i = 0; i < 7; i++) {

if (i % 2 == 0) {

if (!MATCH_SPACE(results->rawbuf[offset], 2000)) {

Serial.println(i, DEC);

return ERR;

}



} else {



if (!MATCH_MARK(results->rawbuf[offset], 1000)) {

Serial.println(i, DEC);

return ERR;

}

}

offset++;

}

Serial.println("Data");

//DATA

for (i = 0; i < 3; i++) {

if (MATCH_MARK(results->rawbuf[offset], PHOENIX_LTX_ONE_MARK)) {

data << 1;

data |= 1;

} else if (MATCH_MARK(results->rawbuf[offset], PHOENIX_LTX_ZERO_MARK)) {

data << 1;

data |= 0;

} else {

Serial.println(i, DEC);

return ERR;

}

offset++;

}

Serial.println("Tail");

//TAIL

for (i = 0; i < 2; i++) {

if (!MATCH_SPACE(results->rawbuf[offset], 2000)) {

return ERR;

}

offset++;

if (!MATCH_MARK(results->rawbuf[offset], 1000)) {

return ERR;

}

offset++;

}



// Success

results->bits = 3;

results->value = data;

results->decode_type = PHOENIX_LTX;

return DECODED;

}

Defines:
#define PHOENIX_HDR_MARK 3000
#define PHOENIX_HDR_SPACE 6000
#define PHOENIX_LTX_ONE_MARK 2000
#define PHOENIX_LTX_ZERO_MARK 1000
#define PHOENIX_LTX_SPACE 2000

Sunday, May 30, 2010

TankTank 0.3.1 (Experimental)



Less 'crashing into walls' Edition.

Download

Sunday, April 25, 2010

Internet TankTank 0.3.0


New version of tanktank with fewer unintended features and more candy! Internet servers via the server browser appear to work. You need to open port 18007 for TCP/UDP if you want it to work though.



  • CTF was rebalanced.

  • Spawns were color coded

  • Unused spawns were hidden

  • New teams arn't created after game start to keep it balanced

  • Vastly improve push zone drawing

  • Turn triangle around seems to help when people get stuck

  • Fix some laser issues

  • Drawing tweaks

  • Fix for cwd issue and empty maps

  • Draws properly on win7 now hopefully


Download


O yah, Lava!

Monday, April 5, 2010

SteamBirds

Quite fun fighter plane game! If you are not playing it your are clearly the victim of lead poisoning.


Monday, January 11, 2010

Capture TankTank Fish 0.2.8


Now with server browser and capture the flag support. Also works better on vista/win7.

Also added an option to turn off UDP if your firewall explodes like mine does.

Mongo says get it now.