Exemplo n.º 1
0
def goMenu():
    global gameBackend, game, mode, gametype, mainMenu, skipIntro, menu

    # initialize engine settings
    engine.init(showFrameRate=False, daemon=(mode == MODE_DAEMON))
    engine.preloadModels()

    # initialize the network interface
    net.init(defaultPort)

    gameBackend = None
    game = None

    mainMenu = core.MainMenu(skipIntro)
    menu = None

    def mainloop(task):
        global mainMenu, gameBackend, game, menu
        engine.update()
        if mainMenu is not None and mainMenu.active:
            gameBackend, game = mainMenu.update()
        else:
            mainMenu = None

        if gameBackend is not None:
            gameBackend.update()

        if game is not None:
            game.update()
            if menu is None:
                menu = ui.Menu()

            if not menu.active or not gameBackend.connected:
                game.delete()
                gameBackend.delete()
                game = None
                gameBackend = None
                mainMenu = core.MainMenu(skipIntro)
                menu.delete()
                menu = None

        engine.endUpdate()
        return task.cont

    taskMgr.add(mainloop, "mainloop")
Exemplo n.º 2
0
Arquivo: main.py Projeto: play3577/a3p
def goMenu():
    global gameBackend, game, mode, gametype, mainMenu, skipIntro, menu

    # Initialize engine settings
    engine.init(showFrameRate=False, daemon=(mode == MODE_DAEMON))
    engine.preloadModels()
    engine.log.info(GAME_NAME + " " + VERSION_CODE + " - " + COPYRIGHT)

    from direct.distributed.PyDatagram import PyDatagram
    net.init(defaultPort, PyDatagram)

    gameBackend = None
    game = None

    mainMenu = core.MainMenu(skipIntro)

    menu = None

    def gameLoop(task):
        global mainMenu, gameBackend, game, menu
        engine.update()
        if mainMenu != None and mainMenu.active:
            gameBackend, game = mainMenu.update()
        else:
            mainMenu = None
        if gameBackend != None:
            gameBackend.update()
        if game != None:
            game.update()
            if menu == None:
                menu = ui.Menu()
            if not menu.active or not gameBackend.connected:
                game.delete()
                gameBackend.delete()
                game = None
                gameBackend = None
                mainMenu = core.MainMenu(skipIntro)
                menu.delete()
                menu = None
        engine.endUpdate()
        return task.cont

    taskMgr.add(gameLoop, "Game loop")
Exemplo n.º 3
0
Arquivo: main.py Projeto: etodd/a3p
def goMenu():
	global gameBackend, game, mode, gametype, mainMenu, skipIntro, menu
	
	# Initialize engine settings
	engine.init(showFrameRate = False, daemon = (mode == MODE_DAEMON))
	engine.preloadModels()
	engine.log.info(GAME_NAME + " " + VERSION_CODE + " - " + COPYRIGHT)
	
	from direct.distributed.PyDatagram import PyDatagram
	net.init(defaultPort, PyDatagram)
	
	gameBackend = None
	game = None
	
	mainMenu = core.MainMenu(skipIntro)
	
	menu = None

	def gameLoop(task):
		global mainMenu, gameBackend, game, menu
		engine.update()
		if mainMenu != None and mainMenu.active:
			gameBackend, game = mainMenu.update()
		else:
			mainMenu = None
		if gameBackend != None:
			gameBackend.update()
		if game != None:
			game.update()
			if menu == None:
				menu = ui.Menu()
			if not menu.active or not gameBackend.connected:
				game.delete()
				gameBackend.delete()
				game = None
				gameBackend = None
				mainMenu = core.MainMenu(skipIntro)
				menu.delete()
				menu = None
		engine.endUpdate()
		return task.cont

	taskMgr.add(gameLoop, "Game loop")
Exemplo n.º 4
0
Arquivo: main.py Projeto: play3577/a3p
def goDaemon():
    # Initialize engine settings
    engine.init(showFrameRate=False, daemon=True)
    engine.preloadModels()
    engine.log.info(GAME_NAME + " " + VERSION_CODE + " - " + COPYRIGHT)

    from direct.distributed.PyDatagram import PyDatagram
    net.init(defaultPort, PyDatagram)

    if gametype == DEATHMATCH:
        gameBackend = core.PointControlBackend(True, username)
    elif gametype == SURVIVAL:
        gameBackend = core.SurvivalBackend(True, username)
    gameBackend.loadMap(defaultMap)

    def gameLoop(task):
        engine.update()
        if gameBackend != None:
            gameBackend.update()
        engine.endUpdate()
        return task.cont

    taskMgr.add(gameLoop, "Game loop")
