Autor Tema: how can i make a level editing program?  (Leído 1002 veces)


  • Hero Member
  • *****
  • Mensajes: 650
  • Karma: 4
how can i make a level editing program?
« en: Mayo 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.


  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • I'm the eye in the sky.
    • dyko designs
Re: how can i make a level editing program?
« Respuesta #1 en: Mayo 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: 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.

« última modificación: Mayo 11, 2011, 10:15:40 am por handsource-dyko »


  • Hero Member
  • *****
  • Mensajes: 2002
  • Karma: 257
Re: how can i make a level editing program?
« Respuesta #2 en: Mayo 11, 2011, 12:42:17 pm »
in bennupack exist any samples...

how this one..

advance examples \ Ludum10final