Forum BigDB large map state (array of objects)

Discussion and help relating to the PlayerIO database solution, BigDB.

large map state (array of objects)

Postby jasonredhawk » August 24th, 2013, 12:10 am

I've built a multiplayer game that requires a significant amount of data to keep track of the current game state. To put it in perspective, this game is a wildfire fighting game, and the map is a large 2D array of terrain objects. Each terrain object contains information on its type (ie, trees, grass, water, etc), its state (ie, alive, dead, burnt, etc), its location (ie x,y coords), etc etc. Currently, these maps contain approx 55,000 terrain objects, but later may potentially contain millions of terrain objects for epic size maps.

Currently, the initial map data is saved in an object that's loaded from a file, approx 1-3mb, which is loaded initially by each client. Then the "operator" client handles all the fire spreading calculations and sends that info to all the other clients. All that is working perfectly, but here's the part that's tricky for me. If a new player joins an existing game, I want to send them the updated game state, what trees are already burning, already dead, etc. Now since the "operator" client has already sent that data for each tree as it burns, I could hold that information in the BigBD. I'm not sure how to make that work properly, what kind of data structure would I need to implement.

Furthermore, the database would need to be able to handle multiple maps played by different groups of players in different game rooms. I hope I explained myself clearly and would appreciate any advice on how to set this up.

Thanks,
Jason
jasonredhawk
Paid Member
 
Posts: 25
Joined: April 4th, 2013, 9:15 pm

Re: large map state (array of objects)

Postby romeoordos » August 25th, 2013, 7:00 pm

Do your players have to know the state of whole "Epic" map at once?

If no then you should divide your maps into chunks and let your players load the only chunks they see at current time.
Your chunks will be also 2d array but with larger scale. Save then with keys like "mapname_1_1, mapname_1_2, etc."
romeoordos
Paid Member
 
Posts: 9
Joined: July 27th, 2013, 10:42 am

Re: large map state (array of objects)

Postby jasonredhawk » August 27th, 2013, 3:32 pm

Thanks romeoordos for your reply. :)

Though the "Epic" map is a future update, the game state has to be in sync completely as different players will be looking at different parts of the same map. The fire spread data is important to keep synced. Also, I do have it tiled map, like you mentioned. It's very similar to how Google Maps looks like, a grid of tiles, I think I have my bitmapData at 100x100px to keep things fast.

I guess my real question is, how to I send a large array of objects to a client? Do I send a broadcast for each terrain object sequentially, or can I group the array together and send it all in one go, or can I group them together in manageable chunks? Generally, I think there would be an array of a few thousand blits, but potentially 10s of thousands later on. Each terrain object is fairly small, just a lot of them.
jasonredhawk
Paid Member
 
Posts: 25
Joined: April 4th, 2013, 9:15 pm


Return to BigDB



cron