It's really not as hard as you think.
YOU decide what kind of program you are making. Therefore YOU decide what information your program needs to load.
As Sledge suggested above, if your program needs to create a few cubes and needs to know the cubes dimensions and locations, then thats the type of data that you would need to store.
Here, I will show you an example. I made a Pitfall II clone a year ago. I also added an additional cavern for the player to explore if they completed the first so I built a LoadLevel function to load in the levels.
The Pitfall II game is a large underground cavern which can basically be represented by an array 8 units wide by 30 units deep.
At each location of the cavern (array), my program needed to know what was at that location. So I built a level editor that stored each locations specific data in to a file. I created a type that contained the following elements:
type of graphic
water at that location?
left_blocked?
right_blocked?
type of animal at that location (0 for none)
ladder at that location?
checkpoint at that location?
background_image
treasure at that location?
Then the editor just stored each of those type fields to the file in order while running through the array top/bottom, left/right.
In my main program I created the "level" type that would store the data at each location: (Note that the term 'level' being used here is not meant as in an entire game level but as in a 'platform')
Type Level
Field graphic ;0=nothing 1=ladderhole 2=hole-in-middle 3=left 4=right 5=ladderhole+2holes
;6=flat 7=ground 8=treetops 9=water 10=skyline 11=other-treetops 12=other-skyline
Field water ;0=not 1=true(graphic needs to be set to 3 or 4)
Field left_blocked ;0=not 1=solid 2=checkered
Field right_blocked ;0=not 1=solid 2=checkered
Field animal ;0=not 1=bat 2=bird 3=scorpion 4=frog 5=eel 6=mouse(treasure has to be 6 also)
Field ladder ;0=not 1=ladder in middle
Field checkpoint ;0=not 1=true
Field background_image ;0=not 1=water 2=trees 3=treetops 4=ground 5=other-trees
Field treasure ;0=not 1=gold(right) 2=gold(left) 3=cat 4=girl 5=ring 6=mouse(animal has to be 6 also)
End Type
and then I created an array of types:
Dim Board.Level(8, 30)
;8 screens across x 30 levels high (including sky as a level)
My main program used this function to load one of the levels:
Function LoadLevelData(level)
;fill level data
If level = 2
l$ = "2"
Else
l$ = ""
EndIf
; Open the file to Read
filein = ReadFile("level"+l$+"data\leveldata")
If filein = 0 Then RuntimeError("Pitfall II - Error: Can't read level data. Reinstall program.")
For xiter = 1 To 8
For yiter = 1 To 30
; Read the data from the file
Board.Level(xiter, yiter) = New Level
Board(xiter, yiter)\graphic = ReadByte( filein )
Board(xiter, yiter)\water = ReadByte( filein )
Board(xiter, yiter)\left_blocked = ReadByte( filein )
Board(xiter, yiter)\right_blocked = ReadByte( filein )
Board(xiter, yiter)\animal = ReadByte( filein )
Board(xiter, yiter)\ladder = ReadByte( filein )
Board(xiter, yiter)\checkpoint = ReadByte( filein )
Board(xiter, yiter)\background_image = ReadByte( filein )
Board(xiter, yiter)\treasure = ReadByte( filein )
If Board(xiter, yiter)\treasure > 2
If Board(xiter, yiter)\treasure < 6
NumTreasures = NumTreasures + 1
EndIf
EndIf
Next
Next
; Close the file once reading is finished
CloseFile( filein )
Return NumTreasures
End FunctionFirst it loads the appropriate file;
then it goes into a loop (1-30 high, 1-8 across);
at each iteration of the loop it creats a type instance for that location of the cavern;
it then loads in each type field for that location;
it increments a treasure variable for me if there is any treasure at that location so that when the entire level is loaded my program knows how many treasure pieces need to be collected;
when done loading everything it closes the file;
at the end of the function it returns the number of treasures that were loaded.