Skip to content

Game Development

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

    Unsolved
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • 0 Votes
    5 Posts
    210 Views
    SGaistS

    If you only have one controller, a more flexible approach would be to take the first value returned by the QGamepadManager rather than hard coding it like that. It's not guaranteed that you will have the same value each time.

  • Issues with VBO to texture tiles on a grid

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

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

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • 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
    3
    0 Votes
    3 Posts
    1k 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
    358 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!

  • 0 Votes
    2 Posts
    140 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

  • 0 Votes
    27 Posts
    1k 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
    321 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
    1k 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
    335 Views
    8Observer88

    I found the simplest way. I just include the source code of Box2D to my project:

    42bb99dc-714b-445e-a43f-2418e196cb20-image.png

    It allows me to have the same code base for Desktop and Android:

    6bd14b30-9d4e-4da8-a0af-e2b51a0eee98-image.png

    cb391ca2-e7b6-4259-9210-b51f897fbcbf-image.png

    bd97385f-b07a-4bf9-90c7-825055146aed-image.png

  • I need one tutorial for games creation

    Solved
    13
    0 Votes
    13 Posts
    2k 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
    9
    0 Votes
    9 Posts
    499 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);
  • 0 Votes
    8 Posts
    561 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

  • How do I mix QT3D with normal QTGui/QTWidget code?

    Unsolved
    5
    0 Votes
    5 Posts
    293 Views
    SGaistS

    @Ethindp hi,

    It looks like there are some missing bits in the class documentation. However, you can check the source in any case

  • My first 3D Game

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

    Unsolved
    4
    0 Votes
    4 Posts
    255 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.