EAE6320_Final_Project
A downloadable game for Windows
Snakes
Controls:
WASD: Navigation
Fig 1. Gameplay
Game Details:
Snakes is a simplified version of snake game that comes in the old mobile phones. The Player controls a snake to collect food. Because of limitation in the system the length of the snake remains the same, but to make it a bit challenging the speed of the snake increase each time the player collects 5 food. The game ends/resets if the player touches the wall at the sides.
Motivation:
For my final project, I selected snake as it was my first game that I had every played in my life, I still remember playing snake on my father’s Nokia 1100. Along with that, excluding this project, I had created snake game in 3 different language namely: java-script, c# and Python, which solidified my idea to create it once more in C++ with my own engine.
Fig 2. My Snake Game, that I created in c#
Engine:
Base Engine:
The base engine was provided to us from our professor which I have used for creating my game as well as my system project. The good thing I found about the base engine system was that, even though we need to follows a strict hierarchy of things, it was easily portable and implementable. This really helped us in using other people system project while creating my project.
The System also provided us with a maya plugin that helped us to create assets in maya and export into game with the format we want with in our system.
The one thing, I hate and found it frustrating about the system was that the system did not help us to set origin of the object to how it looks in maya, i.e. if I change the object location in maya and export it, only the local transform changes not the world transform, so that location of my object is always 0,0,0 even though the object look as if it is in 1,1,1. Because of that I had to change and re-export objects from maya again and had to change the position of my objects manually on creation.
Fig 3. My Maya file that I had to change origin to 0 so that I can use it properly
Using My Own System Project:
As, I had created my system using my own object and graphic representation, I was pretty straight forward to use it in my game with much issues.
There was one thing that I found out in my system, which was my particle system was always centered at the location of the last rendered object, but it can be prevented if I rendered my particles first before rendering other objects
Using Other People’s System Project:
I have used two other systems along with my own Particle System, depending on my need:
- Srija Kambhampati’s Audio System : For having Audio in my Game
- Luis Garcia’s Collision System: For detecting collision when snake hits the food
Luis system was the first system I added to my game, his system was simple. He had created his system such that the collision box is 1 to 1 related to scale of the object in maya, which made making the collision box for my game super easy. He had supported collision for Squares and circles which was all I needed for my system. Also, it’s because of his system, I found about how imported objects are changed in local space and not in world space. All in all, his system is best if you want collisions for simple 2D objects in the game.
Srija’s System was also easy to use. Her system has support for both .wav and mp3 files. The interface was simple without any lua file. You can play the sound with a single function call, even the looped sounds have a different function call which helps to remove confusions while calling the function to play sound. But I had met with few problems while using Open GL with her system, she had used XAudio which was providing some errors while building it in open GL. But those were solved easily as she helped me in fixing those problems.
Problems Faced While Creating My Game:
I was trying to animate the snake to how it used to be in the old nokia phones but the limitation of our engine proved it too difficult to do such simple movements. Our engine has continuous frames where we just change the velocity of objects to change the position. But when I tried to do it, with velocity only, the objects were not turning properly and following the head, and when I tried to change it by position the objects are only rotating and the body touches the wall. Because of that I decided to make the snake only single block.
Fig 4. My test to animate using Velocity
Fig 5. My test to animate using position
Other problem was generating random location in both negative and positive x and y axis. C++ only provide feature to generate random numbers in integers and no float values are generated directly. Which was one of the issues for me. It took me almost 4 hours to get a proper solution which gives me a random number in all 4 quadrants, which I than used to change my particle system to be more randomize than it was before.
Fig 6. Randomization of particles using my old calculation
Fig 7. Randomizing the particle using the new calculations
Retrospective of Course:
Through out the course I learned many new and useful things, that I had not yet known or was not using it practically.
The first concept was how threading is used in our engine, I have used multi-threads to support multiple tasks, like adding databases, network connects etc. But I had not realized that threading can be used in engine to provide easy access to draw and change object transforms. This whole system of bucket/storage where we store the data for next frame to draw is kind of like mutex but not mutex as the values can still be changed but not deleted from the system. The reference of the object is stored and pass to graphics to run at render phase and which is created in input or time based. Which is cool concept with threading.
I also found learning lua and build application based on lua file is challenging as well as useful. In the beginning I found lua files very frustrating and was fed up with them, but once I started using binary values for data I felt that lua files are so useful which can reduce the computational speed by a lot. I also had fun while decoding the binary letters on my own to know if the data is right or not.
I had never work in Maya and even though we had only used for 1 month, it was fun to learn maya a bit to create our own asset. The maya exporter plugin for our game was provided by our faculty but I really want to create my own plugin for maya from scratch.
I also liked the way we had our assignment was also very helpful. Each assignment had a concept associated with it and it help me to get a better understand of how platform specific interface works under the hood of a platform independent structure or engine.
Download
Install instructions
To play my snake game you need to,
- Download the zip folder.
- Extract the files anywhere you want
- Run the Snake.exe
Leave a comment
Log in with itch.io to leave a comment.