Do games use threads?
Posted
by
Nubcake
on Game Development
See other posts from Game Development
or by Nubcake
Published on 2012-11-09T23:09:46Z
Indexed on
2012/11/09
23:26 UTC
Read the original article
Hit count: 135
directx
I understand that the concept of how a game runs i.e
while (game_loop = true)
{
//handle events
// input/output/sound etc
}
But it has come to my attention while programming in another HLL is do some games use threads for certain operations? For example take any Pokemon game ; during interaction a textbox appears to display information. Now I've been trying to simulate that sort of textbox and the only way I could have got it to be exactly the same is by using a loop and yes once a loop is started there is no way to handle window events unless they are handled again inside the loop itself.
I couldn't have used this loop inside a different thread other than the main one (due to a DirectX limitation) so the only option was to use it inside the main program thread. I was wondering if some games work like this ; do they only use the main program thread and handle events again if they're inside a loop?
Edit: I forgot to mention this is about console games not PC games!
Thanks Nubcake
© Game Development or respective owner