Page 1 of 3

Level Editor

Posted: Mon Jul 21, 2008 3:53 pm
by pera
This is level editor that should grow to be a tool for making my games. It will allow building exterior and interior scenes. Complete game mods would be possible to build without programming: adding monsters, quests, magic items and NPC dialogues.

Currently at version 0.7, you can layout objects around, add some content to containers, and save/load the map file to irr and map (private) format.
Also, scripting system is created so you can add scripts.
And NPC dialogs... now you can easily create conversations with your NPC characters.
And monsters! Finally..

[update September 2010]
Releasing version 0.7, lots of bug fixes, updated to irrlicht 1.6.1 and improved functionality.

This is picture:
Image

Adding content to container:
Image

This is binary app ready to run:
http://www.mystic-peanut.com/files/le_b ... _win32.zip

This is source code:
http://www.mystic-peanut.com/files/le_s ... _win32.zip

This is site:
http://www.mystic-peanut.com

There are five tutorials included. Tutorials cover usage of level editor from basic to advanced. They should walk you through all functionality available and help you create games in just few steps:
- map creation
- container content
- writing scripts
- NPC dialogs
- monsters

Next version will address spells, particles, and freaking UNDO.

Posted: Mon Jul 21, 2008 5:41 pm
by Seven
very interesting. I am interested to see how you did this. Downlaoding the code base now. I have also created an editor. I find that it is the best method to truly learn the in's and out's of the engine. Nothing is easy about it and it making a working editor is quite a task. Congratulations.

Posted: Mon Jul 21, 2008 7:21 pm
by christianclavet
Congratulation. This is starting to look very nice.
edit: I had time to play more with it. You can select your object directly your object by only clicking on them and that's great! I'll have to check how you've done that!

