Results 1 to 12 of 12

Thread: Multithreading in games?

  1. #1
    denniswrenn
    Guest

    Multithreading in games?

    Is this commonly done? How much performance loss is there if I don't use more than one thread?


    Thanks,
    Dennis

  2. #2
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    First of all; are you going to try threads in VB????



    But now back to the question. You should only use threading in games when a task has to be done independantly from the main loop, or you would have to synchronize the two, which basically defeats the purpose of a thread. You might see a little increase in speed, but mostly you won't notice it...

    I can't think of much use for threading in games.... well, maybe the loading screen, so you can load the graphics and sounds while an animation plays or something... but I think most games rely on the 'moving, drawing, moving, drawing' loop...

    I think implementing a good threading system just takes too much time, especially for the one-man (or woman) programmers...

    But offcourse I can be totally wrong
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you might be. Network games might run a lot faster if there's another thread checking for incoming messages and replies according to them. Anyways, I'm about to develope a game which has it's GUI running on a separate thread, but this is a special case, my game will eat more performance on game variable calculations than on rendering the GUI so it's a case where you could benefit from asyncronisation. Also my GUI message queue system will probably be multithreaded until i come up with a reason it's unnessesary. If you make a game with a low framerate you could run the mouse on another thread which checks the mouse for movement frequently.

    Multithreading isn't too hard to accomplish, i picked up some ADT classes that can be derived for threads, which included mutexes to protect accessed data.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    denniswrenn
    Guest
    Originally posted by PsychoMark
    First of all; are you going to try threads in VB????

    Absolutely NOT!!! I don't code in VB anymore unless I'm really bored and am helping someone... C++ Rules!!!!

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    hehe
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I didn't even think you COULD use multithreading in VB..
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    You can multithread in VB but its soooooooooooo un-secure and messes alot. i agree tho C++ is like "**** vb" now

  8. #8
    Zaei
    Guest
    I would agree that the most use multiple threads get in games are for multiplayer, and a UI. A few months ago, i was reading through the documentation for UnrealScript, and one of the things that they did was have Latent functions, which would continue to operate over multiple frames, but they didnt use threads. The reason, was because apparently windows doesnt handle thousands of simultaneous threads (im sure). A game design should work well enough to not have to use threads.

    As to threads in VB, you CAN use them in version 5, but its impossible in 6.

    Z.

  9. #9
    denniswrenn
    Guest
    What? Huh? *** would MS do that?!?!?!?

  10. #10
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Maybe because they realised it was too unstable
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  11. #11
    denniswrenn
    Guest
    Well, in that case, they should've just trashed the whole VB project, and concentrated on making VC++ better

  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    There's too many VB fans out there (especially here) and MS would loose a lot of $$ on it, vb.net gives them $$, but I still hope they're going to improove VC++
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width