Sign in to follow this  
_damN_

Best practise for creating a level editor

Recommended Posts

Hi there... I am about 3/4 finnished developing a 2D game engine and so far its working great! But then i thought, it would be great and maybe even a bit more "Commercial" to add a level editor somehow but im not really sure how to go about doing this. Is it a good idea to create the level editor on top of the engine within the same folder(2 solutions within the same project) or should it be a completely different project but still be built on top of the engine. Or should it be a completely different project that has nothing to do with the engine? I hope im not sounding too confusing... Any help would be appreciated! Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by _damN_
Is it a good idea to create the level editor on top of the engine within the same folder(2 solutions within the same project) or should it be a completely different project but still be built on top of the engine. Or should it be a completely different project that has nothing to do with the engine?
Another option, which you don't appear to have considered, is to make the editor in-game.

Whichever way you choose to do it, I would suggest reusing as much code and functionality as possible from the game itself - after all, many features are the same (graphics, etc.)

Share this post


Link to post
Share on other sites
Hi! Thanks 4 the reply...

I have actually considered that. But because its an engine and not really a specific game, i think it would be better in this case to have it as a different application to build a map etc and then save it... Then have the engine be able to load it when necessary... But im not really sure. Its always good to get other peoples ideas.

Share this post


Link to post
Share on other sites
You could do what torqueX does with TorqueX Builder and have the engine generate an xml file on compile which the editor reads and can manipulate visually. Then the engine reads the xml file to see what's been thrown in and acts accordingly. (At least that's how I understands it works from what I saw)

Share this post


Link to post
Share on other sites
I am making a 2D game as well (I am a lot less complete than you are, however), and I plan on making a game editor as well. My planned design process goes like this, basically:

1. Design the game. Ensure it retrieves all of the data for it's levels from associated files.
2. Create a console based application (seperate project) that reads txt documents and creates map files based on what is typed in the txt file (essentially, a very basic level creator), just for creating the maps of the main campaign.
3. Create a sort of 'dev' mode in the game that lets me explore created levels to ensure they are up to par and that everything is where I want them.
4. Put the campaign together and finish the game.
5. THEN worry about making the editor (as a seperate project), which basically expands upon the console level editor by using a GUI and replacing the text input with user input and project save files.

I want the editor to be seperate from the game, simply because I want the game to be simply the game (it seems more polished to me this way) and because I don't want to try to take on two projects at once (the game is begin enough).

Initially using the TXT method is extremely user-unfriendly and may be nearly impossible for even a more slightly complex game, but I only want the method for creating levels prior to the game's completion to be at least feasible, which it is (again, for my simple game).

If your game is complex enough, you may NEED a level editor, but if you look at unreleased level editors used by professional game companies, they are consistantly user-unfriendly, and only in-depth enough to get the job done.

Share this post


Link to post
Share on other sites
"I want the editor to be seperate from the game, simply because I want the game to be simply the game (it seems more polished to me this way) and because I don't want to try to take on two projects at once (the game is begin enough)."

Having the editor created with the game isnt necesarily less polished. And you wouldnt be taking on 2 projects really... Because the map editor would already use alot of the origional drawing code i think. And because it gets released with the game, it would be more "commercial" quality.

Ive avoided making level editors for a long time because im scared it would be hard. But i really wanto make one that i can re-use multiple times for different projects. So now ive decided to make one alongside my engine.

Im not even really sure where to begin. How would you save the map data in a text file? What kind of data would it save? Would it just be numerical numbers representing different tiles?

Share this post


Link to post
Share on other sites
Quote:
Original post by _damN_
How would you save the map data in a text file? What kind of data would it save? Would it just be numerical numbers representing different tiles?
In what form does your game load levels right now? I would suggest using that to start with.

If your levels are currently hard-coded, then go grab a few open-source or mod-able games of a similar type, and check how they do it - avoid SuperTux on this score, unless you are comfortable with LISP [wink]

Share this post


Link to post
Share on other sites
Hey, _damN_.

These are just a few thoughts on your Engine/Level Project. Igonre if you will or take a gander. It may give you just that little bit of knowledge to impart to you where you stand with your level editor:

1. You mentioned that you were scared for a long time about creating level editors? You say that you have created an engine capable of 2D graphical display and functionality! By the Builder! Canst thou see that thee hasnt maketh unto Hammer's demise (Read: Why are you putting yourself down when you've done more than most of the programmers, artists, animators and designers have- possibly in their entire careers/hobbies)

2. If you have built a 2D engine (and I'm assuming this is up to mid-level functionality and professionalism; although its more likely that you lied - or didn't realise - and have made something that isn't up scratch like an end user's GTA2 editor), you do not have as much to worry about, as you should already know some of the functionality behind your engine. You shouldn't procrastinate about something which you are probably not going to do. Hard-code or flexi-code, make the choice ASAP!

