Important: Please read the Qt Code of Conduct -

Create 2d mobile game with QML

  • Hi everyone,

    I'm a windows phone developer. I want to create rich graphic 2d game with physic simulate (like Angry Birds) target on mobile platforms (include Android, iOS, Windows Phone 8). I want to create it with Qt (because it is cross-platform), but i have not experience with OpenGL, then i choose QML (i read a QML Maemo game tutorial). I have a question: "Is QML enough performance to do that?".

    Sorry, I use english not well!


  • Moderators

    Hi, and welcome to the Qt Dev Net!

    [quote]I have a question: “Is QML enough performance to do that?”.[/quote]
    Google Labs says yes: (they integrated a 3rd-party physics engine into a QML game)

  • I've read through the source code. I think they used LiquidFun (C++) library for physic, then they wrote QML extension to call this library. My question mean i will use Qt Quick in QML to render graphic, move and animation. In this case, Is QML (Qt Quick) enough performance?

  • Moderators

    Qt Quick is designed especially for graphics rendering on mobile devices. It uses hardware acceleration and has built-in animation API, so it should have no problems with rendering a 2D game.

    Overall performance will depend on the complexity of your physics algorithms and your hardware specs. Angry Birds physics in QML/JavaScript should be fine on a modern phone.

    Anyway, I encourage you to download the Qt 5 Everywhere "demo app": and see the graphical effects you can achieve with Qt Quick on your mobile device.

  • Thank a lot. I will write some small games with Qt Quick for experience.

  • Hi,
    I just saw this thread now so I'm a bit late in the discussion, but anyways, here my thoughts about it:

    Short answer to your question: YES, Qt Quick (QML & JavaScript) is sufficient for high performance games. For examples, you can have a look at some V-Play showcase games that run with 60fps across devices & platforms:

    These games are published in the app stores (see the download links "here": ), and also available open-source, so you can have a look at how they are made with QML.

    The only thing where you need to be careful about, is to do the right things with Qt Quick.

    These tasks are better suited for C++ for example:

    • entity movement, either with animations or physics-based
    • any computational complex algorithms like AI
    • in general, things that are happening per-entity per frame

    That's why we did implement most of our "core game engine components": in C++. What is then left for QML, is the UI and the whole game logic. Most game logic is event-driven anyway (e.g. do something when 2 objects collide, or do something every x ms), so this is fast enough to be done with JavaScript.

    In general, I'd recommend starting development with as much in QML as possible - the time & code you save during is well worth it! As JKSH wrote, you get a very good rendering performance thanks to the Qt Scene Graph.. If you then realize performance issues (e.g. with the Qt Quick profiler of Qt Creator), you can move the parts where you have problems to C++ later.


Log in to reply