-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathload_tester.py
More file actions
53 lines (48 loc) · 2.27 KB
/
load_tester.py
File metadata and controls
53 lines (48 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import direct.directbase.DirectStart #starts Panda
from pandac.PandaModules import * #basic Panda modules
from direct.showbase.DirectObject import DirectObject #for event handling
from direct.actor.Actor import Actor #for animated models
from direct.interval.IntervalGlobal import * #for compound intervals
from direct.task import Task #for update fuctions
import sys, math, random
from w_loader import w_loader
from w_loader import spawn_locations
from terrain import terrain
from fog import *
from smoke_emitter import *
from carData import CarData
import pythonServer, pythonClient
from ping_server_browser import *
global panda_window_settings
set_panda_settings(panda_window_settings)
class World(DirectObject): #subclassing here is necessary to accept events
def __init__(self):
#WxPandaShell.__init__(self, fStartDirect=True)
#turn off default mouse control, otherwise can't reposition camera
base.disableMouse()
self.setupLights()
render.setShaderAuto() #turns on per-pixel lighting, normal mapping, etc (you probably want to use this)
base.camLens.setFar(1500)
def setupLights(self):
#ambient light
self.ambientLight = AmbientLight("ambientLight") #parameter is a name
#four values, RGBA, Alpha is largely irrelevant, value [0,1]
self.ambientLight.setColor((.04, .04, .04, 1))
self.ambientLightNP = render.attachNewNode(self.ambientLight)
#the nodepath that calls setLight is what gets illuminated by the light
render.setLight(self.ambientLightNP)
#call clearLight() to turn it off
w = World()
game_fog()
init_smoke()
#smoke_emitter(w.panda, 0, 0, 500)
global spawn_locations
if panda_window_settings["action"] == "host":
w.cars = CarData([], 0)
w.connection = pythonServer.Network(w.cars, panda_window_settings["game_time"], panda_window_settings["selected_map"], panda_window_settings["num_players"], panda_window_settings["player_name"])
taskMgr.doMethodLater(10, ping_server_browser, 'ping_server_browser_daemon')
elif panda_window_settings["action"] == "join":
print "Made it to client creation"
w.cars = CarData([], -1)
w.connection = pythonClient.Client(w.cars, panda_window_settings["ip"], panda_window_settings["player_name"])
run()