Skip to content

Game Development

What can we say - we like games. And you can use Qt to write some. Questions? Ask here.
875 Topics 4.1k Posts
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • Dynamic Textures in Qt3D with C++

    Solved qt3d opengl qt5.15.0 graphics
    3
    0 Votes
    3 Posts
    2k Views
    D
    @Jakob-Weiss Is there any QT 3d Volume Rendering exmple in Qt? We are also trying to get Texture3d work in shader. Up to now, thanks to your tip, we made Texture2d work. We did the same in Texture3d, but it just didn't work and always shows black. Thanks if there is any tip. QML is like: parameters: [ Parameter { id: mainTex name: "mainTex" value: m_mainTexture }, Parameter { id: myTex3D name: "myTex3D" value: m_mainTex3D } ] frag Shader is like: layout(std140, binding = auto) uniform custom_uniforms { vec3 maincolor; }; layout(binding = auto) uniform sampler2D mainTex; layout(binding = auto) uniform sampler3D myTex3D; layout(location = 0) in vec3 worldPosition; layout(location = 1) in vec2 v_texcoord; layout(location = 0) out vec4 fragColor; void main() { //vec4 txtColor = texture(mainTex, v_texcoord); vec4 txtColor = texture(myTex3D, vec3(v_texcoord.x,v_texcoord.y,0.5)); float value_3D = txtColor.r * 100; fragColor = vec4(value_3D,value_3D,value_3D,1.0); } C++ is like: m_texture3D = new Qt3DRender::QTexture3D(); m_texture3D->setSize(128,128,128); m_texture3D->setFormat(Qt3DRender::QTexture3D::R8_UNorm); m_texture3D->setLayers(1); m_texture3D->setGenerateMipMaps(false); Qt3DRender::QTextureWrapMode wm(Qt3DRender::QTextureWrapMode::ClampToBorder); m_texture3D->setWrapMode(wm); //m_texture3D->setMinificationFilter(Qt3DRender::QTexture3D::Linear); //m_texture3D->setMagnificationFilter(Qt3DRender::QTexture3D::Linear); rawPixelData3D.resize(128 * 128 * 128 * sizeof(uchar)); uchar *pixels3D = reinterpret_cast<uchar *>(rawPixelData3D.data()); std::memset(pixels3D, 60, 128 * 128 * 128 * sizeof(uchar)); Qt3DRender::QTextureImageDataPtr imageData3D = Qt3DRender::QTextureImageDataPtr::create(); imageData3D->setFormat(QOpenGLTexture::TextureFormat::R8_UNorm); imageData3D->setWidth(128); imageData3D->setHeight(128); imageData3D->setDepth(128); imageData3D->setMipLevels(1); imageData3D->setLayers(1); imageData3D->setPixelFormat(QOpenGLTexture::PixelFormat::Red); imageData3D->setPixelType(QOpenGLTexture::PixelType::UInt8); imageData3D->setData(rawPixelData3D, 1, false); Qt3DRender::QTextureDataUpdate update3D; update3D.setX(0); update3D.setY(0); update3D.setData(imageData3D); m_texture3D->updateData(update3D);
  • Q: Qt - [c++] PropertyAnimation from WorkerThread

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    K
    Thank you. This way the application is clearly more stable. This works also fine, when i wait for all the animations: QEventLoop loopPos; connect(myAnimation, &QParallelAnimationGroup::finished, &loopPos, &QEventLoop::quit ); loopPos.exec(); ... and if needed use a QParallelAnimationGroup best regards!
  • Transform data received on shader looks different than data sent

    Solved
    2
    0 Votes
    2 Posts
    455 Views
    T
    I figured it out, my int offset = i * sizeof(float); should have been int offset = i * sizeof(float) * 4; This makes sense since the offset should be every 4 floats
  • How to build OpenAL-Soft and set up it in Qt Creator for Android

    Solved
    27
    0 Votes
    27 Posts
    7k Views
    8Observer88
    I found the simples way! I just download these sources: https://github.com/AerialX/openal-soft-android and built it using CMake. The libopenal.so library was created. I created the "Play" button. I built my first app that plays music using OpenAL! It works on my smartphone! It's cool! My step-by-step guide for Qt 6.2.4 MinGW 64-bit: Download these sources: https://github.com/AerialX/openal-soft-android Download CMake (add it to the Path variable): https://cmake.org/download/ Go to openal-soft-android from the console (cd openal-soft-android) Copy the next commands to the console (don't forget to change the path to your android.toolchain.cmake) cmake -G "MinGW Makefiles" -S . -B ./build -DCMAKE_TOOLCHAIN_FILE=E:\AppData\Android\SDK\ndk\22.1.7171670\build\cmake\android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=29 cmake --build ./build -j 4 The libopenal.so will be created. Create a new Qt project. Create the jniLibs/armeabi-v7a folder inside of your Qt project. And copy libopenal.so inside of jniLibs/armeabi-v7a. Create the libs\openal-soft\include folder inside of your Qt project and copy the AL folder there. Add these settings to your pro-file: INCLUDEPATH += $$PWD/libs/openal-soft/include contains(ANDROID_TARGET_ARCH, armeabi-v7a) { ANDROID_EXTRA_LIBS += $$PWD/jniLibs/armeabi-v7a/libopenal.so } Added 2/25/2024 I use these settings to run on Windows, real device, and Android Emulator: CONFIG("windows") { INCLUDEPATH += $$PWD/libs/openal-soft-desktop-1.23.1/include LIBS += -L$$PWD/libs/openal-soft-desktop-1.23.1/lib/x64 LIBS += -lOpenAL32.dll } CONFIG("armeabi-v7a") { INCLUDEPATH += $$PWD/libs/openal-soft-android/include contains(ANDROID_TARGET_ARCH, armeabi-v7a) { ANDROID_EXTRA_LIBS += $$PWD/jniLibs/armeabi-v7a/libopenal.so } } CONFIG("x86") { INCLUDEPATH += $$PWD/libs/openal-soft-android/include contains(ANDROID_TARGET_ARCH, x86) { ANDROID_EXTRA_LIBS += $$PWD/jniLibs/x86/libopenal.so } }
  • How to set up the Bass Audio Library for Qt 6 MinGW

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    8Observer88
    @SGaist said in How to set up the Bass Audio Library for Qt 6 MinGW: $$PWD Yes, it works! Thanks! INCLUDEPATH += ".\libs\bass24-windows\include" LIBS += -L$$PWD\libs\bass24-windows\x64 LIBS += -lbass
  • How to play sounds using QMediaPlayer

    Solved
    16
    0 Votes
    16 Posts
    4k Views
    8Observer88
    I solved the problem! I found the solution here: https://zhuanlan.zhihu.com/p/521028351 self.audioOutput = QAudioOutput() self.mediaPlayer.setAudioOutput(self.audioOutput)
  • How to set up Box2D for Android

    Solved
    5
    1 Votes
    5 Posts
    1k Views
    8Observer88
    I found the simplest way. I just include the source code of Box2D to my project: [image: f21c171b-9a29-4f7c-a1b6-488f0df99675.png] It allows me to have the same code base for Desktop and Android: [image: 18a3c6d3-2528-4975-b1fa-051715f0153d.png] [image: 4a7406e6-7be4-4429-a9fd-309b7babfb5d.png] [image: 52802f30-d6a7-4478-bca6-dccfe6e86c58.png]
  • I need one tutorial for games creation

    Solved
    13
    0 Votes
    13 Posts
    5k Views
    S
    Lucky Joker is an exciting game that offers an extravagant gaming experience in the style of a classic fruit slot. This game is popular among gambling fans due to its simplicity and addictive gameplay. In Lucky Joker you will meet a funny joker joker who will be your guide to the world of cool reels and hidden winnings. The game has a classic layout with five reels and traditional symbols such as sevens, cherries, oranges and lemons. The main goal of the game is to make combinations of the same symbols on active paylines. If you land such a combination, you will receive a win, and the wild symbol can help you increase winning combinations or open bonus rounds. Lucky Joker has nice graphics, sound effects and bright animations that create an exciting atmosphere of the game. You can try your luck in free mode or play real bets hoping for big wins. Let the lucky joker protect you in this exciting game and give you incredible winnings. Join Lucky Joker and enjoy the unforgettable excitement and fun it offers!
  • Recommend Qt Courses to Game development?

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    8Observer88
    This example shows how to include Phaser and Box2D with importmap. Phaser is an analogue of SFML. Sandboxes: PlayCode: https://playcode.io/1500918 Plunker: https://plnkr.co/edit/hBDyrOGRtJjJefuC index.html <!doctype html> <html> <head> <title>Example</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <canvas id="renderCanvas"></canvas> <!-- Since importmap is not yet supported by all browsers, it is necessary to add the polyfill es-module-shims.min.js --> <script async src="https://unpkg.com/es-module-shims@0.1.7/dist/es-module-shims.min.js"></script> <script type="importmap"> { "imports": { "@box2d/core": "https://cdn.jsdelivr.net/npm/@box2d/core@0.10.0/+esm", "phaser": "https://cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.esm.js" } } </script> <script type="module" src="./js/main.js"></script> </body> </html> js/main.js import { b2World } from "@box2d/core"; import { AUTO, Scene, Game } from "phaser"; // Box2D const world = b2World.Create({ x: 0, y: 3 }); console.log(world.GetGravity()); // Phaser console.log(Game);
  • Can You Recommend Me Official Qt Courses for Game Developers?

    Unsolved
    8
    0 Votes
    8 Posts
    2k Views
    S
    I am also interested in playing and designing video games. But I am newbie in this field. can i learn it from scratch
  • My first 3D Game

    Unsolved
    1
    2 Votes
    1 Posts
    445 Views
    No one has replied
  • Qt3D - [c++] Q: When Does Qt3D for C++ Support Real Shadows

    Unsolved
    4
    0 Votes
    4 Posts
    711 Views
    SGaistS
    It's not a forum, it's a mailing list. If you want answer to the question you are asking, it's the correct venue. This is a user forum. It's not particularly monitored by the Qt Company.
  • "No query executed" is the QT Error Code -1.

    Unsolved
    3
    0 Votes
    3 Posts
    582 Views
    JonBJ
    @Sachin-Bhatt QSqlQuery::prepare() returns a result. Check it, especially while developing and you don't know what is going on. Change your query first to SELECT * FROM mytable WHERE id = 1 and then to SELECT * FROM mytable. If the latter does not work maybe you don't have mytable.
  • How to replace `connect(this, SIGNAL(frameSwapped())...` with modern version

    Unsolved
    26
    0 Votes
    26 Posts
    6k Views
    jeremy_kJ
    @JonB said in How to replace `connect(this, SIGNAL(frameSwapped())...` with modern version: @jeremy_k said in How to replace `connect(this, SIGNAL(frameSwapped())...` with modern version: Detection of a nonexistant signal or slot doesn't happen until the initial runtime parse, and detection of incompatible arguments in the slot is delayed until slot invocation. Which is how Python works compared against C++, regardless of Qt. I agree. This is more like the string based connect. My comment about Python signal connections was just intended as an observation, about how it works at coding time using function (or whatever) calls rather than strings. User gets a language check that signal and slot functions exists (at runtime in Python, and hopefully something at editing time too). That's an IDE feature. My browser tells me when things that I type in a text input aren't in its dictionary. The words are still more like free strings than function pointers.
  • [Tutorial] How to set up Urho3D (Shared, MinGW) in Qt Creator IDE

    3
    1 Votes
    3 Posts
    953 Views
    8Observer88
    The development of Urho3D has been discontinued. The official repository was archived by the owner on 01/25/2023. The official forum has been removed and moved to archive. In readme on the official repository it is written that two active forks were formed from Urho3D: Dviglo and Turso3D: Active work on the engine without maintaining backward compatibility is being done in the fork Dviglo. The founder of Urho3D (Lasse Öörni) is currently working on Turso3D.
  • Qt + Ogre3D. I cannot build a very simple example

    Unsolved
    20
    1 Votes
    20 Posts
    3k Views
    8Observer88
    @cpr0gr4mm3r Maybe my next topic will help you: Problems with Ogre in Qt Creator
  • [Qt3D] Custom shader not working anymore in Qt6.3+

    Unsolved
    3
    0 Votes
    3 Posts
    854 Views
    A
    @JoeCFD Thank you for having tested the sample on Linux! The Qt examples of custom shaders work fine on both Qt6.2 and Qt6.3. However, I notice that the rendering of the "advanced custom shader" is different with Qt6.3 although they haven't logged changes in Qt3D for this version of Qt (only the Qt Quick 3D module has changed but it is unlinked to Qt3D). https://doc.qt.io/qt-6/whatsnew63.html I will continue to investigate on my side before submitting the bug to the Qt team if I cannot find any reason to it. No change in Qt3D should not break Qt3D apps.
  • Getting Started with 2D manipulations

    Unsolved
    3
    0 Votes
    3 Posts
    526 Views
    P
    @SGaist Perfect, thanks, I will take a look!