Exemplo n.º 1
0
def main():
	
	web_port = 2080
	tcp_port = 2081

	tcp_opts = {
		'turns':350,
		'loadtime': 3000, 
		'turntime': 2000,
		'viewradius2': 55,
		'spawnradius2': 1,
		'attackradius2': 5,
		'attack': 'power',
		'food': 'symmetric',
		# non-game args
		'db_max_games': 100, #how many games should be kept on the webserver
	}

	web_opts = {
		'style': 'light',
		'host': socket.gethostname(),
	}
	
	db  = game_db.load()
	tcp = TcpThread( tcp_opts, db, tcp_port )	
	web = WebThread( web_opts, db, web_port )
	
	try:
		tcp.start()
		web.start()
	except:
		game_db.save( db )		
		raise
Exemplo n.º 2
0
 def create_game(self):
     # we might crash..
     if self.db.latest % 10 == 1:
         game_db.save(self.db)
         
     # play it again, sam.
     self.db.latest += 1
     
     # get a map and create antsgame
     map_name, map_data, nplayers = self.select_map()
     log.info( "next game is " + str(self.db.latest) + " : " + map_name + " needs " + str(nplayers) + " players." )
     opts = self.opts
     opts['map'] = map_data
    
     return TcpGame( self.db, opts, map_name, nplayers )