Snake is a little C++ / OpenGL project which shows a snake eating apples on a two dimensional board. It really is very much like the famous Nokia phone game except the snake finds its way on its own.
No nice textures, no sweet drawings yet. The world elements are mostly simple spheres. Trivial OpenGL features such as fog, lightning and shadows are implemented though.
Oh, and the snake it quite stupid at the moment. I wrote the path finding
algorithm in an hour or so and I really need to come up with something smarter.
It is currently based on a simple A* shortest path finding algorithm which, despite being a somewhat working approach, is very limited.
It still is a game as the "user" can at any moment deactivate the auto-pilot and take the control of the snake himself. Whenever the user chooses to do so (by pushing "o"), the camera rotation stops and moves to the bottom of the board.
The project is open-source'd under GNU LGPL license and if you're interested in OpenGL, (soft-)realtime C++ programming or simple algorithms you might very well enjoy having a look at the source code provided here.
The source code :
I managed to build a win32 executable using the GLUT library and mingw32:
This project is provided as a standard *nix project and has a makefile (no configure script). To build it, just go in the root folder and type make
The project needs the following libraries : libGL.so
There is also a QT version and a meamo (Nokia n900) version. The version to be built is chosen from the makefile.
There are good chance one needs to change the makefile to make it fit its Linux (or Mingw) distribution.
User manual :
- start/stop the camera rotation
- turns the auto-pilot engine on/off
When auto-pilot is turned off, one can use u, h, j, k to control the snake
Happy snaking !
Posted by Badtrash
@ 09:59 PM CET