Forum BigDB Saving levels from a level editor

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

Saving levels from a level editor

Postby Normero » December 24th, 2010, 1:57 pm

Hello, I'm working on a game that loads levels from multidimensional arrays.
Each array consists of about 30 rows with each 30 columns, so 900 elements per array.

I have a level editor, that I would like to make public, so people can create, save and share their levels.

Now I was wondering what the best practise for saving these arrays is.

Is it possible to store these arrays in PlayerIO's BigDB? Or is that overkill and is it more awesome to serialize them and store them in my own MySQL Database?

Thanks
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Saving levels from a level editor

Postby batiali » December 25th, 2010, 3:06 pm

Hello, as far as I know, there is no problem with saving those arrays into bigDB.
What I would do is to convert it into a string and save that way.
As an example, if your level looks like this:
1 1 1 1
1 0 0 1
1 0 2 1
1 1 1 1
It will be converted to:
"1111100110211111"
batiali
 
Posts: 29
Joined: August 11th, 2010, 2:53 pm

Re: Saving levels from a level editor

Postby Normero » December 25th, 2010, 5:32 pm

Yeah I noticed BigDB can also save Arrays, is that AS3 arrays, C# arrays or some other sort of array?

Is that recommendable or is it easier to serialize it into a string?
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Saving levels from a level editor

Postby Oliver » December 27th, 2010, 3:57 pm

The arrays in BigDBs are not really C# arrays. They're not quite As3 arrays either, although it's much closer.

They're our own implementation of Sparse Arrays, which means that if an array only has an entry on slot #100, it will only take up one memory unit of ram.

You should totally save your levels in BigDB! Its exactly that sort of thing that it was built for. For example, the game Everybodyedits.com uses BigDB to store a ton of user-generated levels.

If your levels are a grid with numbered block on each slot, it will probably be most efficient to serialize the level into a byte array, and store that on a bigdb object.

- oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Saving levels from a level editor

Postby Normero » December 29th, 2010, 2:42 pm

Thanks, I'll check it out! :D
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm


Return to BigDB



cron