Exemplo n.º 5
0
Arquivo: main.py Projeto: etodd/a3p
def goDaemon():
	# Initialize engine settings
	engine.init(showFrameRate = False, daemon = True)
	engine.preloadModels()
	engine.log.info(GAME_NAME + " " + VERSION_CODE + " - " + COPYRIGHT)
	
	from direct.distributed.PyDatagram import PyDatagram
	net.init(defaultPort, PyDatagram)

	if gametype == DEATHMATCH:
		gameBackend = core.PointControlBackend(True, username)
	elif gametype == SURVIVAL:
		gameBackend = core.SurvivalBackend(True, username)
	gameBackend.loadMap(defaultMap)

	def gameLoop(task):
		engine.update()
		if gameBackend != None:
			gameBackend.update()
		engine.endUpdate()
		return task.cont

	taskMgr.add(gameLoop, "Game loop")
Exemplo n.º 6
0
def goDaemon():
    # initialize engine settings
    engine.init(showFrameRate=False, daemon=True)
    engine.preloadModels()

    # initialize the network interface
    net.init(defaultPort)

    if gametype == DEATHMATCH:
        gameBackend = core.PointControlBackend(True, username)
    elif gametype == SURVIVAL:
        gameBackend = core.SurvivalBackend(True, username)

    gameBackend.loadMap(defaultMap)

    def mainloop(task):
        engine.update()
        if gameBackend is not None:
            gameBackend.update()

        engine.endUpdate()
        return task.cont

    taskMgr.add(mainloop, "mainloop")
Exemplo n.º 7
0
from direct.directbase import DirectStart
from panda3d.core import *

engine.loadConfigFile()

# Setup window
props = WindowProperties()
props.setCursorHidden(True)
props.setTitle("A3P Editor")
base.win.requestProperties(props)
base.setBackgroundColor(0, 0, 0)

filename = sys.argv[1]

engine.init()
net.init(constants.MODE_SERVER)
aiWorld = ai.World()
netManager = net2.NetManager()
entityGroup = entities.EntityGroup(netManager)
ui = ui.EditorUI()
map = engine.Map()
map.load(filename, aiWorld, entityGroup)
base.disableAllAudio()

editor = controllers.EditController(aiWorld, entityGroup, map, ui)


def mainloop(task):
    global aiWorld
    global entityGroup
    global map
Exemplo n.º 8
0
import sys

engine.loadConfigFile()

# Setup window
props = WindowProperties()
props.setCursorHidden(True)
props.setTitle("A3P Editor")
base.win.requestProperties(props)
base.setBackgroundColor(0, 0, 0)

filename = sys.argv[1]

engine.init()
net.init(net.MODE_SERVER)
aiWorld = ai.World()
netManager = net2.NetManager()
entityGroup = entities.EntityGroup(netManager)
ui = ui.EditorUI()
map = engine.Map()
map.load(filename, aiWorld, entityGroup)
base.disableAllAudio()

editor = controllers.EditController(aiWorld, entityGroup, map, ui)


def gameTask(task):
    global aiWorld
    global entityGroup
    global map
Exemplo n.º 9
0
hosts = dict()

i = 1
while i < len(sys.argv):
    if sys.argv[i] == "-p":
        try:
            defaultPort = int(sys.argv[i + 1])
            i += 1
        except:
            showHelpInfo()
    else:
        showHelpInfo()
    i += 1

net.init(defaultPort)


def log(msg):
    logFile = open("lobby.csv", "a")
    logFile.write(str(datetime.datetime.now()) + "\t" + msg)
    logFile.close()


def updateHosts():
    global hosts
    deletedHosts = []
    timestamp = time.time()
    for key in hosts.keys():
        if timestamp - hosts[key].lastPing > EXPIRE_TIME:
            deletedHosts.append(key)
Exemplo n.º 10
0
hosts = dict()

i = 1
while i < len(sys.argv):
	if sys.argv[i] == "-p":
		try:
			defaultPort = int(sys.argv[i + 1])
			i += 1
		except:
			showHelpInfo()
	else:
		showHelpInfo()
	i += 1

net.init(defaultPort)

def log(msg):
	logFile = open("lobby.csv", "a")
	logFile.write(str(datetime.datetime.now()) + "\t" + msg)
	logFile.close()

def updateHosts():
	global hosts
	deletedHosts = []
	timestamp = time.time()
	for key in hosts.keys():
		if timestamp - hosts[key].lastPing > EXPIRE_TIME:
			deletedHosts.append(key)
	for key in deletedHosts:
		del hosts[key]
Exemplo n.º 11
0
Arquivo: editor.py Projeto: etodd/a3p
import sys

engine.loadConfigFile()

# Setup window
props = WindowProperties()
props.setCursorHidden(True)
props.setTitle("A3P Editor")
base.win.requestProperties(props)
base.setBackgroundColor(0, 0, 0)

filename = sys.argv[1]

engine.init()
net.init(net.MODE_SERVER)
aiWorld = ai.World()
netManager = net2.NetManager()
entityGroup = entities.EntityGroup(netManager)
ui = ui.EditorUI()
map = engine.Map()
map.load(filename, aiWorld, entityGroup)
base.disableAllAudio()

editor = controllers.EditController(aiWorld, entityGroup, map, ui)

def gameTask(task):
	global aiWorld
	global entityGroup
	global map
	global ui