Cameron Albert

Ramblings of software development, games and technology.

PBBGs and Performance

One of the main things I am concentrating on for Perenthia and my PBBG Engine is performance. A lot has to go on in a game, each action be it movement, combat, etc. causes a lot of code to be executed and database calls to be made. What I am striving for in Perenthia and ultimately in my PBBG Engine will be as few database calls per command as I can get away with. Right now Perenthia makes several calls, one to load the Character and depending on the action 1-4 more database calls and then the final save Character call.

For Perenthia, I was able to get movement into the Character load call, then make one call to determine if the player can move and if any monsters are encountered, then a final call to save the character. That is probably as small as I can get movement but it still does not perform the way that it should.

I thought about caching or storing the map in memory but with over 150,000 records in the table storing the map data that is just not a good idea. Just not sure of the best approach for this. The database procedure for movement runs in under a second so I don't think that is the bottle neck, I think the bottle neck is sending all that data from the server to the client. I may try to asnychronously download the map data to the client while they are playing and just send smaller amounts of data for the map. Maybe a JavaScript file that can be auto generated using custom handlers that would contain the entire map structure with X,Y,Z and Terrain values. Then I can just use the player's current location to position them on the map. since I validate their position on the server I can still perform the monster check and move check and just not send the whole map down the pipe.

Attack is another performance bottle neck that I plan to devote some time to once I get the map movement sped up. 


Written by Cameron

October 19, 2007 at 12:34 pm

%d bloggers like this: