2D ski game (Intake Project). One of the first games I ever made.
Project Overview
This game was both my BUas intake project and my high school graduation project. I made it using the template provided by BUas and free assets that I got from itch.
Game Modes
- Slalom Mode: Players navigate a course, aiming to complete it as quickly as possible while passing on the correct side of flags.
- Off-Road Mode: Players strive to survive for as long as possible to achieve higher scores.
Procedural level generation
The map is grid-based. At first, I had a vector with all the tiles and I was adding and removing tiles from it as the player progressed which led to frequent memory allocations, impacting the performance.
To optimize, I implemented a system that tracks the "top row" and overrides it with new rows as the player progresses. This method reduced memory usage.
Since all tiles are using the same tilemap, I'm storing it as a static variable which saved me lots of memory too.
In Slalom Mode, flags are placed at intervals based on the difficulty level. In Off-Road Mode, increased difficulty results in more obstacles.
Each tile stores the terrain that it has and the object that is on it as an enum value. The object is chosen randomly with chances varying based on the selected difficulty. Based on the game mode there is also a chance for a random power-up (health or shield) to spawn.
If the chosen object is a tree, I have to check if the object above it is also a tree so that I can render it properly (different tiles for whether there are one or two trees).
The trees on both sides of the map are procedurally generated too.
2.5D
The rendering system draws the background and foreground layers first, followed by the player character. Objects are redrawn based on the player's position within the tile, allowing the player to move in front of or behind objects, creating a 2.5D effect.
Leaderboard
I have a text file for each mode-difficulty combination in which I store the top 10 scores. This allows me to easily retrieve the results and override them if needed. I chose to store them as plain text and not as a binary file, because I decided that readability is more important and it wouldn't have made a big difference.
Collisions
I'm using AABB collision detection