3. In my experience of using professionally develeoped level/map/game editors for PC games such as Deus Ex, Thief III(Unreal Engine 2); Fallout 3, Oblivion, Morrowind (GameByro); are developed solidly and have fucntionality that almost every lone person (Who at least has modicum of sanity) would not attempt. For this case, I mean that if you are going to create one for your 2D engine, remember that the engines stated, "COULD", be "USED" for different "TYPES" of games but "COULD NOT" be used to create the different types without "Re-coding" elements of them (UT2004 and Thief III, being excellent examples). Be prepared for it and don't get the funny idea to create a level editor for multi-project, multi game type games, it just doesn't happen.

Alright, I've said enough. Dismiss as you may and please. Remember, however, that you will fail untimely to succeed on top. Intepret as you may, I've got a monkey on my back that I've got to deal with, and his name is SANITY.

Share this post


Link to post
Share on other sites
Your editor will depend a lot on the type of game you've built. I always get tempted to use my game engine to build an editor, but after having tread this path a few times, I'm pretty sure it's usually not the best course. Games are usually not gui heavy, but editors obviously are. That said, your editor will possibly share some game logic and structures.

In general, I'd suggest building your editor in a gui friendly environment. Something like C#/Winforms. If the language is the same as the game's, then you may want to attempt to separate the necessary game logic/structures into a library that you can share between the editor and the game.

Share this post


Link to post
Share on other sites
Mmmm first of all... Dex seems like a crazy person... But great respect because you are as much a fan of thief as i am! :-D Well.. i can assure you that i have made the engine and i wasnt lying. Maybe im just a little bit too modest when it comes to my programming knowlege.

I actually thought last night that it would be possible to make the level editor with the code of the engine... Thinking about it, it really seems like it will work. The thing is, im not so great at windows programming like MDI's etc. I think thats what i always avoided. But i want the editor to be able to handle many different types of projects. That said... The editor doesnt have to always be used when making a game with the engine. Loading and saving maps is sufficient for now...

Anyway, thanks for the replies!

(wATch This SpACE)

Share this post


Link to post
Share on other sites
Quote:
Original post by _damN_
"I want the editor to be seperate from the game, simply because I want the game to be simply the game (it seems more polished to me this way) and because I don't want to try to take on two projects at once (the game is begin enough)."

Having the editor created with the game isnt necesarily less polished. And you wouldnt be taking on 2 projects really... Because the map editor would already use alot of the origional drawing code i think. And because it gets released with the game, it would be more "commercial" quality.

Ive avoided making level editors for a long time because im scared it would be hard. But i really wanto make one that i can re-use multiple times for different projects. So now ive decided to make one alongside my engine.

Im not even really sure where to begin. How would you save the map data in a text file? What kind of data would it save? Would it just be numerical numbers representing different tiles?
I don't mean less polished, poor choice of words. A game with an integrated editor could easily end up being very well polished. I just want my game to be the game as one package. If one of your game's strongest selling points is that it is heavily moddable then it is a very good route to take (integrating them, that is). However, I am trying to make my game as immersive as I can from start to finish, with a singular style mood throughout. It just seems to me like it would be difficult to maintain this when, with the click of a button at the menu screen, suddenly the user is looking at a big clunky slightly unfriendly and slightly confusing level editor. That's just personal preference for me, based on the nature of the game I am trying to design.

Not only that, but it sort of interefer with my own design process. Now, when I am making code for something like applying a sprite to the screen, I have to think 'which portions of this code can I make portable to my editor, and even if I am sure it is portable is it really going to do exactly what I think it is going to do?' I rather write the code for the game, making the game itself as efficient and self sufficient as I can, then worry about seeing what I can port over to an editor.

Regarding saving map data in a text file, I will describe that a little. Basically, each line of the txt document describes a different aspect of the map. The console based application I build, will be able to first analyze each line, line by line, to determine what qualities of the map it is trying to describe. For example, it might identify the first line of the TXT document, based on how many characters long it is and what is in it, as the 'header' line. Once it is identified, the data from each line is used to build the map.

Say a map has objects that any given map might have a dynamic amount of, such as tiles, or enemies. The application identifies a line as a tile line, then uses the data to build a tile, and then pushes this tile onto a vector. Though the tiles are stored in a one dimensional manner, they merely appear on screen in game in a two dimensional one.

Using all this information, it builds the binary file with the maps header information first, and then the vectors of the numerous dynamic objects after. The map file is saved with it's filename as an identifier (0001, for example).

When the file is loaded in game, the game knows which map to load by an identifier. The file is opened and it loads the header information first. The header information tells the game how many tiles, enemies, other objects there are, ect, and it loads these from the map file and pushes them onto a vector to be used in game. Then the map is ready.

If you were asking for specifics, as in like how to actually save and open files using fstreams, then I am sure there are articles for it on gamedev.net. It is too much for me to explain here (even though I did just type a lot...)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this