Game Data

BlitzMax Forums/BlitzMax Programming/Game Data

juankprada(Posted 2014) [#1]
HI guys, Its been a while since I had to ask questions about Blitzmax. I've been working hard on my engine and soon I will have something to show. But for now, I am concerned about how to deal with game data.

I dont see any official xml/yaml/json mod in blitzmax. So how are you guys dealing with data (i.e. tile maps definitions, entities sheets, saved states)?

Are banks used here?

Thanks


GfK(Posted 2014) [#2]
bah.libxml


juankprada(Posted 2014) [#3]
Thanks

Now, and this is just curiosity, before brucey did this module, how did people handled data?


Hardcoal(Posted 2014) [#4]
maybe my database will do?
give it a try its simple to use
but still you will need instructions

if it suites you the ill answer your questions of how to use.

https://www.dropbox.com/s/9jyph2uchgwhox4/MyDataBase.rar

the world was a different place before brucey :p


juankprada(Posted 2014) [#5]
Thanks Hardcoal. I will take a look at your code later.


dynaman(Posted 2014) [#6]
Before Brucey there were executable "bundlers" that allowed you to distribute a bunch of files along with the executable. I think some of them made it possible to put all the files in one "exe" file. Otherwise people zipped up the files and distributed them that way.


juankprada(Posted 2014) [#7]
@dynaman, Well I didnt ask about how to deliver or package assets into your game. My question was more about how to define some of the data for the game.

For example:
Lets say you have want to define a tiled map for Town 1

File town1.map would be like the code below if it was defined in xml

<town name="town one" w="10" h="10">
<tiles>
<tile>1</tile>
<tile>1</tile>
<tile>1</tile>
<tile>3</tile>
<tile>3</tile>
<tile>1</tile>
...
..
</tiles>
</town>

Now to work with such file you would need some functionallity to parse the information and recreate the town you defined there. That would be bah.libxml module @Gfk pointed out before.

So if bah.libxml was created by brucey and not BRL, how do people coped with this kind of problems before there was an unofficial way of handling that kind of data?


TomToad(Posted 2014) [#8]
It is not hard to create your own format without the need for xml. Sometimes xml is a little overkill for some types of games. Here is an example
name=town one
width=10
height=10
tile=01=11133132231
tile=02=13322233211
tile=03=32232122211
...
end=town one

Now to parse, all you have to do is
Local Line:String[] = ReadLine(Stream).Split("=")

the tag will be in Line[0] and the data will be in Line[1]. In the case of the "tile" tag, you have the row number in Line[1] and a string of tile numbers in Line[2]. The tile numbers can be parsed like this
For Local i:int = 0 Until Line[2].length
    Local TileNum:Int = Line[2][i]-asc("0")
    DoStuffWithTile()
Next

Of course, this is one way of doing it. There are a number of different ways to store level info without using xml.


dynaman(Posted 2014) [#9]
Sorry, thought this was another thread.


Henri(Posted 2014) [#10]
Hello,

I would think SQLite database (database in a single file) would be a neat way of storing any gamedata.

-Henri


juankprada(Posted 2014) [#11]
@Henri, I also thought about SQLite, but I am concerned about perfomance. I really dont know how much processing is done compared to parsing files.


Henri(Posted 2014) [#12]
I'm quite certain that performance isn't an issue

-Henri


Matty(Posted 2014) [#13]
While it's not for blitzmax, I am currently using a mySQL database for storing all my game and session data and only updating the clients when there is a change....it's a web based game. I don't use xml I just use a string which I parse when it arrives at the game. There's a million and one ways to store data.


GfK(Posted 2014) [#14]
As far as XML is concerned, you don't parse the XML file on the fly. You parse it at startup/whatever, and dump the contents into appropriate containers be it custom objects, linked lists, maps or whatever else.


juankprada(Posted 2014) [#15]
I will check both options xml and SQLite. I just wanted to know if there was an easy way to handle data without relying on third party mods. Not because they are bad or something like that, but because right now BlitzMax is not as popular as it should/used to be so third party mods might be unsupported by their devs anytime

Thank you all for your help.