The XML loader for Assets inventory is great! With some work, you could create an "manager" to maintain/administer thoses assets (instead of editing the XML file. This is one good thing, That I've saw on lots of editor, and you've started it! Great! I think there a GUI item that can be used as a MODEL VIEWER, perhap if that work, you could add a preview (Electron (Neverwinter II) style), when you select one asset.

Is there a way you can rotate the view in that version?

Is there a easy and quick way to delete the file cache ?(Nice feature for a game, but a Nightmare for an editor). We would not like to hog memory only to preview item and also we would like to update the item if modified from a 3D package. (Since the file is still in the file cache it's not updated from the HD but from memory).

If we could have a quick command like that: DeleteMeshCache("dwarf.x")
EDIT: After some searches. I found out that is already implemented in 1.4.1! Nice! :D
To delete the DWARF from the mesh cache:
SceneManager->getMeshCache()->removeMesh("dward.x")
Delete all the mesh cache!: SceneManager->getMeshCache()->clear();

To remove a loaded texture from the mesh cache:
Driver->removeTexture("dwarftexture.jpg");
To delete all textures from the texture cache:
Driver->removeAllTextures();
With those, we should be able to load meshes/texture for preview and they will not stuck in the cache, and also be able to update textures and meshes and see the result in the editor.
That could ease a lot of problems for any application other than games. (Could surely be useful in game also if user would like to use LOD and load the file with the same filename but in different folders (folders named: small, medium, huge. With different version of the same object. This can be done at the moment, but you have a different filename (if I remember correctly)

Posted: Tue Jul 22, 2008 1:59 am
by wildrj
does it save and load irr files? if so you have just saved my life :) by brining a .irr file editor to linux *other then irrblend*

Posted: Tue Jul 22, 2008 5:57 am
by pera
It does save to irr file type.
I only work in windows so I hope recompiling for linux will be fine.

Posted: Tue Jul 22, 2008 7:32 am
by JP
Yeah i think Irrlicht would ignore the extra lines of code as if you look at ISceneNodeFactory implementations they just deserialise specific members from the XML file, so unknown data should be safely ignored.

Posted: Tue Jul 22, 2008 6:42 pm
by christianclavet
I've been checking your source. Compared to my own code (awful :oops: ), your code is beautiful!

I've got a question about the way you select your nodes, It seems that you use a raycast collision with the terrain. But if your level is interior?

How many time have you put to create that release? You seem to have put a lot of time creating this! Very nice work. Please continue! You're giving me a good example to write code for an editor. :D

You could put that in your CEditorManager::CreateDevice() to allow the display device to be resizable.

m_pDevice->setResizeAble(true);

So it would look like this:

Code: Select all

void CEditorManager::CreateDevice()
{	 
	//create irrlicht device and send "this" as event receiver meaning this class should 
	//implement OnEvent function and handle its own events...
	m_pDevice = createDevice( video::EDT_OPENGL, dimension2d<s32>(900, 700), 16, false, false, false, this);
    m_pDevice->setResizeAble(true);
   	m_pDriver = m_pDevice->getVideoDriver();
    m_pSceneManager = m_pDevice->getSceneManager();
	m_pGUIEnvironment = m_pDevice->getGUIEnvironment();

}

Posted: Wed Jul 23, 2008 8:59 am
by pera
For selecting objects, I use this function getSceneNodeFromScreenCoordinatesBB, then I make sure selected node is not terrain (cause right now I want the floor static), and I store returned (selected) node pointer in member variable. If selected node is just terrain I clear member variable and no node is selected.

When moving selected object around I check terrain collision onMouseMove event and determine new object position, so Y position of object is always on the ground, if terrain has hills, moving house object up the hill would be smooth.

If level is interior, you have model instead of TerrainSceneNode then depends, you can add this model to collision triangle selector to have objects collide with it; if level is multileveled (this sounds funny), I mean more then one floor, then things might get jumpy, you'd have objects climbing walls as well as stairs when you move them arround, and there should be some modifications for this case. Definitely user should be able to input any position in edit box and click Set button (not working right now) to place model wherever he wants (floating in air, why not).

There is no rotation at all implemented in this version. You cant rotate camera nor objects.

I worked for a month on this editor, 5 hours a day, half of it was meddling with models converting it scaling it awful bussines. I work with irrlicht for 6 months now. Still lot to learn.

I like the idea about object preview, I was thinking of somehow picturing models listed in a tree, but I decided it is 'finishing touch' more then core functionality. It must be fast and discrete - helpful not annoying - maybe as you move your mouse over models in the tree you get preview window below with picture and characteristics, but there must be check button to turn it off if its clogging the FPS, and after a while you get to know all models so don't need a preview :)

Good help about resizable device and window - thanks.
All the comments are welcome, I making a todo wishlist with this.
Next thing Im gonna make, and i think it is priority, is SCALING, ROTATING, DELETING selected objects. Rotating and Yawing camera and improving view from all angles.

There will not be need to make same models of different sizes on th HD, you will be able to scale model in editor easily, I added micro ninja just for fun :) I don't think scaled model in irrlicht takes more calculations to be drawn then original size model. I believe engine optimizes that, not doing scaling every frame or something.

I will look into Delete Mesh Cashe for sure - thats a good tip.

Thanks for comments! :)

Posted: Wed Jul 23, 2008 3:34 pm
by christianclavet
Hi, Pera!

About the scaling, take care. I've seen lot of problem reports in the forum about this. You would need to update the mesh buffer also or do some trick to update the geometry. I personnaly had problem with scaled geometry with octrees (collision didnt match the geometry), and seen other having problems with render errors with this. (I think the mesh was scaled down, but still had clipping errors). There could be a solution on the forum. I've not searched for it yet.

I'm studying your code and will try to mimic your coding style. Your much more a programmer than I do, and your code make a lot more sense. You've done a great job in a few amount of time. It took much more time to create my last editor (with the horrible code). I've started from scratch now and took your bases classes to start again. I've been able to add the grids from my other code(was not written by me and was clean) and will need to clean the included parts (viewports functions) so that it match the coding style. I plan to take the part of the code I've written before and match it to your type of coding. Once I've have a basic working thing, I'll post my code, so you could take some parts if you would like to have them.

Posted: Wed Jul 23, 2008 3:59 pm
by full.metal.coder
Just a quick note about camera rotation (I've not tried your editor yet) : I got some code that works very well.

I've developed a camera wrapper for use in The First King (I'm rewriting the code from scratch and integrating Bullet currently). It is extremely simple and gives you a pleasant (Assassin's Creed/Jedi Knight Academy)-like camera. It also have collision but as I've done that with Bullet I suppose you'll want to discard this part (or adapt it to Irrlicht).

PM me if you want the code for that camera, which, I almost forgot, is GPL'ed

Posted: Thu Jul 24, 2008 6:56 am
by pera
Yes I'd use any help and existing code.

I found this editor recently, opensource and fully functional, i wish I had found it earlier and go from there (actually I did, but I completely forgot about it).
Image
http://amine.2ya.com/ go to this site and pick Programming section (no direct link). I couldn't find this project anywhere in irrlicht forum.

Posted: Thu Jul 24, 2008 8:43 am
by dlangdev
wow, thanks for the link. i got the editor now. will study it later when i can.

Posted: Fri Jul 25, 2008 4:15 am
by christianclavet
Hi. I've checked the link and downloaded the editor. It's more than an editor there is an game engine in there with AI for attacking characters (game engine based on IRRlicht) The engine and editors are based on IRRlicht 1.1 and the scene format is custom, but the author gave the source code. So It's really interesting to study it (at least for me), because that's exactly what I want to do with my project (game engine + editor)

Posted: Sat Jul 26, 2008 3:57 am
by stevend
hey seen your post and im just checkin it out. looks pretty sweet :)

gonna download the source and have a look later, it will probably inspire me to work on a few things for map editor in my engine... (draw bounding boxes on selected nodes, why didn't i think of that :roll: )

thanks!

Posted: Mon Jul 28, 2008 6:13 am
by pera
Thanks for all the comments, I have uploaded new version of editor with better navigation, you can rotate and scale models now as well as rotate and yaw and pitch the camera around.

Navigation:
Move selected object by clicking on it and dragging it around (left mouse press and hold).
Rotate selected object by pressing SHIFT + left mouse press and hold.
Scale selected object by pressing SHIFT + mouse scroll.
Rotate map with right mouse press and hold.
Pan map with SHIFT + right mouse press and hold (or WASD keys).
Zoom map with mouse scroll.