-
I am wondering in games such as Unreal, SimCity and others like that, how do the programmers do the time. I mean like in Tetris I assume that a timer would triker then their would be code in that timer that would move the blocks. So what do Unreal, Simcity do. Is it a timer or something else
Thanks
-
They probably use a gameloop instead of a timer, that is a serie of operations like rendering, keyboard and mouse input, processing all the data needed under a cycle, which repeats on until the game is ended. Timing is then achieved with using for instance Gettickcount api.
-
Chuka-Laka!!
Yep, id have to agree with kadaman,
they dont use a timer, they use a loop untill something breaks the loop, but there is also a timere so that the game doesnt take too lonad and to keep track of playing time.
UT has a logger, which logs gane events into a temp file, you can save that log file and look at it.
Code:
Do While Not isEventTriggered
''some hundreds of lines of code....
If event == eventTrigger Then
isEventTriggered = True
End If
''etc... some other bunch of code
If timeGetTime(now) >= maxTime Then
isEventTriggered = True
End If
''guess whats next
''yup!! u guessed right (more code)
Loop
-
Chuka-Laka!!
what i just wrote is not even anywhere near what ut uses,
it is just a sketch of what most devlopers do to keep track of game play... and to have a game that doesnt end as soon as it draws one pixel on the screen.
that would suck.
but this is one way you can do in vb.
peace out m8s