How in the world would you make a pause function?
Almost every game has it- whether it be Deus Ex, Fifa, Zelda- but how does it *work*?
(obviously it's not very applicable in multiplayer games, but since BYOND can easily be single player...)
Is there an if() in *every* function in the game checking a pause variable?
That seems inefficient to me. Is there an easier way?
ID:170068
Mar 24 2005, 1:55 pm
|
|
Elation wrote:
Is there an if() in *every* function in the game checking a pause variable? Of course not! If the player can't do anything while the game is paused, then the only actions that could possibly be occuring during a pause are infinite loops. Therefore, you merely need to place while(!game_pasued) statements inside those loops, and when the game is unpaused, you need to re-initialize the loops that were running before the pause. |
Typically those games are programmed with a game loop. If you don't know what a game loop is, you obviously don't know anything about the real world of video game programming...
Games that are programmed in real programming languages tend to have a loop that handles everything, and exits when the player decides to quit the game. basically, before any processing is done for the next portion of the loop, most of them have an if function that checks to see if that aspect of the game is paused. BYOND would be much harder to apply this to. |
In response to Ter13
|
|
I see.
It just always confused me how you could press pause and stop a bullet in mid air- would that mean that it'd have to keep checking to keep moving? Thanks for clearing it up, partially. :) Sorry if I was asking a silly question. |
In response to Elation
|
|
Yes and no.
Games are based in the main loop: (THIS IS NOT DM, this is a C++ like syntax.) public void main(string args[]) Do you get this at all? BYOND pretty much handles the game loop for you by default, so it'd be really hard to set this kind of a system up. |
In response to Ter13
|
|
Indeed, I understand.
Thanks a lot, Ter: You the man! (or something) |
In response to Ter13
|
|
Ter13 wrote:
Do you get this at all? BYOND pretty much handles the game loop for you by default, so it'd be really hard to set this kind of a system up. It's not hard to set up that kind of system in BYOND. Darke Dungeon uses a global game loop. Most verb actions function outside the loop (say, get, etc.), but all movement, combat, and item use does. Deadron's Event Loop library is a good starting point for this technique. |
-- Super Squirrel
((Mmm, lemon snow!))