Qt For Game Development/Game Engine



  • I've been researching the ideal parts for a game engine which I'm building. At first I tried just going raw and writing everything from scratch using just the bare amount of native libraries such as Win32, X11, OpenGL, Glew, GLX, etc.

    And then I realized this would take forever just for a game engine.

    So, I'm looking into writing a game engine using OpenGL + SDL + Qt. The reason why I want to use SDL with all of this is because of its context creation and OpenGL initialization support. I like Qt's implementation (for the most part), but, honestly I prefer SDL. My main idea is to use Qt for strictly GUI development (such as in-game menus, debug consoles, HUD rendering, etc).

    What I'd like to know if this is a good approach, and if not, are their any better approaches out there? If this is a good approach, what would be the best way to implement, not the engine per se, but the integration of the two. I read a similar question on SO dealing with someone who was writing a physics simulator and, essentially, was trying to accomplish the same thing, however he was using threading, which I'm not sure if I'll be using or not quite frankly.

    Still, as far as I know, it seems like there are significant differences between a game engine and a physics simulator, and I'd like to know exactly what I'm getting myself into.

    Some Thoughts

    I like the bare OpenGL implementation as opposed to Qt's, mainly because I feel like I have more control.

    I prefer to have more control over the main loop, hence why I'm using something like SDL and not Qt's implementations - the issue is I'm not sure if this actually is recommended considering how different the two are.

    All in all, I'm sure some people would tell me to just use QWidget and let it be at that. The thing is that I'm relatively new to graphics programming in general, and feel as though learning the original API through raw opengl would be the best approach. If I'm wrong, however, then I definitely would like to know.

    I know this question is rather broad and less specific, but I really need advice regarding this, and hope that this may somehow help another developer who's looking to do something similar.

    It seems like this is definitely a hard topic to cover in terms of objectivity, so I'll state the criteria in terms of flexibility and raw opengl + GUI support, as that's really what I need.



  • The question here is ¿Do you want to create the engine or just the game? Creating a game engine from scratch is a really hard work and there is already many and very complete graphics engines with also a very permissive licences, that works very well on Windows, Mac and Linux, supporting OpenGL and DirectX, with joystick, mouse and keyboard support, and very, very optimized:

    http://devmaster.net/devdb/engines

    Also integrating it with Qt is very easy:

    http://qt-project.org/wiki/Using_3D_engines_with_Qt

    Ok, Im a illusion breaker, but, hey! creating a new game engine just for add a GUI system, makes no sense.



  • [quote author="hipersayan_x" date="1331418465"]creating a new game engine just for add a GUI system, makes no sense.[/quote]

    The game provides the gui, the engine provides the support and base for a gui.

    There's a sense of accomplishment when building your own engine. Just knowing exactly on the lowest level how everything works is worth the effort, even if you sideline it with game production in a mainstream style engine. Both, I think... work hand in hand to better each other.

    This quote is from another thread I browsed by.

    [quote author="ZapB" date="1361178528"]Why not just use QWindow and QOpenGLContext? That takes away the pain of context and window creation. Then you can do as you please for the rest of your GL work either use Qt's enabler classes or do it yourself. This is Qt5 though.[/quote]

    The goal is not to recreate the wheel where we don't have to. I have been contemplating the idea of working on a new engine using some of the Qt functionality myself. Things such as UI, context, anything visual really can all be streamlined by the awesome known as Qt while everything that is associated with the engine as far as the mechanics... can still be done per usual as if Qt wasn't being used. Just call up Qt for anything you prefer NOT to do....OR if it so happens that you would like to do something, but just need a place holder...calling up a Qt class in the mean time... well, lets just say it sounds appealing.

    I think the integration of Qt can be pretty flawless, just the amount of work that gets lifted from ui elements is enough to want to. I have yet to get "down and dirty" planning / drafting my project on it, so as far as the right implementation, the above is really all I have to go on thus far.

    Sorry for the ramble / wall of text. My opinion on the matter is by no means solid as I am still in the research stage like yourself. Curious as to the opinions / ideas of others on the matter myself actually.



  • Well, I'm attempting to get down and do it myself. I've been coding for a long time, but not in C++.

    It's been a couple of months and I'm getting the hang of it myself. I've designed something pretty elaborate back in my days with VB, so there's the design plan I'm trying to follow. The game was powered by VB Native controls, and DirectX with Windows Sockets. All of it worked great, but was slower on newer machines. After .NET, I kept up with VB rather than switching cause I had already written out so much code, conversion was a pain, and I didn't wanna rewrite it in honestly, the same language with some flair. But I've grown tired of maintaining it and so, I'm trying to pick up C++ and the libraries associated with it.

    Anyhow, that was a bit of a ramble about the design implementations I'm trying to follow.

    I've tried to start imitating that engine I had before, but with better design practice + the power of C++/Qt. In all honestly, I think it's doable. I am still learning, but with what I've witness here, it could be executed well.

    I'm surprised that an open source effort for a game engine isn't around. Or maybe, I haven't done enough snooping.

    In any case, when I get far enough along, I might be able to chime in with a more convincing answer!



  • I'm working on a pure Qt "2D game engine SDXM":http://sdxm.eastfist.com. I have some demos on YouTube:

    3000 sprites + other features:
    http://youtu.be/AHdhg3Nw88w

    Real 3D Transformations, no OpenGL, no DirectX, pure Qt
    http://youtu.be/KuTBzhBqU4Y

    If we're talking basic of basic 2D games like SNES, I'm confident it can be done. And that's what I'm aiming for.



  • Hi,
    as hipersayan_x pointed out, it really depends if you want to create a game, or want to create an engine from scratch.

    If you want to create an engine, be aware this is a major effort - I would go with as many frameworks that simplify this as possible, like Ogre as rendering engine if you are creating a 3D engine. You can then put Ogre into a Qt window - I did that in my CS Master program as a project and it worked fine.

    I have written 3 game engines in the past and learned a lot along the way. So for learning and understanding how engines work creating your own is a good idea. However, do not underestimate the effort it requires. And if you want it to be used by other developers, community and documentation are highly important and also take time to build and improve!

    The latest engine I started to work on about 2 years ago, made it to a commercial product called "V-Play":http://v-play.net. It uses Qt and QML as its scripting interface and is specialized for 2d games - you can have a look at the sources after downloading the free SDK.

    Good luck with your engine endeavaors and keep us updated about your progress! It's great to see more Qt-powered game engines.

    Cheers, Chris


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.