Skip to content

Game Development

What can we say - we like games. And you can use Qt to write some. Questions? Ask here.
862 Topics 4.0k Posts
  • GlDrawElements... did I miss something?

    4
    0 Votes
    4 Posts
    1k Views
    SGaistS

    Could you post a code sample that reproduce the problem ?

    In between, you might better update Qt to the latest version (5.1.1 at this time)

  • 0 Votes
    4 Posts
    2k Views
    S

    That's because paintGL() is a virtual function of QGLWidget, which is called by itself in certain situations (I guess).

    QWindow doesn't have that virtual function, so it's up to you to call paintGL(). Maybe you should do inside showEvent().

  • 1 Votes
    12 Posts
    11k Views
    GianlucaG

    Hello,
    I read this discussion, and I like the hybrid approach to load the .svg and convert them to pixmap and then render it.
    Because, it is seems a very good approach for get a perfect balance between the resolution independence of .svg with the speed of drawing of a pixmap...
    I'm wondering if the QML Image item use this approach when you set a .svg image as source ...
    anyone know the performances of QML Image item on .svg images ??

  • Problem with ShaderProgram

    3
    0 Votes
    3 Posts
    6k Views
    M

    I did some more research and changed the shaders

    Fragment Shader
    @
    uniform vec4 color;

    void main(void)
    {
    gl_FragColor = color;
    }
    @

    Vertex Shader
    @
    uniform mat4 mvpMatrix;

    attribute vec4 vertex;

    void main()
    {
    gl_Position = mvpMatrix * vertex;
    }
    @

    It works now.

  • Galaga remake in qml

    7
    0 Votes
    7 Posts
    2k Views
    B

    Thanks, texrat.

  • Qt For Game Development/Game Engine

    6
    0 Votes
    6 Posts
    25k Views
    F

    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

  • 0 Votes
    3 Posts
    3k Views
    F

    Hi,
    if you like QML & JavaScript and are into 2D games, "V-Play":http://v-play.net/ might be interesting to you. It's a rapid development tool for cross-platform games built on top of Qt and Cocos2d-x.

    Cheers, Chris

  • Opengl multipass render

    2
    0 Votes
    2 Posts
    2k Views
    S

    Assuming you are using Qt5.0, you could use:
    http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html
    http://qt-project.org/doc/qt-5.0/qtgui/qopenglshaderprogram.html
    http://qt-project.org/doc/qt-5.0/qtgui/qopenglframebufferobject.html

  • QGraphicsView question

    2
    0 Votes
    2 Posts
    1k Views
    D

    I managed to find the solution. Sorry I'm still pretty new to programming and don't fully know how inheritance works. The QGraphicsView is a grandchild (?) of the QWidget. So i was looking at the wrong methods in the QGraphicsView reference. If i call the QWidget's resize method for the view it resizes the view like i want.

  • 0 Votes
    7 Posts
    5k Views
    L

    Ok, in fact, I need to read some books about it.

  • 0 Votes
    2 Posts
    1k Views
    A

    The sources are right there for you to inspect...

  • Get heightmap xyz by mouse

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Dice Game - A QML App

    9
    0 Votes
    9 Posts
    4k Views
    V

    Hi.. @anupama,,
    I cant watch that youtube video so can you send some screenshot and your game concept i will try it out myself..
    i know only very basic concept of qml ...

  • 0 Votes
    6 Posts
    8k Views
    Q

    I have been looking far and wide to find out how, if it's possible, you can fill a particular area in a QML screen with an OpenGL context and do custom OpenGL only in that context. I've seen plenty of demos where the QML components like buttons, etc lay on top or below a screen-wide OpenGL context (as is typically required by games), but I'd like to be able to situate several distinct OpenGL contexts within QML and have the QML file define how large they are, where they are positioned, etc.

    Now, since Qt 5 is all OpenGL under the hood, it makes me wonder if using a Canvas element with custom drawing via javascript would technically result in the same performance as custom OpenGL? This would be a meaningful alternative but it's not clear to me how the javascript drawing is handled via runtime compared to custom OpenGL drawing.

  • Game on Qt/QML - Video

    8
    0 Votes
    8 Posts
    5k Views
    S

    I downloaded the game and the graphic was stunning. It’s definitely a time eater. I am sure it will take several days for developing the code of this particular game. Anyways thank you for sharing the video and hope you will continue this effort in the future also! http://www.windows8installation.com

  • QT5 OpenGL include[SOLVED]

    13
    0 Votes
    13 Posts
    26k Views
    Z

    Which compiler are you trying to build with? If it's MSVC then you need to make sure that the environment is setup correctly by executing the MSVC Command Prompt rather than cmd.exe directly. This executes a batch script that correctly sets up the path to your compiler etc.

    Can you paste the exact configure line and output that you get please?

  • 0 Votes
    3 Posts
    2k Views
    F

    Hi,
    in V-Play we have made good experience with the component-based architecture and an entity system that we designed. What this means, is that you have components for displaying an entity (defined in the set of "visual components":http://v-play.net/doc/vplay-group.html#visual-components), some for collision detection, sounds, and then there are some for logic like AI behaviors or others.

    Here is an example how one of a game entity in the open-source game "StackTheBox":http://v-play.net/doc/demos-stackthebox.html looks like, taken from Wall.qml:
    @
    import QtQuick 1.1
    import VPlay 1.0
    import Box2D 1.0 // for accessing the Body.Static type

    EntityBase {
    entityType: "wall"

    // this gets used by the top wall to detect when the game is over
    signal collidedWithBox

    // this allows setting the color property or the Rectangle from outside, to use another color for the top wall
    property alias color: rectangle.color

    Rectangle {
    id: rectangle
    color: "blue"
    anchors.fill: parent
    }
    BoxCollider {
    anchors.fill: parent
    // use "import Box2D 1.0" to access the Body.Static type
    bodyType: Body.Static // the body shouldnt move

    fixture.onBeginContact: collidedWithBox()

    }
    }@

    It does not really matter if you write the base components in QML or C++, although I would start with QML & JavaScript and only write the stuff that requires high performance in C++ because you are much faster to develop and iterate quicker.

    You can also have a look at our other open-source games, maybe you find some concepts that you can use in your game: http://v-play.net/doc/vplay-examples.html

    Cheers, Chris

  • Qt server-client game, clients communicate?

    12
    0 Votes
    12 Posts
    7k Views
    B

    Use KDSoap from KDAB, not only is simpler and have full digia support. The one u mention is QSoap who have only client side and is very basic. If you download KDSoap you have inside a lot of examples that will fit your needs.

  • 0 Votes
    1 Posts
    851 Views
    No one has replied
  • Qt for mobile

    6
    0 Votes
    6 Posts
    3k Views
    F

    Hi,
    it really depends on what kind of applications you want to create and what features you want to use. If Qt supports the features your app/game needs, I would definetely go for it, as you save time and effort in the long run as you do not need to re-write all your Java code in Obj-C (gets even more a hassle if you do not know the language). If you are familiar with Qt already, I would give it a try.

    Especially games are different in its requirements, because you usually do not need native-looking UIs as you have custom ones to match the style of your game. This is exactly the reason why we at "V-Play":http://v-play.net focused on games, as QML is a great way to design flexible UIs and also saves a lot of time when it comes to game logic.

    Cool thing is, you still have the flexibility to go native for parts that you require in Java or Obj-C, as some frameworks are only available in these languages for Android or iOS. For the most common ones for games like "Game Center":http://v-play.net/doc/plugins1-gamecenter.html, "Flurry":http://v-play.net/doc/plugins1-flurry.html or "native Facebook SDK":http://v-play.net/doc/plugins1-facebook.html we already did the heavy lifting so you can access them with QML and JavaScript.

    Regarding the discussion of Qt overhead of 8MB: what we can see in our "published games":http://v-play.net/doc/vplay-examples.html is that download size does not matter that much, as long as it stays below 50MB. However, it also depends on the target group of your game: in areas with low network bandwidth download size might be more of an issue, but most people have WiFi connection available at least once a day anyway.