Jump to content

  • Log In with Google      Sign In   
  • Create Account

Basic Level Editor Question


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 22 January 2013 - 12:38 PM

Random question (one i've been wondering for a while) 

 

1: How are level editors setup? I've seen some basic screen shots of some from certain games so i know how they look but how do they work?

 

2: Would you setup a function in your main game to load whatever format the editor is saving to disk?

 

I'm working with DX11 and C++ and I'm working on getting textures working correctly and all that but it will just take too long to put ALL the blocks and textures i want on the screen / in the level. 

 

The only thing I've seen looking around is this http://lazyfoo.net/articles/article09/index.php and a few editors that are on bitbucket for XNA. (Which is easy enough to figure out) They make sense but I figured I would ask. :) 



Sponsor:

#2 minibutmany   Members   -  Reputation: 1613

Like
0Likes
Like

Posted 22 January 2013 - 04:28 PM

I am working on a level editor for a 2D game, all it does is save the level as a text file, with different ASCII characters representing different tiles. The game just reads from the file and renders the background. Another method is to generate different layers, one as the actual image and then an unseen image file that has collision data. I am not sure what "real" game companies have used but these are just methods I have played with.


Stay gold, Pony Boy.

#3 BornToCode   Members   -  Reputation: 925

Like
1Likes
Like

Posted 22 January 2013 - 10:59 PM

The way i have done it is that the editor uses the engine directly. So the level loading function all comes straigh from the engine. That way when i have a standalone executable that i release i can reuse the exact same loading function. Everything the editor does it uses the engine. That way you get what is WYSIWYG (What you see is what you get) type of editor. I have attached an screenshot of my 3d editor which i am currently working on just to give you an idea.UpdateEditor3.png


Edited by BornToCode, 22 January 2013 - 11:05 PM.


#4 rdragon1   Crossbones+   -  Reputation: 1200

Like
1Likes
Like

Posted 22 January 2013 - 11:07 PM

The way i have done it is that the editor uses the engine directly. So the level loading function all comes straigh from the engine. That way when i have a standalone executable that i release i can reuse the exact same loading function. Everything the editor does it uses the engine. That way you get what is WYSIWYG (What you see is what you get) type of editor. I have attached an screenshot of my 3d editor which i am currently working on just to give you an idea.UpdateEditor3.png

Looks like someone likes Unity smile.png

#5 BornToCode   Members   -  Reputation: 925

Like
0Likes
Like

Posted 23 January 2013 - 12:10 AM

Yeah i love Unity user interface. So my editor is hugely based on a very similar layout and engine is design in a very similar manner to how they have things do. I am using the Component based system in my engine as well. That is where i deviate from Unity, everything else is done differently in mine. Yes you do have an inspector which can display all the Components which are attached to an game Object, but my intent is to make something that is different in terms of functionality while having an UI that is very similar to Unity. That way people that are used to Unity can settle in alot easier. Also if you look in my icons in the bottom you will see i have Unity Open. So what i basically do is mess around with their editor, then replicate the UI/Functionality that i like about their editor in mine.


Edited by BornToCode, 23 January 2013 - 12:10 AM.


#6 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 January 2013 - 04:51 AM

The way i have done it is that the editor uses the engine directly. So the level loading function all comes straigh from the engine. That way when i have a standalone executable that i release i can reuse the exact same loading function. Everything the editor does it uses the engine. That way you get what is WYSIWYG (What you see is what you get) type of editor. I have attached an screenshot of my 3d editor which i am currently working on just to give you an idea.UpdateEditor3.png

 

That's kind of what I'm looking to do. It probably would be better if I could access the engine directly. Because I just wanted the ability to put in shapes and textures to make up areas and levels. Its just what to save it to and really how to even start that's a tough point for me. I can open a window that's win32 and initialize D3D in that window and start to create little buttons and menus its just I'll end up getting stuck right where I would be displaying anything really.



#7 BornToCode   Members   -  Reputation: 925

Like
0Likes
Like

Posted 23 January 2013 - 11:14 AM

I

That's kind of what I'm looking to do. It probably would be better if I could access the engine directly. Because I just wanted the ability to put in shapes and textures to make up areas and levels. Its just what to save it to and really how to even start that's a tough point for me. I can open a window that's win32 and initialize D3D in that window and start to create little buttons and menus its just I'll end up getting stuck right where I would be displaying anything really.

 

I know exactly what you are talking about. A good way i get around that is that the game engine evolves along with the editor, if there is something you are trying to do in the editor for example, let's say you want to be able to create basic shapes in the editor when you click an button for example. Then what i do in that case is go in the engine side and add several functions that does exactly that. So in the end your engine evolves along with your editor and they both goes hand in hand. That way you know whatever you seeing rendering the editor screens are coming straight from the engine calls. If you were able to see the screenshot of my editor that i posted, In my editor you can create four different viewport at the same time where each viewport share a single Render Context but have to have their own Device Context. So what i basically do is create a class on the engine side that allow me to have multiple windows share the same GL Ressource Context but with different Device Context. 



#8 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 23 January 2013 - 11:25 AM

 
I

 

That's kind of what I'm looking to do. It probably would be better if I could access the engine directly. Because I just wanted the ability to put in shapes and textures to make up areas and levels. Its just what to save it to and really how to even start that's a tough point for me. I can open a window that's win32 and initialize D3D in that window and start to create little buttons and menus its just I'll end up getting stuck right where I would be displaying anything really.

 

 

I know exactly what you are talking about. A good way i get around that is that the game engine evolves along with the editor, if there is something you are trying to do in the editor for example, let's say you want to be able to create basic shapes in the editor when you click an button for example. Then what i do in that case is go in the engine side and add several functions that does exactly that. So in the end your engine evolves along with your editor and they both goes hand in hand. That way you know whatever you seeing rendering the editor screens are coming straight from the engine calls. If you were able to see the screenshot of my editor that i posted, In my editor you can create four different viewport at the same time where each viewport share a single Render Context but have to have their own Device Context. So what i basically do is create a class on the engine side that allow me to have multiple windows share the same GL Ressource Context but with different Device Context. 

 

That was probably the greatest replay. You could have posted code and it wouldn't have been as good as this. That makes a LOT of sense. smile.png I really didn't think about it that way. 

 

Pretty much what I've taken from this is, (as you said) as I build my engine up build up the editor as well. If I want to make basic shapes, make a class in the engine that allows me to do so. (To me that means, enhance the classes i have / make a new one where when passed certain variables a shape will be made. (ie. clicking "square" passes parameters to make a square")) Pretty much that's my biggest issue. The only other issue i really have is setting up like save data and etc. Which still doesn't make any sense. Should I be saving it as a "yourlevel.lvl" or like a special format? I'm still looking up about how to load and save certain files for levels. My guess at this is that when I "save" all it's saving is the placement of the camera, blocks/objects, and lets say player starting area(in code). So when you are in the main game and you load that level its already setup. It's just a matter of loading it into the game. I'm still a little "eh" about that whole subject but hopefully it comes soon. smile.png Feel free to correct me if any of my previous statements were incorrect/need improved. 

 

All of DirectX just seems like a bit much so far, I really do enjoy it however. It just feels like.. a lot of the "support" or community for it isn't here / they aren't sure about certain things. There are times that  I think i'm asking in the wrong area / forum because of these questions. It is nice to find you (and a few others) who do understand DirectX and are actively using it however.


Edited by Inuyashakagome16, 23 January 2013 - 11:26 AM.


#9 BornToCode   Members   -  Reputation: 925

Like
0Likes
Like

Posted 23 January 2013 - 05:35 PM

Pretty much what I've taken from this is, (as you said) as I build my engine up build up the editor as well. If I want to make basic shapes, make a class in the engine that allows me to do so. (To me that means, enhance the classes i have / make a new one where when passed certain variables a shape will be made. (ie. clicking "square" passes parameters to make a square")) Pretty much that's my biggest issue. The only other issue i really have is setting up like save data and etc. Which still doesn't make any sense. Should I be saving it as a "yourlevel.lvl" or like a special format? I'm still looking up about how to load and save certain files for levels. My guess at this is that when I "save" all it's saving is the placement of the camera, blocks/objects, and lets say player starting area(in code). So when you are in the main game and you load that level its already setup. It's just a matter of loading it into the game. I'm still a little "eh" about that whole subject but hopefully it comes soon. Feel free to correct me if any of my previous statements were incorrect/need improved. 

 

You are pretty much on track. The engine evolves with your editor. A good thing working in that manner is that sometimes when you work on your engine, you are not sure what you will need in it. But when working on the editor you might be like i want to do x or y. Then realize i will add x or y on the engine and do on the editor. Now regarding Saving and loading. the way i handle that in my engine is that each map is called a Scene in the engine, where a scene has all the objects that are part of a level. The scene contains an Save and Load function that save.load the state of Each GameObject that i have in the scene to some custom format. So on the editor side for example whenever you create an new Scene i just create an new Scene on the engine side. When you add an Model/Load one i just call the Add function of the Scene on the engine side and add the model to the Scene class. Whenever you click the save button on the editor i just call the Save function of the Scene Class. I do the same thing when i want to load. So at the end of the day once you are done with the editor, you can create an standalone executable with the engine, and if you want to load level.x for example you can just call the Load function from your scene class with level.x and it will just run exactly as if it was in the editor but this time you have a standalone application.



#10 Inuyashakagome16   Members   -  Reputation: 835

Like
0Likes
Like

Posted 24 January 2013 - 06:00 AM

Pretty much what I've taken from this is, (as you said) as I build my engine up build up the editor as well. If I want to make basic shapes, make a class in the engine that allows me to do so. (To me that means, enhance the classes i have / make a new one where when passed certain variables a shape will be made. (ie. clicking "square" passes parameters to make a square")) Pretty much that's my biggest issue. The only other issue i really have is setting up like save data and etc. Which still doesn't make any sense. Should I be saving it as a "yourlevel.lvl" or like a special format? I'm still looking up about how to load and save certain files for levels. My guess at this is that when I "save" all it's saving is the placement of the camera, blocks/objects, and lets say player starting area(in code). So when you are in the main game and you load that level its already setup. It's just a matter of loading it into the game. I'm still a little "eh" about that whole subject but hopefully it comes soon. Feel free to correct me if any of my previous statements were incorrect/need improved. 

 

 

You are pretty much on track. The engine evolves with your editor. A good thing working in that manner is that sometimes when you work on your engine, you are not sure what you will need in it. But when working on the editor you might be like i want to do x or y. Then realize i will add x or y on the engine and do on the editor. Now regarding Saving and loading. the way i handle that in my engine is that each map is called a Scene in the engine, where a scene has all the objects that are part of a level. The scene contains an Save and Load function that save.load the state of Each GameObject that i have in the scene to some custom format. So on the editor side for example whenever you create an new Scene i just create an new Scene on the engine side. When you add an Model/Load one i just call the Add function of the Scene on the engine side and add the model to the Scene class. Whenever you click the save button on the editor i just call the Save function of the Scene Class. I do the same thing when i want to load. So at the end of the day once you are done with the editor, you can create an standalone executable with the engine, and if you want to load level.x for example you can just call the Load function from your scene class with level.x and it will just run exactly as if it was in the editor but this time you have a standalone application.

 

Okay that makes sense. Its just a custom format and you are setting up a save function in your scene class. I don't believe I have one of those but I understand the concept. :)

It seems much easier than I originally thought in all honestly. I really thought it would be more complicated than this.



#11 BlackJoker   Members   -  Reputation: 531

Like
0Likes
Like

Posted 28 February 2013 - 03:20 PM

BornToCode

 

Could you please tell me which UI you use for editor? I want to use Win Forms control inside WPF window to make good and easy customized UI.

Is this correct decision, how do you think?



#12 BCullis   Crossbones+   -  Reputation: 1813

Like
0Likes
Like

Posted 01 March 2013 - 08:35 AM

All of DirectX just seems like a bit much so far, I really do enjoy it however. It just feels like.. a lot of the "support" or community for it isn't here / they aren't sure about certain things. There are times that I think i'm asking in the wrong area / forum because of these questions. It is nice to find you (and a few others) who do understand DirectX and are actively using it however.

 

DirectX is all over game development, the "community" is HUGE.  Every major studio is using either Direct3D or OpenGL for their 3D rendering.  There's a specific subforum just for DirectX.  I'm having trouble understanding why you think there's no/little support for it out there.  Books, tutorials, and entire websites are dedicated to the topic.

 

Though technically, your question doesn't have anything to do with DirectX specifically, it's more of a generic architecture topic.

 

Anywho:

 

My editor serializes data based on what I've determined is "just enough" to rebuild the level with in the game, and saves that out to a binary file.  It includes references to all the assets it needs, and where/how to put them when the level is loaded.  Just decide what raw data describes your level well enough to recreate it on load and that's what you want to save.  It can be as small (or huge) as you prefer.

Concrete example: I put a rock bridge prop into my scene.  It's centered at (100, 250, 25), scaled up by a factor of 2, and rotated 30 degrees on the Y axis.  Instead of putting a 400-triangle mesh plus texture into my save file, all the Save() function does in the editor is jot down "position: 100,250,25.  scale: 2,2,2.  rotation: 0,30,0. Prop: rock_bridge_1." (Not in text, serialized Vector3s and a string, but you get the idea).

The level loader goes to the appropriate resource package (another story, I'll save for later *), looks up the mesh and texture associated with "rock_bridge_1", and places it in the scene at 100,250,25, scales it up by 2, and rotates it 30 degrees on the Y axis.

 

So yes, you determine the file structure and type, and like a lot of software development, it really IS straightforward and easy once it's been demystified. smile.png

I name my file type ".mmp" but that's entirely arbitrary.

 

Keep in mind you can serialize binary files, or you can write out things like JSON or XML files as well.  I went binary because C# has a handy binary serializer/deserializer.  Some people prefer the text-editable files because you can just hop in and tweak them directly if you want.

 

*Edit: if your curious, turns out I already wrote a post on it here.


Edited by BCullis, 01 March 2013 - 08:40 AM.

Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

#13 BornToCode   Members   -  Reputation: 925

Like
0Likes
Like

Posted 04 March 2013 - 03:24 PM

BornToCode

 

Could you please tell me which UI you use for editor? I want to use Win Forms control inside WPF window to make good and easy customized UI.

Is this correct decision, how do you think?

I am using C++ for the engine. And C++/CLR for the editor. I could have easily use C# instead, but i did not want to go through the hassle of creating wrappers for my C++ engine.


Edited by BornToCode, 04 March 2013 - 03:32 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS