The progress I've made in my first year of Games Development at University. (so far)
Introduction
Hello! My name is Wiktor Janik, a Level 4 Computer Games Development student and I'm excited to be sharing my experience of studying Games Development at Staffordshire University for my first year, as well as going through the process of some of the troubles and fixes I implemented when making the games I'm about to speak about. Currently, I've been at University for six and a half months - and boy have I learnt a lot…
The First week - Game Jam
In the first week of University, all of the students with a Games Technology related course got together and took part in a small Game Jam, where we had five days to make any game we wanted and submit it.
This was a great opportunity to meet some new people and make new friends, geek out about our favourite games, get creative, create a cool little game, and then at the end of it try out other group’s games for some fun.
Each group consisted of about five people, with everyone in those groups having varying backgrounds, abilities and experiences in programming. Personally, I had about four years’ experience of making games beforehand, two of which were in Python where I used tkinter and turtles to create games – and the other two using JavaScript and HTML5 to create simple browser games. Before hand, I had never programmed any 3D games using Game Engines - which became a slight problem later on.
Getting Started
The first thing we did in my group was introduce each other, share our some of the cool games we’ve made before, get to know each other and think of some ideas for a game we were going to make. Our overly creative minds exploded – as there were infinite possibilities and such little time! We hopped from idea to idea; A spaceship game where there are alien ships, asteroids, planets and other spacey stuff, 3D first person shooters with multiple players, a training barracks and load-outs, tank games with laser turrets and plasma guns, we went through the whole arsenal (literally).
Finally, we settled on the idea of a zombie apocalypse game (where a badly drawn representation can be seen above) – where there was a trapped survivor who had to kill multiple waves of zombies to survive. The zombies would have a random chance to drop coins and power ups whenever killed, the player could then use the coins for upgrades like better armour or a better gun, and the power ups consisted of things like the zombies being a one shot for a certain amount of time, and the player being a little bit faster when running for a short time. The aim was to survive ten rounds; with every round’s wave getting harder and harder as the game progresses. At the final round, a big boss mutant zombie in the distance would hear the chaos, and smell the scent of the survivor - then, it would break through a metal gate out of rage and the player has to kill it, and then escape to civilization as the gate trapping them has been broken.
A problem arises...
However, with only five days to implement all these features – we quickly realised this was a bit too ambitious; since most of us never even had any experience using Unity, and there was just too much to add in the short time given.
So, to meet the deadline we simplified the game quite a lot, there was no more coins and up-gradable weapons, and no more boss fight at the end. Instead, the survivor would just have to survive for as long as possible, until they either meet their death as zombies start to spawn more frequently, or they shoot at the blocked entrance to the cave, unblock it and save their score there. They could also find a hidden shield in a broken shed on the map to help them, which would let them survive an extra hit from a zombie.
We start coding...
I implemented the zombie spawning code, as well as the AI for the zombies. I had to quickly search through a whole lot of YouTube tutorials on how to program in C# and how to use Unity. Here is a snippet of the code I introduced for the zombie movement, which I got from a lot of trial and error:
private void Update( { this.changeX = this.player.position.x - this.transform.position.x; this.changeZ = this.player.position.z - this.transform.position.z; this.dist = Mathf.Sqrt((float) ((double) this.changeX * (double) this.changeX + (double) this.changeZ * (double) this.changeZ)); this.velX = this.changeX / this.dist; this.velZ = this.changeZ / this.dist; this.transform.Translate(this.velX * this.forwardSpeed * Time.deltaTime, 0.0f, this.velZ * this.forwardSpeed * Time.deltaTime); })
It’s pretty basic code! All this does is get the difference in the x coordinates of the player and a zombie, as well as the z difference, then from that you can use Pythagoras’ theorem to get the distance between the player and the zombie, then you can get the unit vector of the direction in which the zombie should travel in, multiply it by the speed of the zombie and time.deltatime (the completion time in seconds since the last frame – allows you to get the same result when running the game on different frame rates) and finally translate the zombies position by that amount every frame.
Now that this was implemented; next up was the spawning...
private void Update( { this.targetTime -= Time.deltaTime; if ((double) this.targetTime > 0.0) return; this.timerEnd(); } private void timerEnd() { this.targetTime = 5f; this.offset = new Vector3((float) Random.Range(-20, 20), 1f, (float) Random.Range(-20, 20)); Object.Instantiate<GameObject>(this.enemy, this.spawn.transform.position + this.offset, this.spawn.transform.rotation); })
Every frame, we subtract time.deltatime from our desired spawn time and check if it's time to spawn zombies in or not. If it is, then we reset the timer, create a random offset from the spawn for each zombie and then create a new zombie at that position by cloning from a zombie that was off screen. It's pretty simple - but one thing that I forgot to do when first implementing this was to only do it for one zombie at a time, and not clone a zombie for every zombie on the map... it lead to scenarios like this where if you don't kill the zombies quick enough they exponentially multiply by doubling every couple of frames... oops.
There are probably over 200 zombies in that pile... this caused the game to run extremely slowly and made the game crash.
Finally, I fixed this issue just in time for the submission. I just made it so whenever it's time to spawn a new zombie, it only gets cloned from the first zombie created (which was hidden under the map where the user couldn't see it), and uploaded the project.
For my first time – I was pretty proud of myself, considering this was my first 3D game, and as a team, we were pretty happy with the end result, even though we didn’t get to implement all of the features we wanted to.
A link to a little demo video of the finished product:
Programming Pacman
Programming Pacman was the first big stepping stone in terms of my programming progress in C++, it taught me how to make use of sprite sheets (as previously I would make a bunch of separate images then load them into an array ), classes using inheritance and polymorphism, and creating different data structures.
Firstly, everyone got given a framework to work with - it included Pacman as well as a single munchie:
With this, we had the basic foundation to build a working Pacman game - each week we'd be given a tutorial that showed us how to implement some basic features into our program including movement, collisions, sound, boundaries, animations, loading and writing in files, basic AI and code standards. Once I finished all of the tutorials, I was left with a Pacman who could wrap around each wall, a bunch of munchies in random positions on the screen which you could collect, four ghosts which went left and right bouncing off the walls which killed you if you collided with them, and some cherries in random positions as well. This was a good base for starting to implement more complex additions to the game.
The first thing I wanted to implement was a map with walls where the Pacman could move around in. To do this, I first created a wall structure, which Pacman and the ghosts would collide with, then I created a simple text file which I could edit, I figured 21 x 21 would be the best for creating the map:
Each of these characters would symbolize what entity would need to be placed at that tile.
Key:
"-" - Empty tile
"0" - Wall
"m" - Munchie
"c" - Cherry
"g" - Ghost
"p" - Pacman
Then I would load in the text file, for loop it and check what character is at that index position, and place the corresponding entity there.
for (int y = 0; y < 21; y++ { for (int x = 0; x < 21; x++) { map >> myChar; //walls if (myChar == '0') { _blocks[index]->texture = BlockTex; _blocks[index]->position = new Vector2(offsetx + (x * 32) , offsety + (y * 32)); _blocks[index]->sourceRect = new Rect(0.0f, 0.0f, 32, 32); index++; } //munchies if (myChar == 'm') { _munchies[index2]->_munchieTexture = munchieTex; _munchies[index2]->_munchiePosition = new Vector2(offsetx + 10 + (x * 32), offsety + 10 + (y * 32)); _munchies[index2]->_munchieSourceRect = new Rect(0.0f, 0.0f, 12, 12); index2++; } if (myChar == 'p') { _pacman->_pacmanPosition = new Vector2(offsetx + (x * 32.0f), offsety + (y * 32.0f)); _pacman->_pacmanSourceRect = new Rect(0.0f, 0.0f, 32, 32); } if (myChar == 'c') { _cherries[cherryIndex]->_cherryTexture = CherryTex; _cherries[cherryIndex]->_cherryPosition = new Vector2(offsetx + (x * 32.0f), offsety + (y * 32.0f)); _cherries[cherryIndex]->_cherrySourceRect = new Rect(0.0f, 0.0f, 32, 32); cherryIndex++; } if (myChar == 'g') { _ghosts[ghostIndex]->position = new Vector2(offsetx + (x * 32.0f), offsety + (y * 32.0f)); _ghosts[ghostIndex]->sourceRect = new Rect(ghostIndex * 32.0f, 0.0f, 32, 32); ghostIndex++; } } })
The result was this, the ghosts spawn at the correct positions and wander off in a random direction:
All I decided to do next given I hadn't had much time left to submit the project was add a death animation when Pacman dies, implement a life system, a highscore using another external file and make it so that pacman could eat the ghosts if you ate a cherry.
Here is a video showing what that turned out to look like:
This was the finished result, I was pretty happy with it as it was my first game in C++, I learned a lot from it and there's definitely areas I could have done better now that I look back on it (for example a smarter ghost AI) - which shows I've improved since then.
Programming Mario (Work in progress)
Mario is the latest C++ project which I'm still working on now for my coursework. It is still a Work in progress, so I won't be writing too much about it here as it pretty bare bones at the moment - but hopefully, in the oncoming weeks I'll beef up the project a bit more.
Getting the project started.
Just like with the Pacman project, every week we got given a tutorial on how to implement some basic features into the game; however, this time we started completely from scratch.
Firstly, we got the SDL library to work - which embarrassingly took me about three weeks as I couldn't figure out what I was doing wrong in the set up, and it turns out the only reason was this little option right here (which you're not supposed to tick, but for some reason I did because I like clicking things):
With that frustration aside, I got to work.
Next, in the oncoming weeks I followed along with the tutorials which got me to a point where I have a working character class, a level map, collisions, enemy AI, Audio and some other basic features.
Just recently I have completed all these tutorials and will be implementing new features over the oncoming weeks, This is my project at the moment... But hopefully, in about a month I can reflect on this and compare my progress.
Where I'm at currently...
This is the project in its current state, after completing the tutorials I added animations for Mario and Luigi, a mechanic where if a player hits their head on a platform they bounce back down, as well as coins and a death state when a player gets hit by a Koopa.
Plans for the future:
- More enemy types
- More levels
- Animate enemies
- Point / winning system
- Projectiles
- Main Menu
Hopefully I can implement most of these if not all of these before submission, wish me luck!
Programming a 3D game in OpenGL (Work in progress)
This is also a work in progress, so I'll keep it brief but just like the Mario project, I've only just finished the tutorials for the basic features of the program. At the moment, it's only a 3D scene and not even a game, but I'm going to try and change that soon.
The best way to show my progress with this is just to demonstrate the drastic change in my project over the weeks...
Setting Up
Firstly, as usual, I followed along a tutorial which helped me set up OpenGL. This was pretty easy and didn't take too long, in the first week, I managed to draw a 2D square onto the screen by passing in some coordinates and colours into a function:
Finally, some 3D.
Then, I learnt to load in vertices and colours from a file and render them onto the screen as an object, I also implemented some camera movement to look at the object:
Rotation and new shapes
I got a bit carried away and added random stuff... made the objects rotate by themselves, and also figured out how to make objects change colour every couple of frames.
Creating multiple 3D objects with classes
Then, I used classes to create several objects, gave them a random velocity and rotation which basically made it look like an explosion:
Added Textures, Lighting, Materials and Text.
The final result was a scene like this, where the user can move the camera about with WASD controls, as well as spawn new objects with keyboard input, and move the camera about with other inputs.
Here is a video better demonstrating what is going on in the picture:
Future Progression
This still needs a lot of work, so over the next couple of weeks I'll be trying to improve this project and turn it into a game. I'm not going to spoil any of my ideas just yet but I'll be posting my final result when I get there in the future!
Conclusion
In conclusion, I'm pretty happy with my progress I've made over the past couple of months - I feel like I've definitely improved and learnt a lot of valuable information regarding how to create simple games, implement some cool features, render 3D objects on to a screen and much much more - this is just the start however.
I've got a lot more coming my way and I'm looking forward to it!
First Class Computer Games Development. Systems Specialist at Sheffield City Council.
3yIt's great seeing all the progress you've made and in such a short time frame too! I think your videos are set to private rather than unlisted (if you try and access the links using an incognito browser you'll see what I mean).