Skip to content

adrian-javid/maze_engine

Repository files navigation

Maze Engine

It is a program that generates and solves mazes.

It generates a maze based on a seed, then displays a window displaying a specified search algorithm solving the maze in real time.

Running

The executable is in the build directory.

Run with help to see the program's parameters.

# Windows release build
.\build\Windows\release\run\maze_engine.exe help

# Windows debug build
.\build\Windows\debug\run\maze_engine.exe help
# Linux release build
./build/Linux/release/run/maze_engine help

# Linux debug build
/build/Linux/debug/run/maze_engine help

Building

To build, you need to install the neccessary dependencies for your platform.

Running scons on the command-line will build the default target, which is the release build for your native platform, build/<platform>/release/run/maze_engine<file_extension>.

To build all available targets—including the test suite and the JSON compilation database—run scons . on the command-line.

The test suite executable is put at build/<platform>/<build_type>/run/test_suite<file_extension>.

The JSON compilation database is put at build/<platform>/<build_type>/compile_commands.json. You can configure Visual Studio Code to use this database with the Microsoft C++ extension, for example:

.vscode/c_cpp_properties.json

{
	"configurations": [
		{
			"name": "Win32",
			"compileCommands": "build\\Windows\\debug\\compile_commands.json",
			"cStandard": "c17", "cppStandard": "c++17"
		},
		{
			"name": "Linux",
			"compileCommands": "build/Linux/debug/compile_commands.json",
			"cStandard": "c17", "cppStandard": "c++17"
		},
		{
			"name": "emscripten",
			"compileCommands": "build/web/release/compile_commands.json",
			"cStandard": "c17", "cppStandard": "c++17"
		}
	],
	"version": 4
}

Also, if you would like to build a specific file, you can run scons <file> where <file> is a file you want to build. For example, to build only the compilation database for the debug build on Windows, you would run scons .\build\Windows\debug\compile_commands.json.

To clean the build, run scons -c or scons -c ., for the default target or all targets, respectively.

Note: If you want to move the Windows executable maze_engine.exe to a different location, move SDL2.dll along with it to the same directory. The executable needs that dynamic-link library to run.

Dependencies

C++ Compiler

The following are the C++ compilers that can build successfully for each platform. Other untested C++ compilers may work.

C++ Compiler for Windows

The Windows build uses the command-line toolset from the Build Tools for Visual Studio.

C++ Compiler for Linux & Unix

This project builds with g++.

Build System: SCons (Software Construction)

This project uses SCons as its build system, so Python is required to build it.

SCons and other Python dependencies are listed in requirements.txt at the root of the project. You can use pip to install them.

SCons for Windows

py -m pip install --requirement requirements.txt

SCons for Linux & Unix

python3 -m pip install --requirement requirements.txt

SDL (Simple DirectMedia Layer)

This project requires SDL. The method of downloading SDL depends on the platform.

SDL for 64-bit Windows

Run the fetch_libraries.py Python script from the root of the project to fetch the SDL2 library for Windows. This script fetches and unpacks the main SDL2 library from the SDL releases on GitHub and the SDL2 Mixer library from the SDL Mixer releases on GitHub.

py fetch_libraries.py

SDL for Linux & Unix

These commands are copied from the official SDL installation guide.

Debian-based systems (including Ubuntu):

sudo apt-get install libsdl2-dev

Red Hat-based systems (including Fedora):

sudo dnf install SDL2-devel

Gentoo:

sudo emerge libsdl2

About

Program that generates and solves mazes.

Resources

Stars

Watchers

Forks

Languages