Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Multithreading in qt
Forum Updated to NodeBB v4.3 + New Features

Multithreading in qt

Scheduled Pinned Locked Moved Game Development
9 Posts 4 Posters 4.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    theCrazyCrap
    wrote on last edited by
    #1

    Hi, I am creating a side scrolling game for symbian device and part of my game is to have an enemy for my character to attack to.

    Do I have to use multithreading in creating the enemy? Thanks for your replies!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      That's a pretty vague question. I'd guess you probably don't need to.

      What would be your reasoning for considering multithreading?

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        theCrazyCrap
        wrote on last edited by
        #3

        I am going to create an enemy in my game and I would to know if multithreading is an option since the enemy needs to attack or defend, right? I am correct?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          From the limitied amount of information you provided there is a clear no from me.

          Keep in mind that any GUI related operation has to be done in the main thread anyways. So if your enemy isn't doing any resource-intensive stuff which would block the main thread for an unreasonable amount of time the overhead will outweigh the benefits.

          [quote author="theCrazyCrap" date="1328675533"]I am going to create an enemy in my game and I would to know if multithreading is an option since the enemy needs to attack or defend, right? I am correct?
          [/quote]

          To be honest I'm not quite sure what this should have to do with multithreading.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            theCrazyCrap
            wrote on last edited by
            #5

            I am thinking of using the multithread because the enemy in the game is moving. Just like in any side scrolling game. the enemy would attack the player once the player is in the area. correct?

            In making this event, do i need to do this on the main thread?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              No, you really do not need multithreading for this. It will only get you into more problems than you already have. Judging from the way you pose your questions, you are a beginner at programming. There is nothing wrong with that - we all started that way - but it is wise to start at the basics. Multi threading definately is not the 'basics' kind of technology.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                theCrazyCrap
                wrote on last edited by
                #7

                I am just new in QT.. I don't know where to start in developing our game. Do you have any suggestions in creating a side scrolling game? If we don't need multithreadin, how are we going to create the enemy while the character is moving.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  The key is to use event-based programming. That means that instead of having the program fully dedicate itself to just one aspect (your enemy sprite, for instance), you quickly react to incomming events (timers, key presses, mouse input). That gives you the opportunity to update both your emenies and your playing character without using threading. Note that there are no complicated things you have to do to use this technique in Qt. Qt is event based from the base up. The only trick is to make sure that you don't do blocking operations, so no endless loops for animations for instance.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    theCrazyCrap
                    wrote on last edited by
                    #9

                    Thank you so much for your help! Now I get it... I'll just post here if I have more question.. Thank you again for your help!

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved