MummyIsland is a 3D game, Written in Python using Pyopengl and Pygame.
- Install python 3
- install Pyopengl, PyOpenGL-accelerate and Pygame (
pip install pygame PyOpenGL PyOpenGL-accelerate
) - (Note) If the game didn't run due to PyOpengl error, then the Libs above must be installed manually from https://www.lfd.uci.edu/~gohlke/pythonlibs/
python game.py
- WASD-controls
- space for jumping
- shift for running
- f1 to start/stop recording
- f2 to replay a record
- esc to exit game
- Left mouse click to shoot
- R to reload
- To use cheat codes just type the code while playing
code | what it does |
---|---|
massacre | kill all the mummies |
hackmag | infinity number of bullets loaded into mag |
maxa | infinity reloads |
rocket | no gravity |
flash | speed boost |
neverdie | infinity health |
slamdunk | high jump |
reset | removes all applied cheats |
latest version
https://youtu.be/myg0ISQryD8
previous version
https://youtu.be/TgGBlhRgckA
To add animations to the game follow these steps
- Export the animation as obj sequence format (I used Obj Sequence Export for 3DS Max)
- Use obj.py to convert from obj sequence to single animation json file by changing 'path' string variable to the animation's folder. note: all obj/mtl files will be deleted and two files will be created instead.
- Compress the resulting "Animation" file to a "ZIP" format, and rename the compressed file to "something.pak".
- Now you should have 3 files: "something.pak", "textures.tan" and the texture image (if exists).
- load the frames using loadPack(pak_file) which returns a list of frames then use it to make Animation(list_of_frames).
-
why not just use th obj sequence animation directly?
Because they will consume a lot of space, slower to load and the same texture will be loaded into memory multiple of times. -
why not use the collada format (.DAE)?
Since the game is made using an old version of OpenGL (glBegin/glEnd), the default vertex shader cannot be modified to calculate the animation using transformation matrix of each vertex, and hence the best option is to precalculate thousands of sequential matrix multiplications by the CPU for each frame and store them in memory which will result in the same memory usage as the obj sequence.