Skip to main content
GameDev.net gamedev.net
🔒 Locked

Qt for Making Games?

Started by Noegddgeon Sep 16, 2009 at 5:45 PM 9 replies 10k views
Original Post
Noegddgeon
Noegddgeon
Hello, everybody. I'm pretty new to programming, but I have a general idea about many things that I previously didn't, including the use of external APIs to program games. I know that C++ can make use of SDL and Allegro to create 2D games, but I've also heard about a library called Qt, and I've seen books on it. It's used for GUI programming, but can it also be used in the context of game programming? I would appreciate any information regarding Qt's potential use as a game programming tool. :] Colton
brainydexter
brainydexter
From my limited experience with qt, I would say yes. It really depends on you which way you wanna go. I remember seeing a tutorial which makes tetrix (tetris clone) using only qt feats. I am using qt with openGL, so thats another possibility. I am not sure, but I think QT also supports DX.

IMO, at the core is your logic for the game, QT or SDL or allegro are just wrappers which help you interact with OS and stuff alike.

Hope this helped..
Daniel Punch
Daniel Punch
You probably could use Qt for game development. You can display OpenGL (and DX I think, but it's been a while since I've used Qt) in the windows or just add an image surface to draw on.

There are a few simple games in the tutorials (Tetrix, a cannon game) and I built a very simple Worms-esque game when I was learning it.

I can't really think of any particular reason why you shouldn't use it for game development (possibly speed, but I've never really paid attention to how "fast" it is so I don't know), but it's not what it's designed for.
Noegddgeon
Noegddgeon
So overall, it's an option but not necessarily the best choice, is what I'm gleaning from this information. I appreciate the responses, it helps clarify it a bit for me. Since a lot of software and libraries out there are so flexible, options are very scattered. Overall, though, it would probably be best to stick with a library made specifically for game development then, like Allegro and SDL?
samuraicrow
samuraicrow
If you use QT for the GUI, you'll still need support for other functions. Consider using SFML for the other needs like joystick handling and sound support and so on. Or even use SFML and OpenGL alone.
Noegddgeon
Noegddgeon
SFML looks very interesting, I had never heard of it or seen it before up till just now. Is it as good as or better than SDL or Allegro features-wise?
DeadXorAlive
DeadXorAlive
Qt does have some potential for making games, depending on what you are looking for. See also this blog

A dedicated game library is probably more suited, but since this is about Qt here is my take on what Qt can do for games:

Gt is not just GUI, it is a positively HUGE framework. The downside to this is that it might be more complicated to manage. On the other hand, you have lots of potential extra features at your disposal: multimedia framework (audio, video), database stuff, scripting, networking, XML stack, SVG, plugins, advanced GUI, etc. Some of this stuff might come in handy for a game, some for tools and some you may just find useful for other purposes.

Qt has good support for OpenGL, but it also has a very nice 2D graphics view:
Quote:

Graphics View provides a surface for managing and interacting with a large number of custom-made 2D graphical items, and a view widget for visualizing the items, with support for zooming and rotation.

The framework includes an event propagation architecture that allows precise double-precision interaction capabilities for the items on the scene. Items can handle key events, mouse press, move, release and double click events, and they can also track mouse movement.

Graphics View uses a BSP (Binary Space Partitioning) tree to provide very fast item discovery, and as a result of this, it can visualize large scenes in real-time, even with millions of items.


edit: also that a look at what's coming in Qt 4.6 (animation, multi-touch & gestures and more.)


[Edited by - DeadXorAlive on September 19, 2009 6:58:21 AM]
signal_
signal_
Quote:
Original post by Noegddgeon
SFML looks very interesting, I had never heard of it or seen it before up till just now. Is it as good as or better than SDL or Allegro features-wise?

I would say that SFML is as good or better than SDL, based on its features and the fact that is newer and written in OO C++. SDL, on the other hand, has been around longer and has a decent track record for what it is meant to accomplish.

Lastly, I would recommend against Allegro since SFML and SDL are clearly superior. At the end of the day, if yr goal is 2D game dev, then SDL or SFML are both good choices; they have a lot of the requirements for making games and both can create OpenGL windows.
sirGustav
sirGustav
I would say ignore looking at their feature-sets and instead try to match each library on what it will do for your game, how it fits your style and if it fits your potential target-audience.

Personally I think qt is too huge for a game-framework, I don't like sdl's c-api's and I don't particularly like how hge is structured and that it's windows-only. My target has a video-card that does 3d-acceleration, so sfml and hge can be used. Finally I like sfml's C++ api and it has a active community/user-base so I'll use that.
Noegddgeon
Noegddgeon
Thank you all for your replies. :]

I suppose the answer is that Qt is more suited for a wide variety of applications involving things potentially more complex than a video game. However, I don't suppose it would hurt to experiment with it and see if its features could be useful in certain situations. I'm currently testing out Allegro, but I intend to make use of SDL and SFML as soon as I'm finished up with that. Oh, and I still have to learn C and C++ as well. -_- hahaha

AlabamaCajun
AlabamaCajun
From experiance I would go with SFML and other libraries. A theme park project used QT and very few people can build the project. On the Highrise developer project we used SFML and CEQUI for dialogs. Once we got the works in place we just got down to writing game material. Took no one more than 15 mins after checking out the source to having a built project. The Mac version may have been a few minutes longer to build a new Xproj project.
One what BrainyDextor said, I agree keep the libraries under wraps so you can swap them out later. Same for QT, it you decide to use it, use standard libraries for your core and only expose the UI layer to QT (or any libraries).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.