Sigvatr
January 23rd, 2011, 10:27 AM
Hi there,
Lately I've been investigating the possible uses of threading in computer game, of which I am aware that there are quite a few that are quite commonly utilized.
I have no problems making use of threads, but I was wondering about what possible uses you can think of for them in computer games. I am working on a sidescrolling, networked multiplayer game, so threading applicable to those particular game attributes would be the most helpful. What ways do game programmers make use of threads in those particular contexts and game programming in general?
I have thought of a few uses of threads so far, although I have not implemented them as I know very little about the practical applications of threading. I would appreciate advisory commentary and recommendations based on the following applications of threading:
* Video rendering (OpenGL) independent of the game logic loop allowing uncapped frame rates regardless of the rate at which the game loop iterates. I understand that OpenGL is not threading friendly, but I figure that this won't be a problem as long as OpenGL operations are confined to a single thread. I've heard something about deltas? I'm not exactly sure what they are, but I think they have something to do with predicting the positions and states of things regardless of the game's frame rate?
* Audio handling and playback, especially with regards to synthesizing sound effects and procedural and dynamic generation of music. I'm very interested in real-time, procedurally generated content in general. I'm not sure what audio library to use in my game yet, but I'm sure that threading is important to audio in general.
* Window message management and handling. I've noticed one a few occasions that if my program is performing a complex function that could takes several seconds to perform, my operating system (Windows 7) will regard the application as not responding and crash it. Perhaps using a thread to receive and handle window and system messages (ideally at specific intervals) could help to solve problems like this.
* Artificial intelligence, perhaps?
Those are all of the uses I'd like to make of threads at the moment. However, I don't really know where to begin. Does anyone have any advice they could offer me on how to pursue this? Links to articles/tutorials would be good too.
Generally speaking, any and all thread related discussion here is a good thing!
Thanks!
- Sig
* Networking. I haven't started on my network code yet, but I'm sure having at least one thread to receive and interpret network data is essential.
Lately I've been investigating the possible uses of threading in computer game, of which I am aware that there are quite a few that are quite commonly utilized.
I have no problems making use of threads, but I was wondering about what possible uses you can think of for them in computer games. I am working on a sidescrolling, networked multiplayer game, so threading applicable to those particular game attributes would be the most helpful. What ways do game programmers make use of threads in those particular contexts and game programming in general?
I have thought of a few uses of threads so far, although I have not implemented them as I know very little about the practical applications of threading. I would appreciate advisory commentary and recommendations based on the following applications of threading:
* Video rendering (OpenGL) independent of the game logic loop allowing uncapped frame rates regardless of the rate at which the game loop iterates. I understand that OpenGL is not threading friendly, but I figure that this won't be a problem as long as OpenGL operations are confined to a single thread. I've heard something about deltas? I'm not exactly sure what they are, but I think they have something to do with predicting the positions and states of things regardless of the game's frame rate?
* Audio handling and playback, especially with regards to synthesizing sound effects and procedural and dynamic generation of music. I'm very interested in real-time, procedurally generated content in general. I'm not sure what audio library to use in my game yet, but I'm sure that threading is important to audio in general.
* Window message management and handling. I've noticed one a few occasions that if my program is performing a complex function that could takes several seconds to perform, my operating system (Windows 7) will regard the application as not responding and crash it. Perhaps using a thread to receive and handle window and system messages (ideally at specific intervals) could help to solve problems like this.
* Artificial intelligence, perhaps?
Those are all of the uses I'd like to make of threads at the moment. However, I don't really know where to begin. Does anyone have any advice they could offer me on how to pursue this? Links to articles/tutorials would be good too.
Generally speaking, any and all thread related discussion here is a good thing!
Thanks!
- Sig
* Networking. I haven't started on my network code yet, but I'm sure having at least one thread to receive and interpret network data is essential.