This one is really puzzling me because I don’t know which is the correct way.
For example, two ways that I can think of:
A. One main game loop:
spawn game_loop
- game_loop is a method that has a tick rate of 15 times a second. It loops through all the games, the players in those games, sends out positional updates, hp/mp regen, etc.
B. Each game has their own game loop
- Each time a Game class is created (new game), the class has its own
game_loop
fiber, that handles all the players in the game, hp/mp regen, etc.
I currently use option A. Why? I actually don’t have a definitive reason. I think one 15hz loop is enough compared to if there were 100 games open. Which would be 1500 iterations per second. HOWEVER, those iterations are spread out in individual fibers.
Any thoughts or insight? Thanks in advance!