Bennu Game Development

English Forums => Helpdesk => Topic started by: MisterN on May 10, 2011, 02:11:53 AM

Title: how can i make a level editing program?
Post by: MisterN on May 10, 2011, 02:11:53 AM
now that ive finished the game engine (built it nicely done, added stuff you didnt help me with), I would like to know how I can make a level editing (or even sdk for that matter) program. How I imagined it is simply this:
*i load a background image (the mask)
*i place objects inside that area with given names like player and pellet and enemyx
*it saves it as a .txt file that simply gives:
   *the location of where the objects will spawn
   *where events will happen
   *the levels name
   *the next level it loads
   *etc (basically its the same code you would put intot he game itself, but it saves space)
i would perfer to do this cause alot of pc games have some sdk or another and id like this game to be moddable (in a way). i asked a friend of mine (whos a computer prodigy by the way) and he said something like that isn't very hard at all (but then again he goes to m.i.t, he is unable to assist me). i think i can make the code so it loads every screen from that .txt file. even if i dont have a level editing program if i can apply the level to a .text file and where everything spawns (can you give me code for that), that would be really nice. do you udnerstand what i mean? thanks.
Title: Re: how can i make a level editing program?
Post by: handsource-dyko on May 11, 2011, 07:48:06 AM
A level editor. Well it is possible, but it ain't gonna be easy. Basically you need to take it into account when you start a project, because it requires extensive use of data structures. For file formats, I recommend binary dat files, since the represent the internal memory organization of the game's data structures. Using text files is much more difficult. To get an Idea what's possible, you may have a look at my project, wich is an improved version of malvado. The sourcecode is gpl, so you can peek around. But, It took me a year to do, and still I feel it could be Improved. Just start out with putting stuff into structs before creating an editor.

Anyway, check it out: http://code.google.com/p/malvado-bennuremake/ (http://code.google.com/p/malvado-bennuremake/) The editor does most things what you've described, but it's a lot of spagetti code. You can find docs on the project page too.

Basicaly here's a seqecuece how I did it:


- Create a level struct. (put general stuff in here, like references to the background etc).
- Create sub-structs in the level struct for each process type (types of enemies mainly).
- Store process id's into the substruct. (Limit the amount of enemies to a fixed number for referencing).

The game engine needs to read the list from the struct everytime it starts the level. (Later this can be read from a dat file).
But bear in mind that a struct is just a way to organize memory, and that a data file is a exact "snapshot" of this.

In the editor, you have some kind of cursor, to pick move things around. The collision function is your friend here.
Process instance id's are also very important here. When you move an object under the cursor, it has to update two things:

- the x and y values of the enemy/object instance that cursor is colliding with.
- the same data, but now in the data struct.

But, there is so much more to it to be specific.

Title: Re: how can i make a level editing program?
Post by: l1nk3rn3l on May 11, 2011, 12:42:17 PM
in bennupack exist any samples...

how this one..

advance examples \ Ludum10final