Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #----------------------------------------------------------------------#
- ## IMPORTS ##
- import time
- from time import time
- ### PANDA Imports ###
- ## Server Imports ##
- ########################################################################
- class GameManager():
- def __init__(self, _serverManager):
- # Holder for clients
- self.serverManager = _serverManager
- # Loop break?
- self.gameRunning = True
- def start(self):
- self.gameMainLoop()
- def stop(self):
- pass # remove task
- # make this a task and get rid of the 1st while
- def gameMainLoop(self):
- timeRate = 1000 / 60
- lastTime = 0
- '''
- while( true )
- check for client commands
- sanity check client commands
- run AI
- move all entities
- resolve collisions
- sanity check world data
- send updates about the game to the clients
- handle client disconnects
- end
- '''
- # while(True):
- # print ('server running')
- while (self.gameRunning):
- time = time()
- self.gameSimulationTick(time, lastTime, timeRate)
- self.gameNetworkUpdateTick()
- # This should run at 60Hz
- def gameSimulationTick(self, _time, _lastTime, _timeRate):
- while(_time > _lastTime):
- _lastTime += _timeRate
- '''
- game logic here?
- '''
- # This should run at anything between 10Hz - 15Hz
- def gameNetworkUpdateTick(self):
- pass
Advertisement
Add Comment
Please, Sign In to add comment