After reading a post regarding the lack of examples about what can be done in Panda with shaders, I just decided to share couple of screenshots from a multiplayer flightsim game that we’ve been developing. It features a bunch of shaders as well as an implementation of SOARX algorithm for terrain (thanks enn0x!).
It’s not heavily modified, basically it’s couple of little performance tweaks and a hack to be able to use two refinement cameras at the same time (we have split screen mode). And also we had to develop a clever algorithm to decide when to update the terrain. A good balance between performance and aesthetics was hard to achieve.
For the HUD we are using semi transparent textures loaded onto a plane, and positioned on aspect2d.
Objects like the radar, are composed of several layers of images while others have text overlay-ed on images.
but the data stream that comes out isn’t very useful. I tried using the pygame functions joystick.get_button() and joystick.get_axis() but no matter what I put in the argument and no matter what I do with the joystick all it just returns “0”
The problem with pygame is, it needs an event to be generated before a meaningful value is read. This means, if you don’t move your joystick at all, get_axis will always return 0, however that might not be true (you might have a separate throttle axis etc). Honestly, I tried couple of tricks from pygame website to fix this but did not help at all.
Anyway, if there is an event generated (button press, movement) then everything works fine. This is my sourcecode that converts pygame events to Panda events:
def JoystickPollingTask(self, task):
for e in pygame.event.get():
if e.type == JOYAXISMOTION:
if (e.dict["axis"] == 0):
eventName = "JoystickAxisX"+str(e.dict["joy"])
if (e.dict["axis"] == 1):
eventName = "JoystickAxisY"+str(e.dict["joy"])
if (e.dict["axis"] == 2):
eventName = "JoystickAxisThrottle"+str(e.dict["joy"])
if e.type == JOYBUTTONDOWN:
if (e.dict["button"] == 0):
eventName = "JoystickButton0Down"+str(e.dict["joy"])
if (e.dict["button"] == 1):
eventName = "JoystickButton1Down"+str(e.dict["joy"])
Notice that I am using this for polling two joysticks, hence the eventName “+str(e.dict[“joy”])”. After this part, you can do whatever you want by self.accept(eventName, function) statements.
Thanks for posting the JoystickPollingTask code. It is pretty much what I’ve been trying to write today. However, since I am relatively new to Python, I am having issues getting it to work properly. (Much more comfortable with C/C++ & Java) Would it be possible to post a simple program that runs that I can fiddle with? One that includes the imports & such?
Hi, thats amazing !
I have a question , how are you doing for apply the texture on the grounds/mountains.
I have a problems, its when my map is big, the texture is scaled , and then, when you are close to the map its ugly…
one pixel of the texture, make then 1kmÂ²…
Slade992, I’m not sure about this project specifically, but for good terrain texturing you generally need to use a shader supporting multitexturing.
At a minimum you want a large texture and a detail texture so that you get good texture variation at both near and far distances, with the detail texture repeating more densely than the large texture. Better yet, you often use 2 or 3 large scale textures which are blended together (often using a 4th texture to define blending weights, but other techniques can use vertex coordinates to define the blend, e.g., so that the texture varies with altitude).