Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Newbie needs much help in game development with Qt.
Apprentice23 last edited by
I need guidance. I have been searching the forum, but being new to C++ and Qt is making it difficult for me. I am working with a group to develop a simple RPG game. I have to design the UI and link it to my code, which I have not been able to figure out. Hopefully I will be able to explain what I am trying to do, and be able to receive ideas on where to start to reach my objective.
We are trying to build a Pirate game where the pirate fights off other bad pirates while collecting gold. The pirate will have different weapons to choose and certain amount of health. This pirate can be in map mode, traveling from one place to another, and in battle mode. Each mode would trigger a different pause menu. In the map world, the pause menu will allow the player to replenish health, and see the current inventory of weapons. Also, there will be an Exit, Resume button. Additionally, there will be a progress bar and numerical text that will display the player's health.
In battle mode, another UI will appear that will allow the player to interchange weapons currently on inventory, and use any health available that the player collected on missions, I suppose. Once the player makes a selection, the the game will resume on with either a pressed key or by the press of a button.
I have created two different UI's with the 'Create a new UI form' that Qt offers. I need help on how to link the UI's to certain classes when the player presses a key. Also, how do I connect my widgets to my classes? For example, as soon as the player pauses the game, my pause menu will show the current health of the player. I can't figure out how to do this.
I hope I made sense, and would appreciate very much your help on getting me started in right direction.
Yes, that made sense. :) But first, please tell us:
What other programming languages have you used before?
Do you have previous experience with game programming?
Secondly, widgets are static components, which are suitable for office applications. However, for fluid components with animations, you'll want to use Qt Quick (http://qt-project.org/doc/qt-5.1/qtdoc/qtquick-applicationdevelopers.html )
Apprentice23 last edited by
I have used Java for about two years, but nothing extensive. I am a newbie to programming too. At this moment, I am learning Python, C++, and C.
I don't have a strong grasp of super classes and inheritance which seem to be prevalent with Qt. I am confused about what the parent pointer does in Qt applications, part of my problem, I guess.
I do not have any experience with game programming which is adding another layer of confusion. I hope I can make sense of it all.
Right now I am going over a sample tutorial on building a notepad application hoping it will clear some confusion.
Thank for the the link, I will look into it and hopefully make use of it.
I appreciate your help.
[quote author="Apprentice23" date="1385253173"]I have used Java for about two years, but nothing extensive. I am a newbie to programming too. At this moment, I am learning Python, C++, and C.
I don't have a strong grasp of super classes and inheritance which seem to be prevalent with Qt.[/quote]Super classes and inheritances are core concepts in Object-Oriented Programming (OOP). It's not unique to Qt; It is also prevalent in Java, and it is present in Python. I recommend reading a beginner's guide to OOP.
If you are learning C++, I don't see any benefits in learning C at the same time. You can think of C++ as a superset of C (well, strictly speaking, there are a few small incompatibilities, but that's insignificant for most purposes).
[quote author="Apprentice23" date="1385253173"]I am confused about what the parent pointer does in Qt applications[/quote]The parent pointer in Qt is for specifying ownership of QObjects. A parent object is said to "own" the child object. A parent is responsible for the memory management of its children. Ownership can be transferred, but each object can only have 1 parent at a time.
[quote]I do not have any experience with game programming which is adding another layer of confusion. I hope I can make sense of it all.[/quote]The game you've described is far too complex for a beginner. A small team of experienced developers would need several weeks to produce it.
I encourage you to complete a few small projects first. Once you're familiar with the basics, you can put it all together to create a large project.
[quote]Right now I am going over a sample tutorial on building a notepad application hoping it will clear some confusion.[/quote]The notepad tutorial will teach you how to use the IDE, as well as an important concept which is central to Qt: "Signals and Slots":http://qt-project.org/doc/qt-5.1/qtcore/signalsandslots.html
It's definitely worth following that tutorial. However, GUI-wise, it uses widgets. As I said earlier, widgets are not suitable for games. When you've finished the notepad tutorial, see:
- "Basic Qt Quick tutorial":http://qt-project.org/doc/qt-5.1/qtquick/qml-tutorial.html
- "Advanced Qt Quick tutorial":http://doc-snapshot.qt-project.org/qt5-stable/qml-advtutorial.html (a simple game)
[quote]Thank for the the link, I will look into it and hopefully make use of it.
I appreciate your help. [/quote]You're welcome. :) All the best with learning; feel free to start new posts to ask for help on specific issues you come across!
nunu last edited by
I was in a similar position some time back. This tutorial helped me a lot to get a good grasp of C++.... www.cplusplus.com/files/tutorial.pdf.
I would suggest going through it first before taking on Qt.
feldifux last edited by
we also have some beginner's tutorials on the V-Play website:
- How to create a "physics game":http://v-play.net/doc/vplay-entity-concept.html
- How to create a "balloon popping game":http://v-play.net/doc/howto-balloon-game.html
- How to create "Pong":http://v-play.net/doc/howto-pong-game.html