예제 #1
0
 def __init__(self, master):
     self.oP = OutPipe("Localizer", 0)
     self.eI = EngineInterface()
     self.master = master
     self.oldLanguage = ""
     self.oldObjectCount = 0
     self.oP("Initialized.")
예제 #2
0
 def __init__(self, sourcename, objname, GUID, scriptName, flags, props, pos=(0,0,0), rot=(0,0,0), sca=(1,1,1), extra=None, side="SERVER"):
     #Tools
     self.oP = OutPipe("Entity - "+sourcename, 0)
     self.initVolatileModules()
     
     #Basic values
     self.name = sourcename
     self.GUID = ""
     
     #Extra
     if not extra:
         extra = {}
     
     #Basic Flags
     self.physicsTrack = False
     self.animTrack = False
     self.netVars = {}
     
     self.actions = []
     
     self.detectors = []
     
     self.scriptName = scriptName
     
     #Handle Flags
     self.processFlags(flags)
     
     #Create Object
     self.createObject(objname, sourcename, GUID, pos, rot, sca, props, extra)
             
     #Install custom code
     self.installCustomCode()
             
     if hasattr(self, "init"):
         self.init(side)
예제 #3
0
    def __init__(self, keyboard):
        self.oP = OutPipe("TypingHandler", 0)
        self.eI = EngineInterface()
        self.keyboard = keyboard

        self.letters = {
            self.eI.e.AKEY: "a",
            self.eI.e.BKEY: "b",
            self.eI.e.CKEY: "c",
            self.eI.e.DKEY: "d",
            self.eI.e.EKEY: "e",
            self.eI.e.FKEY: "f",
            self.eI.e.GKEY: "g",
            self.eI.e.HKEY: "h",
            self.eI.e.IKEY: "i",
            self.eI.e.JKEY: "j",
            self.eI.e.KKEY: "k",
            self.eI.e.LKEY: "l",
            self.eI.e.MKEY: "m",
            self.eI.e.NKEY: "n",
            self.eI.e.OKEY: "o",
            self.eI.e.PKEY: "p",
            self.eI.e.QKEY: "q",
            self.eI.e.RKEY: "r",
            self.eI.e.SKEY: "s",
            self.eI.e.TKEY: "t",
            self.eI.e.UKEY: "u",
            self.eI.e.VKEY: "v",
            self.eI.e.WKEY: "w",
            self.eI.e.XKEY: "x",
            self.eI.e.YKEY: "y",
            self.eI.e.ZKEY: "z",
        }

        self.specials = {
            self.eI.e.ZEROKEY: "0",
            self.eI.e.ONEKEY: "1",
            self.eI.e.TWOKEY: "2",
            self.eI.e.THREEKEY: "3",
            self.eI.e.FOURKEY: "4",
            self.eI.e.FIVEKEY: "5",
            self.eI.e.SIXKEY: "6",
            self.eI.e.SEVENKEY: "7",
            self.eI.e.EIGHTKEY: "8",
            self.eI.e.NINEKEY: "9",
            self.eI.e.ACCENTGRAVEKEY: "`",
            self.eI.e.BACKSLASHKEY: "\\",
            self.eI.e.COMMAKEY: ",",
            self.eI.e.EQUALKEY: "=",
            self.eI.e.LEFTBRACKETKEY: "[",
            self.eI.e.MINUSKEY: "-",
            self.eI.e.PERIODKEY: ".",
            self.eI.e.QUOTEKEY: "'",
            self.eI.e.RIGHTBRACKETKEY: "]",
            self.eI.e.SEMICOLONKEY: ";",
            self.eI.e.SLASHKEY: "/",
            self.eI.e.SPACEKEY: " ",
        }

        self.oP("Initialized.")
예제 #4
0
    def __init__(self, objectMode=False):
        self.oP = OutPipe("EngineInterface", 0)

        self.worldCoreName = "WorldCommander"
        self.overlayCoreName = "OverlayCore"
        self.waypointsCoreName = "WaypointsCore"
        self.mainSceneName = "MainScene"
        self.overlaySceneName = "Overlay"
        self.waypointsSceneName = "Waypoints"

        self.protected = [
            "__default__cam__", "DefaultCamera", "WorldCommander"
        ]

        self.charset = [
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c',
            'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
            'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C',
            'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
            'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
        ]

        self.l = bge.logic
        self.r = bge.render
        self.e = bge.events

        if objectMode:
            pass
예제 #5
0
    def __init__(self):
        self.oP = OutPipe("SoundEngine", 0)
        self.eI = EngineInterface()
        self.sD = SubtitleDrawer(self)

        self.subtitles = 1
        self.language = "en"

        self.device = aud.device()

        self.sounds = {}
        self.dialogs = {}

        self.music = None
        self.musicHandle = None

        self.playbacks = []
        self.dialogPlaybacks = []

        self.videoAudio = None

        self.masterVolume = 1.0
        self.dialogVolume = 1.0
        self.musicVolume = 1.0
        self.soundVolume = 1.0

        self.setMasterVolume(1.0)

        self.oP("Initialized.")
