[ENSICAEN] TunnelGL, One week of OpenGL


The project was to create a simple game using OpenGL. At this moment, our skills in OpenGL were really limited. So we needed something as simple as possible as a game. And then, started to improve it! We got a week to develop this game. We were in a team but only 2 of us was able to program the game. The third one created the ship.

This project was launched in a week where we didn’t really get the time to develop such a game because of the end of the scholar year. We wanted to finish the year project before starting to develop this game and that is why I was not really sure if I will post something about this project. But the things were better than expected! We got a free day on Monday, therefore the weekend was pretty long and we were able to program a lot of things.

We chose to develop a game where the player is in a tunnel and has to avoid the obstacles. The tunnel was programmed to be a straight cylinder with the same radius all the time. The colors change with the Z position of the edge. We got something like a rainbow, and it was pretty funny because it was just a test to see the different portion. The obstacles were design to be white, with a gradient from the edge of the tunnel to the upper edge of the obstacle. The effect we got was an “ice” style. We added a spot light to illuminate the upper edges of the obstacles. Then, the ice effect was completed with a beautiful white on the top!
For the obstacles design, they are not an object we added to the tunnel, they were directly generated during the generation of the tunnel. Therefore, The tunnel is generated with holes and obstacles by a matrix which represents a portion of it.

HUD and Game

For the game, we adjust the speed of the player to be increased with a boost (Only the Z component). And we adjust the angular velocity with the Z speed to allow the player to success in every section of the tunnel he encounters on his way, whatever the speed he had. As I said earlier, we cut the tunnel in sections. A section is loaded with a matrix and a matrix can be design in a .txt file with your own skills. The limitation are 12 sides and a multiple of 20 for the length.

Now the ship: you can go left, right and boost. When you use the boost, the camera comes closer to the ship to simulate the propulsion of the ship. We added a camera shaking to improve this feeling. The higher your speed is, the closer to the cockpit you will be. For the score, we double it when you are boosting your ship. Elsewhere, it depends on the speed. Each 10 sections, the tunnel levels up and generates harder section. From this moment on, we got a beautiful game, very polished and programmed with a lot of love during an incredible weekend of 3 days! We added some sound effects and there it was.

I was really passionate during the development of this game because I really like OpenGL. It was a great experience. I think now I can start to make a new game using this technology. A goal for the future! :D
When this game was developed, I wanted to add some stuffs to it. But my project manager didn’t find it really interesting enough to be added. I will develop them here now because I forked the project to save my work on the new functionalities I did during this weekend. The first one is some curves for the tunnel and a variation of the radius. The curve were too straight to be added but the variation of the radius were perfect. But it was not the same game because these functionalities change the game a little bit too much. So, I will put both versions available to download at the end of this post. Another improvement was the following of the side by the ship. In the first version, the ship follows a circle around the center of the tunnel. In the modified version, the ship follows the form of the tunnel, so you can feel the ground of the tunnel. I like it, but as the ship flies, this is not really something my project manager wanted. :>

Release version : 1.0 TunnelGL (Windows)
Alternative version : (Coming a day when I will get the time to update it)
Github : https://github.com/Aomeas/tunnelGL

Ideas for the future :
* Generate a portion with a number of sides different.
* Make a real curve
* Propulsion effect on the ship
* Redesign the ship
* Create a real music

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>