Forum BigDB Massive 2D Array of Objects..

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

Massive 2D Array of Objects..

Postby jasonredhawk » July 24th, 2014, 4:58 pm

Hey all,

I've built a cooperative multiplayer wildfire fighting game for Android and soon for iOS using Flash AS3, Starling and PlayerIO. As part of the wildfire simulation, I've built a large 2D array of objects to represent the terrain of the map. Each object in the array is fairly small, holding info on: location, type, state, etc. To date, the largest map has approx 77,000 terrain blits, which is large, but manageable on a mobile device.

Recently, I've been trying to build HUGE maps. The one we just finished building has 438,000+ terrain blits! On my laptop, it loads fine, but my phone totally crashes due to lack of memory (Note2). I've tried reducing the size of each object within the array, but it didn't help. It's still too big.

So my question is, when a player starts a new game, can I temporarily push that whole array of terrain objects into BigDB? Then, as the fire spreads and burns more trees and units interact with the terrain (cutting trees, spraying water, etc) that I can access any terrain object quickly?

Ultimately, what I'd like to do is have the 2D array of terrain objects already in BigDB for every map in my game. When a user starts the game, it'll duplicate the 2D Array into another temp table so as to manipulate the data for that session.

Anyway, just not sure how to proceed, or if BigDB is the right option for that. Perhaps using the C# code, I could hold all that info there. Any help to point me in the right direction is much appreciated!

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

Re: Massive 2D Array of Objects..

Postby AquamentosGames » July 25th, 2014, 4:32 pm

Do you need to have the whole map loaded at the same time? Does the player see the whole thing at any given time?

If not you can break the map up into segments and have the player load the portion of the map he sees at any given time for the platforms that have lower available memory.
AquamentosGames
 
Posts: 27
Joined: December 9th, 2011, 12:44 am

Re: Massive 2D Array of Objects..

Postby jasonredhawk » July 25th, 2014, 5:16 pm

Thanks AquamentosGames,

I don't draw the entire map at the same time, only the visible viewport (graphically it's pretty fast using Starling). My main issue is holding the array of terrain objects, which needs to all be accessible since the fire can be burning outside the visible area, and/or units may be interacting with the terrain, like cutting trees or spraying water, etc.

I may have figured it out though, however I don't have my laptop handy to test. I think potentially my issue is the 15sec timeout within Flash, I need to increase that to 30secs or a 60secs. That may solve my problem. Logically, I can't see how a 1.3MB ByteArray saved file can uncompress to 500MB of memory usage, just doesn't make sense to me. I think it simply is timing out while loading the data.

I'll post my findings once I can test it again this weekend.

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

Re: Massive 2D Array of Objects..

Postby AquamentosGames » July 27th, 2014, 12:38 am

You can handle anything that happens outside the viewable area server-side. (plus a buffer equal to about 25-50% of the viewable area so you can scroll some without having to load.) The client only needs to know what the player sees.
AquamentosGames
 
Posts: 27
Joined: December 9th, 2011, 12:44 am

Re: Massive 2D Array of Objects..

Postby jasonredhawk » July 28th, 2014, 2:31 pm

Ultimately, that's the plan! To have most of the calculations to be server-side. Also, turns out that Flash Builder doesn't have a "Script Time Limit" option.

So now I need to figure out how to load a file, then read a ByteArray in C#, then somehow communicate the terrain states to the clients. Sounds like the fun is just beginning!

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


Return to BigDB



cron