A good idea is to look into one of the many INI file parsers in the archives. A INI file has its info in very HUMAN readable format so it could look something like this:
Read this file line by line using the readline.
Then you can just parse in the file with simple use of the right$, Instr, Mid$ and Left$ string commands to read the data.
The advantage to a file format like this is that it is easy to see exactly what should be going on. Unlike more binary data based files where you have no real way to tell if the level data is valid or not. Now there are limitation to this type of file, for instance its not a very good Save Game format. With Save Game files you are probably just storing some internal variables as ints and floats so just using writeline and readline should work for them as long as you right and read in the same order.
No matter what format you use, keeping your level file broken up into sections will make creating, editing and loading them alot easier in the long run.
Ive recently come to conclusion I need to make a world editor form my underwater demo/game Im presently working on. The funny thing is, Im going to use the demo/game to do this, so anyone can simply goto edit mode while in the game and change the terrain and location of structures in real time. The format of the game level data is like that I posted above.
[playermesh] meshfile = "player.3ds" scalemesh = 0.2,0.2,0.2 [object] objectID = 100 objectmesh = "house.3ds" objectposition = 1021.1,0.0,121.1 objectrotation = 0.0,82.2,0.0 objectname = "Equipment Store" objectselectable = True [end object] [object] objectID = 1 objectmesh = "" objectpostition = 0.0,0.0,0.0 objectrotation = 0.0,90.0,0.0 objectname = "Player Start Location/Dirction" objectselectable = False [end object] .... etc .....
Read this file line by line using the readline.
Then you can just parse in the file with simple use of the right$, Instr, Mid$ and Left$ string commands to read the data.
The advantage to a file format like this is that it is easy to see exactly what should be going on. Unlike more binary data based files where you have no real way to tell if the level data is valid or not. Now there are limitation to this type of file, for instance its not a very good Save Game format. With Save Game files you are probably just storing some internal variables as ints and floats so just using writeline and readline should work for them as long as you right and read in the same order.
No matter what format you use, keeping your level file broken up into sections will make creating, editing and loading them alot easier in the long run.
Ive recently come to conclusion I need to make a world editor form my underwater demo/game Im presently working on. The funny thing is, Im going to use the demo/game to do this, so anyone can simply goto edit mode while in the game and change the terrain and location of structures in real time. The format of the game level data is like that I posted above.