예제 #6
0
 def __init__(self, fileName):
     self.oP = OutPipe("ContentReader", 0)
     
     self.val = None
     self.load(fileName)
     
     self.oP("Initialized.")
예제 #7
0
    def __init__(self):
        self.oP = OutPipe("InputReceiver", 0)
        self.cR = ConfigReader(GAME_PATH + "controls")
        self.sE = ScriptExecuter()
        self.eI = EngineInterface(objectMode=False)
        self.keyboard = self.eI.getKeyboard()
        self.mouse = self.eI.getMouse()
        self.tH = TypingHandler(self.keyboard)
        self.pairs = {}
        self.responses = {}
        self.oldKeyboard = self.keyboard.events
        self.oldMouse = self.mouse.events

        self.sE.addContext("Input", self)
        self.sE.execute(INPUT_PATH + "csp")
        self.sE.execute(INPUT_PATH + "input")

        self.keyEvents = []

        self.readControls()

        self.locked = False
        self.xsens = 50
        self.ysens = 50
        self.inverted = 0
        self.predict = False

        self.recent = {}

        self.oP("Initialized.")
예제 #8
0
    def __init__(self, master):
        self.oP = OutPipe("SubtitleDrawer", 0)
        self.eI = EngineInterface()
        self.master = master

        self.currentSubtitle = None

        self.oP("Initialized.")
예제 #9
0
    def __init__(self, fileName):
        self.oP = OutPipe("ConfigReader", 0)

        self.parser = ConfigParser()

        self.open(fileName + CONFIG_EXT)

        self.oP("Initialized.")
예제 #10
0
    def __init__(self):
        self.oP = OutPipe("ShaderHandler", 0)
        self.eI = EngineInterface()

        self.actionQueue = []
        self.actionCooldown = 0

        self.oldObjectCount = 0

        self.oP("Initialized.")
예제 #11
0
    def __init__(self, server):
        self.oP = OutPipe("PhysicsReader", 0)

        self.server = server
        self.oldPositions = {}
        self.oldActions = {}

        self.recent = {}

        self.maxMessages = 30
        self.updateCount = 0
        self.switchPanel = SwitchPanel()
        self.switchPanel.addSwitch("skipTicks", 0.0333)

        self.oP("Initialized.")
예제 #12
0
    def __init__(self, client):
        self.oP = OutPipe("PhysicsApplicator", 0)

        self.c = client

        #self.scene = bge.logic.getCurrentScene()

        self.archive = Archive()
        self.blacklistedGUIDs = []

        self.smooth = False
        self.maxLocationDisparity = 0.2
        self.maxRotationDisparity = 10.0
        self.maxScaleDisparity = 0.1
        self.maxVelocityDisparity = 0.5

        self.oP("Initialized.")
예제 #13
0
    def __init__(self, name, resource, scriptName):
        self.oP = OutPipe("Interface - " + name, 0)
        self.eI = EngineInterface(objectMode=False)
        self.sE = ScriptExecuter()

        self.name = name

        self.gameObject = None

        self.sE.addContext("Interface", self)
        self.sE.execute(scriptName)

        self.eI.getGlobal("addToQueue")(resource, name, self)

        if hasattr(self, "init"):
            self.init()

        self.oP("Added interface %s." % name)
예제 #14
0
    def __init__(self, master, cli):
        #Tools
        self.oP = OutPipe("Player - " + str(cli.addr), 0)
        self.master = master
        self.initVolatileModules()

        self.username = cli.userProps["username"]
        self.confirmed = False

        #Basic values
        self.cli = cli
        self.entity = None

        self.installCustomCode()

        self.netVars = {}

        self.init()

        self.oP("Initialized player.")
예제 #15
0
        def __init__(self):
            #Remove engine log
            try:
                os.remove(ENGINE_PATH + "engine_log" + TEXT_EXT)
            except:
                pass

            #Remove net logs
            try:
                for i in os.listdir(NET_PATH):
                    os.remove(NET_PATH + i)
            except:
                pass

            #Create net path
            try:
                os.mkdir(NET_PATH)
            except:
                pass

            self.oP = OutPipe("Launcher", 0)
            for line in self.getSystemInfo():
                self.oP(line)
            self.cR = ConfigReader(ENGINE_PATH + "engine")
            self.sE = ScriptExecuter()
            self.eI = EngineInterface()
            self.eI.preLoad()
            self.eI.preLoadEpi()
            #Sloppy, removes the blacker that covers up starting glitches
            self.eI.getOverlayScene().objects["BlackScreen"].endObject()
            self.sound = SoundEngine()
            self.sound.preLoadAudio()

            self.s = None
            self.c = None
            self.output = True

            self.oP("Initialized.")
