GP2X Pyracerz For Gp2x


Magic Sam

Forever Homebrew
Joined
Aug 10, 2007
Messages
2,544
Age
42
Location
Yuzu onsen
Hi,

I think GP2X lacks racing games. As a result, I decided to port a "small" python racing game to the GP2X, pyRacerz

I'm quiet new to python and I thought it would be a nice training :)

I have installed a working python environment on my GP2X with the help of this tutorial

My *.gpe to run the game reads as follow:

CODE
PYTHONHOME=/mnt/sd/python
export PYTHONHOME

PYTHONPATH=${PYTHONHOME}/lib/python2.4/site-packages:$PYTHONPATH
PYTHONPATH=${PYTHONHOME}/lib/python24.zip:$PYTHONPATH
PYTHONPATH=${PYTHONHOME}/lib/python2.4/lib-dynload:$PYTHONPATH
PYTHONPATH=${PYTHONHOME}/lib/python2.4:$PYTHONPATH
PYTHONPATH=${PYTHONHOME}:$PYTHONPATH
export PYTHONPATH

LD_LIBRARY_PATH=${PYTHONHOME}/extras:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH


/mnt/sd/python/python -v /mnt/sd/pyRacerz-0.2/pyRacerz.py --resolution 320x240 > /mnt/sd/pyRacerz_output.txt 2>&1

cd /usr/gp2x
./gp2xmenu


BUT, when I launch the game, python displays this in pyRacerz_output.txt :

CODE
Traceback (most recent call last):
File "/mnt/sd/pyRacerz-0.2/pyRacerz.py", line 29, in ?
import misc
ImportError: No module named misc


The afore mentioned line 29 is here:

CODE
sys.path.append("modules")
import misc
import player
import game
import menu
import track
import replay
import challenge


This error doesn't occur when I run the game "normally" under Linux, the misc module is found (in /modules/misc.py), initialization goes on and the game works...

I have to say that I didn't expect the game to work immediately, and that tweaking would be necessary. What I didn't expect was that kind of error...

Any ideas about what I am doing wrong ?

Thanks for your help :)

Magic Sam
 
I first thought that I could comment this line with #, but now I think it's a bad idea. Actually, if it doesn't find this module, there is no reason that it will find the others (player, game, menu, etc.), which are all in the same directory (/modules). Besides, if the original coder wrote a "misc" module, I think it was on purpose, as you don't spend time on unnecessary stuff, don't you ?
I think my problem is about PATH, maybe the game is looking in the wrong place to find its modules. The strange thing is that it works fine when I run the game on my computer...
 
I think the problem is that you do not execute the python script from it's directory.
The python script adds 'modules' to PATH. So when looking for the imports it will look in <the current working directory>/modules.

You can cd to /mnt/sd/pyRacerz-0.2/ before executing the script or change the script to sys.path.append( sys.path[0] + "modules" )

Hope this helps....
 
@ Yos-T: you were right :) I didn't care about the *.gpe location, and I was wrong :) Now the game finds all its modules, initializes, then crashes :) But it's OK, I can now start tweaking :)

Thanks to both of you for your replies !

Bye

Magic Sam
 
Next stop: the fonts !

As I said before, the game now finds its modules and initialization goes on, but not for a long time :(

CODE
Cannot initialize fonts:
unable to read font filename


Fonts are located in /fonts. I tried to rename them differently, with no success :(

In the game README file it is said that "Sometimes on some GNU/Linux distros, you should also "manually" install a more recent SDL-ttf
package, 2.0.7 instead of 2.0.6. (pyGame is a python wrapper for the SDL library)".

I will search this forum as I think SDL-ttf problems have been documented before.

I run the game with the following parameters: --resolution 320x240 --nosound --fullscreen --nodoublebuf, opinions ?

The last thing I can see before the game crashes is a mouse cursor...

To be continued...

Magic Sam
 
I removed the --nosound parameter from my *.gpe and it seems to work, as I can hear an engine sound before the game crashes :)

I also removed the --resolution 320x240 parameter from the same file, but then the game crashed even faster than before (unable to initialize graphics), proving that this parameter was useful :)

I found some interesting topics about SDL_ttf in the forums, I tried to replace the library provided in pygame with some I found in the Archive, with no success :( And I also had a look at www.libsdl.org...

Do any of you have a SDL_ttf 2.0.7 lib compiled for the GP2X that I could use in this port ? Or do you think the problem is about the name and/or size of the fonts used by this game (alba and arcade_pizzadude) ?

Thanks for your help !

Bye

Magic Sam
 
Back
Top