Flight sim game

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!).

Great :slight_smile: !
It seems there is a fulscreen AA, but are the images upsampled or blurred ?

It looks good! :slight_smile:

Is this all Panda3D or did you also implement features from other engines?

raytaller: Images are not upsampled or blurred, maybe some images look blurry because the game uses a gaussian blur filter to indicate significant throttle change.

pro-rsoft: Everything is Panda except the terrain is using a modified version of enn0x’s SOARX wrapper, not the built in height tessalator. Oh, and also we use Pygame for joystick input.

Glad you liked it. It’s been only two months since we started so hopefully the final shots will look much better.

can you elaborate on what you mean by modified version of soarx :slight_smile:

I would be curious also to know what you used for your terrain editor, here atm im using Earthsculptor, though it has no linux counterpart ( wine maybe).


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.

We used Carrara as terrain editor.

Great work. The graphics look great.

How are you implementing the HUD?

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.

I’m impressed and glad you got the algorithm to work for you.
The contrails at the wing tips and the engine look great :slight_smile:

I’m having trouble with the Pygame joystick code. I wonder if you can help explain and/or provide a little of your code.

Specifically the problem I have is that I can read events like in

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”

Any help would be great.

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"])
                    messenger.send(eventName, [e.dict["value"]])
                if (e.dict["axis"] == 1):
                    eventName = "JoystickAxisY"+str(e.dict["joy"])       
                    messenger.send(eventName, [e.dict["value"]])
                if (e.dict["axis"] == 2):
                    eventName = "JoystickAxisThrottle"+str(e.dict["joy"])
                    messenger.send(eventName, [e.dict["value"]])
            if e.type == JOYBUTTONDOWN:
                if (e.dict["button"] == 0):
                    eventName = "JoystickButton0Down"+str(e.dict["joy"])
                    messenger.send(eventName, [])
                if (e.dict["button"] == 1):
                    eventName = "JoystickButton1Down"+str(e.dict["joy"])
                    messenger.send(eventName, [])

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.

Hope this helps. Let me know if it doesn’t :slight_smile:.

Thanks for writing back so quickly.

Based on what you wrote I was able to get it to work. I didn’t need the whole event thing. My code’s a little simpler and a little more ghetto but it works.

for e in G.event.get():
			self.yaxis = self.j.get_axis(1)
			self.xaxis = self.j.get_axis(0)
			if self.j.get_button(0) == 1 and self.fire == 2: self.fire = 1
			if self.j.get_button(0) == 0: self.fire = 2


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).

actually i used to repeat the same texture on all the map, its beautifull, near of the character but ugly far, i dont really know how can i apply a different texture when the distance is far, and how apply a texture a a specific part of the ground.
I dont really understand the geom node, the good way will be to get geom, get their z and then apply a différent texture.
Bunt i dont really know how to do that.
And for the shader system i don’t know, how make shader, i know i must use the CG shader language but i haden’t learned it.