Generic Zombie Game is a simple top-down zombie survival shooter built with C++ and SFML. The gameplay consists of surviving against indefinitely spawning zombies with a choice of 3 weapons – a pistol, assault rifle and a knife. The game also features a simple day and night cycle, and you can press Q to equip the flashlight during night time. Be careful though, you can’t defend yourself with the flashlight!
This project is intended as an implementation of linear algebra used in 2D graphics.
The player moves around the world using the WASD keys and uses the mouse to both aim and fire. The player’s sprite also points towards the direction of the cursor with the following steps:
Convert the mouse cursor’s screen space position in to world space
Calculate the vector from the player’s world position to the cursor’s world position (cursorWorld – playerWorld)
Calculate the angle of this vector using arc-tangent and apply this angle as a rotation on the player sprite
The same vector is also used to position the camera, giving the appearance of the camera “following” the cursor.
The game makes use of animated sprites for the player and zombies. These work by loading spritesheets (an image with all frames of the animation stored in one) alongside a text file which provides information on where each frame of the animation is placed and how large they are. These values are loaded in to an array and a sub-section of the associated sprite sheet is rendered to the screen depending on the current time and frame.
The day and night cycle – as well as the flashlight effect – works using SFML’s blend mode wrapper around OpenGL blending:
Draw a solid rectangle to a different render target that covers the entire screen
Set the alpha channel of the rectangle to some value based on sin(runtime * small_number) to simulate sun rise and set
Draw the flashlight sprite (which is just a white spot with transparency) over the rectangle using Additive blending
Convert the result to a texture and draw it over the gameplay screen with Multiply blending
Relic Hunters Zero Clone is, well, a clone of Relic Hunters Zero… kind of. It uses the same assets, at least. This was a university group project – my responsibility was to develop the player and weapons for the game, and also manage/guide the project’s development as the product owner. It is a complete game which features 4 distinct levels, multiple enemy types, multiple weapon types, pick-ups, lives, and even multiple screens – title screen, main menu, options, credits, and more!
The player can move, shoot, and even dash in any direction to escape any sticky situation. You may also equip up to 2 of any weapon in the game and swap them at any time with weapons found within supply crates in the game world. You have 100 health and 3 lives to get through all 4 levels of the game, and health can be restored with health packs dropped by enemies. I also implemented the collision response with the map, preventing the player from entering walls.
There are 3 types of weapon in the game: the Pistol, Rifle and Shotgun. Each weapon has its own unique firing behaviour properties such as damage, ammo, and sounds. Weapons have limited ammo which can be refilled by obtaining ammo pick-ups dropped by enemies throughout the game. Each weapon has a unique magazine size and amount of reserve ammo, and they can be reloaded at any time.
Phobos Settlement is a 3D graphical application that serves to demonstrate various 3D mathematics and techniques. The scene takes place on the surface of Phobos – one of Mars’ two irregular moons – using a skybox generated with SpaceEngine and multiple NASA 3D models.
The scene is constructed using Hieroglyph’s hierarchical scene graph, animated using simple procedural animation. The satellite dishes in particular exploit the hierarchical properties to “point at” an object above – the dish is attached to the stand, which is attached to the base. The stand’s yaw rotations towards the object are inherited by the dish, which then performs an additional pitch to lock on to the target.
The entire scene is lit with a single rotating point light using the blinn-phong reflection model. The ground makes use of a normal map to create the illusion of depth on the craters.
On the right hand side of the screen, there is a custom 2D GUI panel with buttons, sliders and a checkbox to adjust some camera and scene properties. The “Launch!” button starts a countdown sequence which will cause the shuttle to close its latches and take-off!
The timescale can be adjusted to slow down or completely stop all animation in the scene. The checkbox can be toggled to reveal additional scene information on the left side of the screen.
Air Superiority Combat II (ASCII) is a simple side-scrolling shooter game that gets progressively harder over time. The game takes place in the skies, where the player takes control of a spitfire and must destroy all enemy planes emerging from the right side of the screen. Every time a plane reaches the left side of the screen, the player loses a life.
ASCII makes full use of the 4-bit colour palette available in the Windows console. Sprites are defined by 2D arrays of CHAR_INFO structs, which are basically the console’s version of pixels. Usually, each sprite would have to be typed out manually, specifying the foreground and background colours for each pixel. However, knowing that this would take a lot of time, I made it possible to load 24-bit TGA images and convert them in to CHAR_INFO buffers, making a best approximation for each pixel.
This saved a lot of time for this assignment – without this feature, it would be impractical to make use of colourful sprites.
The player has 3 lives, indicated by the symbols at the top of the screen. A life is lost whenever an enemy plane reaches the left side of the screen, or the player is destroyed.
There are 3 enemy variants with different properties such as speed, fire rate, health, and appearance. Part of the game’s difficulty is more frequent and more powerful planes appearing over time. Every plane has a red health bar positioned above the sprite.
Score is earned every time an enemy plane is destroyed and displayed at the top left. The goal of the game is to last as long as possible.