PandaSafari

I made a small game to get a feel for Panda. Try it out!

martineriksen.net/pandasafari.html

  • Martin

Sounds good!
But erhm… I don’t have windows. Maybe you could post a linux version?

Likewise, I’d like to see it but don’t have Windows. You could post a Linux version or even just the source code would do…

wanna see it too. =) make a linux version,pleaaase

Downloaded and found that you used some other packaging method for distribution, wow! Did you use py2exe or just compiled the stuff manually along with the configuration for NSIS?

I haven’t played long enough but the idea is good, but IMO the arrow reloading + panda spawning time needs to be shorten to make it more intense. adding bonus powerups could add some color too. Great job! You got me inspired!

@soybean: panda3d comes with a utility to automatically generate a NSIS file for your project. (packpanda.)

Hey Guys,

Great with the interest! :slight_smile:

  • I just used pandapack that comes with panda to pack the installer.

  • I zipped up the whole working directory for the Linux dudes. It is available here: martineriksen.net/PandaSafari.zip

The class you have to run with ppython is the one called “main”. That should be it I think… Be warned that the code is really crappy…

Note that even with the installer the whole sourcecode comes along with the game and can be altered. So if you feel like giving yourself more money (that can be changed in the main class) or alter the panda spawn rate (changed in ralphshooter.py - very chaotic code…) give it a shot! If you come up with some fun “mods” of course I am very happy to hear about them :slight_smile:

to hide your source you can use the python bytecode. aside from it’s hardly human readable it doesnt have any real benefit.
and if you want to provide standalone linux programms you should have a look at freeze (usualy comes with your python installation on linux).

well … doesnt really work for me.
my issue when trying to run ppython main.py
Traceback (most recent call last):
File “main.py”, line 1, in ?
import ralphshooter
File “/HD2/Downloads/PandaSafari/ralphshooter.py”, line 96, in ?
class Input( DirectObject ):
TypeError: Error when calling the metaclass bases
module.init() takes at most 2 arguments (3 given)

did you do any modifications/configurations for packpanda? why does your package is much smaller in size than the one from AirBlade?

I like it!!! :slight_smile:
It first didn’t work, so I replaced class Input( DirectObject ): with class Input( DirectObject.DirectObject ):, same as for the Main class.
ALso, i added the line from pandac.PandaModules import * to main.py.

A few suggestions:
[]add more trees and stuff.
[
]more wild animals. faster ones (lions) and slow ones (like pandas)
[]on-off-switchable 3d view maybe?
[
]the spear sometimes didn’t hit my panda? weird… (because of that I died)

Strange dont know why it wouldnt work straight away. Only thing I can think of is that we are using different versions of Panda… I am using version 1.2.3.

I just used standard packpanda. Guess mine is smaller than Airblade because I have less graphics and models in there. Just a guess.

Intensity increases as you level up!! :slight_smile: When you reach level 13 you should have plenty of spawning Pandas and bought enough extra spears and speed to get a good rush…

Yeah I thought about making it more varied; lions, tigers shooting, native jungle people,… But to make something like that the game should be rewritten; right now it is just a prototype; too messy to build on. Dont think I will get the time to do that anytime soon.

The program is interesting. I have a couple of questions I couldn’t find readily looking through the code;

  1. How did you set the window to full screen and change the resolution?

  2. I don’t understand how your bleed class works, can you explain this a little?

Full screen: slightly tricky, set in a parameter file somewhere, think I used the instructions here:

panda3d.org/manual/index.php/Configuring_Panda

Bleeding:

If you play around with textures you will see that it is quite easy to load new textures onto a polygon (for example the ground which is a 2d polygon) at runtime. So I simply take the existing bitmap that is the texture for the ground and paint some blood on it using a recursive procedure. It works like this: I select a spot that I want to bleed on. If there is already blood (the color of the pixel is red) I select a neighbour recursively until there is a green spot which is painted red. Below extract from the sourcecode illustrates this:

def paintBlood(self,xf,yf, recursion_depth):
	#if we are within img coordinates 
	if(recursion_depth==0):
		return
	x=int(xf)
	y=int(yf)
	if(x>0 and x<i.texImage.getXSize() and y>0 and y<i.texImage.getYSize()):
		if (i.texImage.getRed(x,y)!=self.bloodRed):
			i.texImage.setRed(x,y,self.bloodRed)
			i.texImage.setBlue(x,y,0)
			i.texImage.setGreen(x,y,0)
		else:
			self.paintBlood(x+randint(-3,3), y+randint(-3,3), recursion_depth-1)
			

def bleed(self):
	if (randint(1, self.frequency)==1):
		self.duration-=1
		if (self.duration==0):
			i.bleedEffects.remove(self)
		# we bleed...
		#1. figure out index on bitmap to bleed on
		#1.1 find the point on render
		pointOnRender=render.getRelativePoint(self.model, self.point) 
		relativeX=(pointOnRender.getX()+GROUND_SCALE/2)/GROUND_SCALE
		relativeY=(-1*pointOnRender.getY()+GROUND_SCALE/2)/GROUND_SCALE
		#1.2 scale to size of bitmap relative to size of render
		imageX=i.texImage.getXSize()
		imageY=i.texImage.getYSize()
		bleedX=imageX*relativeX
		bleedY=imageY*relativeY
		#2. recursively find a spot that isnt bled on and bleed there..
		j=0
		while (j<self.intensity):
			j+=1
			self.paintBlood(bleedX, bleedY,800)

an old thread i know, but does anyone know how to get this working with panda3d 1.5.0? (i’m a newbie)

Haven’t played with Panda since I did PandaSafari - but you should be able to make it run by downloading the installer on martineriksen.net/pandasafari.html. It is self-contained so does not matter which version of Panda you have installed.

thanks - i think my copy of panda 3d is interfering with the self-contained version you provide.

i’ll just try to fix it myself and maybe it’ll help me learn about panda 3d