SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import time
  2.  
  3. __version__ = "0.1.0"
  4.  
  5. class GameCore(object):
  6.     def __init__(self,conf=None): # initialize game
  7.         self.conf = conf
  8.  
  9.         self.version = __version__
  10.  
  11.         self.running = True
  12.  
  13.         self.last_loop_time = time.time()
  14.  
  15.     def receive_updates(self): # get updates from the server connection thread
  16.         pass
  17.  
  18.     def update_game(self,delta_time): # update the game's object states
  19.         pass
  20.  
  21.     def user_input(self): # handle user input
  22.         pass
  23.  
  24.     def send_updates(self): # pass relevant updates to the server connection thread
  25.         pass
  26.  
  27.     def render(self): # render the current state of the game
  28.         pass
  29.  
  30.     def run(self):
  31.  
  32.         delta_time = 0
  33.        
  34.         while running:
  35.            
  36.             # update everything
  37.             self.receive_updates()
  38.             self.update_game(delta_time)
  39.             self.user_input()
  40.             self.send_updates()
  41.             self.render()
  42.  
  43.             # update delta_time (this keeps track of how much time has passed so that update_game() can be framerate independent)
  44.             delta_time = time.time() - self.last_loop_time
  45.             self.last_loop_time = time.time()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top