Rookie Awards 2024 - Open for Entries!
Space War
Share

Space War

Damien Le Mâl
by DamienLeMal on 9 Jun 2022

An ASCII game made in C where you travel space and fight other ship.

0 318 0
Round of applause for our sponsors

Space War

A text game inspired by FTL made in C with ASCII graphics

About the game

This game was made as an assesment for our programming class, I was mainly inspired by FTL which I was playing at the time. The game is unfinished because it still lack content but all the systems are present.

Gameplay

Orientation

The first thing you do in the game is to choose where you are going, as you can see on the map, different color indicate different environments that will determine what kind of encounter you will face and will also have an impact on gameplay during combats.

Encounters

After traveling to a new place, you will be faced with different scenarios where you'll have to choose what action to take and be rewarded with goods or access to the market, or be punished and forced into battle depending on the scenario.

Combats

Combat is turn-based and inspired by old rpg games. Every move you make cost energy but only a few is restored each turn ! 
Different weapons can be bought in the market, each with different attack, precision, number of shot and energy cost.

The environement also has an impact on the battle; in deep space, the lack of sun decreases the amout  of energy restored; in an asteroid field, every ship has a chance to take damage at the end of a turn; so on and so forth...


Programming

Gameplay

The game is coded in C and so I used many struct type to organise my code, such as for the Ship struct that is used for both the player and the ennemies' ship.

And the declaration of the ships look like this :

The game is made using lots of while and for loops, the structure kind of look like this :

Graphics

The biggest challenge though, was to draw an interface in a command-line interface.
Every time the game recieve an input from the player, it has to clear the console and redraw everything while taking account for the player input.

For that purpose, many functions are dedicated only to draw ASCII character. At first, we always start by displaying the header with the player's hp and shield, then we either call the PrintMenu function or the Display function that draw the graphics like spaceship and background with color.

Both use an index system that allow for scalability with ranges of indexes specially assign to every kind of displays.
For instance, the menus are defined as :

0 -> nothing
-1 to 30 -> Weapons
31 to 100 -> Systems
101 to 130 -> Weapons Stats


Comments (0)

This project doesn't have any comments yet.