Super Mario Kart clone using C++ with SFML
Authors: Diego Royo, Víctor Martínez and Javier Giménez
Süper Mario Kart is an C++ implementation of Super Mario Kart, a kart racing video game developed and published by Nintendo for the Super Nintendo Entertainment System in 1992. The purpose of this project is to understand the basic components of a real videogame. The authors do not aim at any commercial profit and release the source code for the general public under GPLv3 license.
Pre-built binaries (Windows-only) of Süper Mario Kart are available for download in any of the following:
You can take a look at the controls (and change them as you like!) in the "Controls" section of the Start Menu.
Each vehicle has different properties. Please note that they also have some drawbacks, so choose carefully!
If you start to accelerate when the second traffic light comes on, you will start the race with a little boost of speed. Be careful, because if you accelerate prematurely, your motor may overheat too much and you could be incapacitated for a few seconds.
Getting coins is more important than it seems. Each increases your maximum speed, which makes a difference. There is a limit of 10 coins per player.
By turning for a while you can drift, allowing you to make sharp turns without
problem. Using the drift key (C
by default) you can enter "drift mode" much
earlier, giving you more control over your turns. This is especially useful in
100cc and 150cc modes.
If you take a very tight curve and think you are turning too much, you can
press the skid key (C
by default) one or many times. The jump causes you to
stop turning for a while, allowing you to open up your trajectory a bit
before continuing to skid.
On more complicated circuits, such as Bowser Castle 1 or Rainbow Road, it is a good idea to brake in curves. We also have to be careful with some objects, like the mushroom, since the speed boost can be difficult to control.
We have tested the game in Windows 10 and some Linux distributions. For building your own executable file, the following are needed.
We use MinGW32 (posix) 8.1.0 by MinGW-W64 for Windows and GCC 7.5.0 for Linux.
We use SFML 2.5.1 for graphics generation and audio playback.
We use OpenAl as cross-platform API for 3D audio.
Clone the repository:
git clone https://github.com/vmbatlle/super-mario-kart SMK
We provide a Makefile
to build the source and link needed libraries statically
(Windows only). Please make sure you have installed all required dependencies
(see section 2). Execute:
cd SMK/src
make -j8 release # change -j option according to your CPU threads
This will create a bin folder with compiled files and the executable super_mario_kart in the parent folder.
Some utils are provided for semi-automatic generation of new circuits. For this process the following requiremenst are expected:
generate_map.py
. Land types for Donut
Plains, Mario Circuit, Ghost Valley, Bowser Castle and Rainbow Road are already
implemented as invocation flags.python ./generate_map.py -f PATH_TO_ASSET -w WALL_TYPE_FILE -t CIRCUIT_TYPE
Then, base.txt
will be generated next to the asset file.
Example:
python ./generate_map.py \
-f ../assets/circuit/mario_circuit_2/base.png \
-w walls.png \
-t mario_circuit
python ./generate_floor_objects.py -f PATH_TO_ASSET -o OBJECTS_FILE
Then, objects.txt
will be generated in the same folder.
Example:
python ./generate_floor_objects.py \
-f ../assets/circuit/mario_circuit_2/objects.png \
-o floor_objects.png
racemanager.h
:CIRCUIT_DISPLAY_NAMES = {"name_of_the_circuit"};
CIRCUIT_ASSET_NAMES = {"path/to/circuit/folder"};
Example: Note: some aspects of the game (menus, etc.) are made with five circuits in mind (not six), so it's easier to swap your new circuit for an old one.
constexpr const int NUM_CIRCUITS = 5;
const std::array<std::string, NUM_CIRCUITS> CIRCUIT_DISPLAY_NAMES = {
"donut plains 1", "mario circuit 2", "ghost valley 1",
"bowser castle 1", "rainbow road",
};
const std::array<std::string, NUM_CIRCUITS> CIRCUIT_ASSET_NAMES = {
"assets/circuit/donut_plains_1", "assets/circuit/mario_circuit_2",
"assets/circuit/ghost_valley_1", "assets/circuit/bowser_castle_1",
"assets/circuit/rainbow_road",
};
Rebuild target (see section 2)
First time the new circuit is loaded gradient.txt
and position.txt
will
be generated from the base.txt
file.
Please, keep the folder tree as follows: