Game engine editor design

Started by
9 comments, last by assainator 10 years, 8 months ago

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 :)

Advertisement

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.

If this post or signature was helpful and/or constructive please give rep.

// C++ Video tutorials

http://www.youtube.com/watch?v=Wo60USYV9Ik

// Easy to learn 2D Game Library c++

SFML2.2 Download http://www.sfml-dev.org/download.php

SFML2.2 Tutorials http://www.sfml-dev.org/tutorials/2.2/

// Excellent 2d physics library Box2D

http://box2d.org/about/

// SFML 2 book

http://www.amazon.com/gp/product/1849696845/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=1849696845&linkCode=as2&tag=gamer2creator-20

Yeah i tried it before, but for me it was worse for developing Desktop App than C#. But propodably i'll give it one more shot. Thanks.

Worse? How so, what problems did you encounter?

If this post or signature was helpful and/or constructive please give rep.

// C++ Video tutorials

http://www.youtube.com/watch?v=Wo60USYV9Ik

// Easy to learn 2D Game Library c++

SFML2.2 Download http://www.sfml-dev.org/download.php

SFML2.2 Tutorials http://www.sfml-dev.org/tutorials/2.2/

// Excellent 2d physics library Box2D

http://box2d.org/about/

// SFML 2 book

http://www.amazon.com/gp/product/1849696845/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=1849696845&linkCode=as2&tag=gamer2creator-20

Maybe not worse, but i find C# and .Net more easy to use and i know them better than QT :)

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.

https://www.kbasm.com -- My personal website

https://github.com/wqking/eventpp  eventpp -- C++ library for event dispatcher and callback list

https://github.com/cpgf/cpgf  cpgf library -- free C++ open source library for reflection, serialization, script binding, callbacks, and meta data for OpenGL Box2D, SFML and Irrlicht.

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

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.

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 :/

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.

This topic is closed to new replies.

Advertisement