예제 #16
0
    def __init__(self):
        '''Initializes the server.'''
        self.mode = "server"

        self.oP = OutPipe("Server", 0)
        self.nC = None

        self.cvars = {
            "sv_addr": "0.0.0.0",
            "sv_port": 7777,
            "sv_netlog": 0,
            "sv_level": "",
            "sv_game": 0,
            "sv_singleplayer": 0,
            "sv_gamemode": "singleplayer",
            "sv_startscript": "",
            "sv_master": "",
            "sv_dedicated": 0,
            "sv_chat": 1,
            "sv_background_red": 0,
            "sv_background_green": 0,
            "sv_background_blue": 0,
            "sv_background_alpha": 0,
            "sv_password": "",
            "cl_language": "en",
            "cl_subtitles": 1,
            "cl_width": 1280,
            "cl_height": 720,
            "cl_fullscreen": 0,
            "cl_motionblur": 0,
            "cl_motionblur_amount": 0,
            "cl_anisotropic": 1,
            "cl_mipmap": "none",
            "cl_vsync": "off",
            "cl_musicvolume": 10,
            "cl_dialogvolume": 10,
            "cl_soundvolume": 10,
            "cl_netping": 0,
        }

        self.netVars = {}

        self.oldNetVars = self.netVars
        self.oldcvars = self.cvars

        self.gameMode = None
        self.level = None

        self.unassignedPlayers = []

        self.entities = []

        self.events = []

        self.saveFile = None

        self.chatMessages = []

        self.eI = EngineInterface(True)
        self.sE = ScriptExecuter()
        self.pR = PhysicsReader(self)
        self.sH = ShaderHandler()
        self.l = Localizer(self)

        self.updateNetwork()

        self.forceUpdateCVars()

        self.keepAliveTicker = 0
        self.trackedProperties = []

        loadServer(self)

        self.oP("Initialized.")
예제 #17
0
    def __init__(self):
        self.oP = OutPipe("ScriptExecuter", 0)

        self.context = {}

        self.oP("Initialized.")
예제 #18
0
    def __init__(self):
        self.oP = OutPipe("VideoPlayer", 0)
        self.eI = EngineInterface()

        self.oP("Initialized.")
예제 #19
0
import bge
from outpipe import OutPipe
from time import time

cont = bge.logic.getCurrentController()
own = cont.owner

if not "oP" in own:
    own["oP"] = OutPipe("VideoTexture", 0)
    own["starttime"] = 0.0
    own["executions"] = 0


def playVideo(video):
    materialID = bge.texture.materialID(own, "IMblank.tif")
    own["video"] = bge.texture.Texture(own, materialID)
    try:
        own["video"].source = bge.texture.VideoFFmpeg(video)
        own["video"].source.scale = True
        own["video"].source.play()
        own.setVisible(True)
        own["starttime"] = time()
        own["executions"] = 0
        own["oP"]("Loaded video %s." % video)
    except:
        own["oP"]("Failed to load video %s." % video)


def stopVideo():
    own.setVisible(False)
    if "video" in own:
예제 #20
0
    def __init__(self):
        '''Initializes the client.'''

        self.mode = "client"

        self.oP = OutPipe("Client", 0)

        self.eI = EngineInterface(objectMode=True)
        self.vP = VideoPlayer()
        self.sE = ScriptExecuter()
        self.iR = InputReceiver()
        self.l = Localizer(self)
        self.pA = PhysicsApplicator(self)
        self.sH = ShaderHandler()
        self.nC = None

        self.sE.addContext("Client", self)

        self.cvars = {
            #Low level settings
            "cl_update": 1,
            "cl_synced": 0,
            "cl_addr": "0.0.0.0",
            "cl_oport": 7777,
            "cl_iport": 7778,
            "cl_netlog": 0,
            "cl_game": 0,
            "cl_startscript": "",
            "cl_master": 0,
            "cl_predict": 1,
            "cl_smooth": 0,
            "cl_name": "Player",
            "cl_password": "",
            "cl_camera": "",
            "cl_lockcontrols": 1,
            "cl_showmouse": 1,
            "cl_xsens": 50,
            "cl_ysens": 50,
            "cl_inverted": 0,
            "cl_netping": 0,

            #High level settings
            "cl_language": "en",
            "cl_subtitles": 1,
            "cl_width": 1280,
            "cl_height": 720,
            "cl_fullscreen": 0,
            "cl_motionblur": 0,
            "cl_motionblur_amount": 0,
            "cl_anisotropic": 1,
            "cl_mipmap": "none",
            "cl_vsync": "off",
            "cl_musicvolume": 10,
            "cl_dialogvolume": 10,
            "cl_soundvolume": 10,
            "cl_mastervolume": 10,

            #Server shared settings
            "sv_level": "",
            "sv_gamemode": "",
            "sv_game": 0,
            "sv_background_red": 0,
            "sv_background_green": 0,
            "sv_background_blue": 0,
            "sv_background_alpha": 0,
        }

        self.netVars = {}

        self.chatMessages = []

        self.interfaces = []
        self.entities = []
        self.level = None

        self.gameEvents = []
        self.updateNetwork()

        #self.startLoop()
        self.forceUpdateCVars()

        self.keepAliveTicker = 0
        self.trackedProperties = []

        loadClient(self)

        self.oP("Initialized.")