Sign in to follow this  
Armagedon

Game engine editor design

Recommended Posts

Hey,

 

I'm working on my Game Engine(like everyone here :P) and I decided to build Game/Level Editor in C# with WPF. I was using it on University projects and it was quite easy and nice to use, so i decided to program Editor wiith it.

I had few aproches in programming Level editor in C++/CLI and Windows Forms, but it was literally pain in the ass, to build something bigger, as there was more code.

 

My question is how to integrate Game Engine in C++ with Game/Level Editor in C# ? And how to display Direct3D surface in WPF
I've read about using PInvoke, sending commands via Sockets to Engine etc.

But what is "best" ? And could you provide any tutorials/articles about it ?

 

Any suggestion about developing own Editor would be great :)

Share this post


Link to post
Share on other sites

If I were you I would look into using c++ and Qt.  Since you already know c++, why not use Qt which is a full featured library (somewhat like .net) and cross platform.  It's not just a GUI library.  It's free to use ( even commercially ) if you link dynamically.

Edited by EddieV223

Share this post


Link to post
Share on other sites

You should better build your editor upon your engine. Such as, your editor uses the animation system in your engine to animate the objects in the editor.

That has two benefits:

1, You don't repeat yourself.

2, Using engine in your editor may help you to find defects in your engine.

The easiest way to use your engine in your editor is, write your editor in C++.

Qt is a good choice, and so wxWidgets.

Share this post


Link to post
Share on other sites

I am using qt for my engine editor - it works perfect because it allows you to do your rendering windows in such a way that your engine can do its own thing without ever worrying about the GUI for the editor. Its very quick/easy and lets you focus and take more time on the important things such as how your engine renders meshes rather than trying to figure out how to place an "OK" button

Share this post


Link to post
Share on other sites
I would recommend to avoid mixing languages whenever you can help it, the resulting debugging pain is rarely worth it. Something as mundane as using an UI toolkit from another language would not be a valid reason for me.

If you decide it's right for you, there are a couple of ways that are better than others. P/invoke is only suitable for cases when you have a few function calls into native code, since you're bringing your entire engine, I suspect that's not the case. Instead, I recommend one of these two:

1) A mixed mode DLL with your engine. You create a regular C++ dll, add the code for your engine, and then create wrapper classes in managed C++. The wrapper classes need to be compiled with the /clr compiler flag. You can then import this DLL into your C# project like you would any assembly, and your wrapper classes will become visible for you to use.

2) Use COM. Create a DLL that has your entire engine included, and create a COM interface that exposes the relevant parts. This is almost like option 1, with the added benefit that you now have your engine available for almost any language.

Both of these methods are a pain in the ass, though. Should be used only when there is no other sane option, or if you need to expose the engine for many other applications. If all you need to do is to create a GUI for your editor, just use a GUI toolkit for C++, it will help preserve your sanity.

Share this post


Link to post
Share on other sites

Yeah, i'll try then creating Editor with QT ;)

 

And just to ask, what about communicating between engine and editor via Sockets ? Parse commands to json in editor and send it to engine ?

I've read somewhere about it but can't remember where :/

Share this post


Link to post
Share on other sites

And just to ask, what about communicating between engine and editor via Sockets ? Parse commands to json in editor and send it to engine ?

I've read somewhere about it but can't remember where :/

To be honest, that sounds multiple times more complex than even any of the two methods I mentiond above. Might make sense for some kind of web-service like thingy, but for a game engine, not so much.

Share this post


Link to post
Share on other sites

Yeah, i'll try then creating Editor with QT ;)

 

And just to ask, what about communicating between engine and editor via Sockets ? Parse commands to json in editor and send it to engine ?

I've read somewhere about it but can't remember where :/

Probably the Bitsquid engine:

http://bitsquid.blogspot.nl

http://www.bitsquid.se/presentations/benefits-of-a-data-driven-renderer.pdf - page 17

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