Skip to content

🎮🤖🧿 Simple 3D step-based game in C++20 using SDL2 & OpenGL, like a 3D Pac-Man. Also can run in Web browsers using Emscripten & OpenGL ES 3.0 (WebGL 2.0).

License

Notifications You must be signed in to change notification settings

esotericpig/EkoScape

Repository files navigation

EkoScape

EkoShot

itch.io Latest Release Source Code License

EkoScape is a remake of an old game I made back in 2004 (with minor edits in later years) using my friend's 3D step-based engine: The Dantares Engine by Ryan Witmer. You can find the original code in relics/.

Back then, I made it for Windows only. In 2024, I re-wrote the code for it in SDL2 (multi-platform) using modern C++20. However, it still uses The Dantares Engine and legacy OpenGL 2.0+, as homage to the original game and engine.

Playing

Requirements:

  • Linux x86_64
    • glibc >= 2.14 (Ubuntu >= 22.04 or Fedora >= 16)
    • Might need FUSE for running the AppImage -- usually already installed.
  • macOS arm64 or x86_64
  • Windows x64

You can download the game on itch.io or from the latest release on GitHub.

Then simply run it in the same folder containing the assets folder.

You can edit the Map files in assets/maps/ or make your own! See assets/maps/README.md for more details, which also includes how to submit your Map files for the next version.

Linux Notes

A Desktop Entry file is provided if you wish to integrate it with your DE (Desktop Environment). Open the provided file, com.github.esotericpig.EkoScape.desktop, in a text editor to read more details or read online here.

Contents

Hacking

This project uses CMake, Ninja, and vcpkg. Please install these for your system.

See the GitHub Workflows or the top of CMakeLists.txt for quickly getting started.

If you have Ruby installed, there is also a script, scripts/dev.rb, for rapid development.

IDEs

  • CLion
    • CMake Profiles are included. You'll need to edit them in the IDE to change the env var VCPKG_ROOT=/path/to/vcpkg appropriately.

Configuring Build

Platform-specific notes:

The following command will be very slow the first time you run it, as it downloads the packages from vcpkg. Also, it downloads & extracts additional Assets to the assets/ dir (only if assets/images/EkoScape.png doesn't exist).

cmake --preset default

For various params, see the GH Workflows or the vcpkg docs.

Examples:

# Linux
cmake --preset default \
      -DVCPKG_TARGET_TRIPLET="x64-linux" \
      -DVCPKG_BUILD_TYPE=release \
      -DLINUXDEPLOY_ARCH="x86_64" \
      -DPKG_SUFFIX="-x86_64"

# macOS
cmake --preset default \
      -DBUILD_SHARED_LIBS=OFF \
      -DCMAKE_OSX_ARCHITECTURES=arm64 \
      -DVCPKG_OSX_ARCHITECTURES=arm64 \
      -DVCPKG_TARGET_TRIPLET="arm64-osx" \
      -DVCPKG_CRT_LINKAGE=static \
      -DVCPKG_LIBRARY_LINKAGE=static \
      -DVCPKG_BUILD_TYPE=release \
      -DPKG_SUFFIX="-arm64"

# Windows (PowerShell)
cmake --preset default `
      -DBUILD_SHARED_LIBS=OFF `
      -DVCPKG_TARGET_TRIPLET="x64-windows-static" `
      -DVCPKG_CRT_LINKAGE=static `
      -DVCPKG_LIBRARY_LINKAGE=static `
      -DVCPKG_BUILD_TYPE=release `
      -DPKG_SUFFIX="-x64"

To see the list of vcpkg Triplets, you can use the unofficial-official hack:

vcpkg install sdl2 --triplet=""

Building

Build for Release or Debug:

cmake --build --preset default --config Release
cmake --build --preset default --config Debug

This defaults to 5 parallel jobs. Instead, you can either use the preset no-jobs (which uses the max on Ninja) or use the -j option:

cmake --build --preset no-jobs --config Release
cmake --build --preset default --config Release -j 1

Running

Run from the top-level directory (for the assets/ folder).

cmake --build --preset default --config Release --target run
cmake --build --preset default --config Debug --target run

Or run directly:

./bin/Release/EkoScape
./bin/Debug/EkoScape

Checking Code Quality

Must have cppcheck installed.

cmake --build --preset default --config Release --target check

Building Linux AppImage

This automatically downloads linuxdeploy if it doesn't exist.

cmake --build --preset default --config Release --target appimage

# Test running it:
./build/AppImage/EkoScape-x86_64.AppImage

If your platform is not x86_64, you'll need to change which linuxdeploy to use. See the ones available here.

rm -r build

# aarch64, armhf, i386
cmake --preset default -DLINUXDEPLOY_ARCH=aarch64

cmake --build --preset default --config Release --target appimage

Packaging Up

When configuring, optionally add a suffix for the filename:

cmake --preset default -DPKG_SUFFIX="-x64"

Now run the below target. This target uses --install & CPack to package up the files. Currently, Release is always used, even if you specify differently.

cmake --build --preset default --config Release --target package

Miscellaneous

While playing the game, press F3 to see the FPS in the top left. The game is capped at 60 FPS and has VSync enabled.

There are various scripts in the scripts/ folder for development, but not necessary, just for convenience.

New Release

Optionally, to update dependencies, update your vcpkg clone and then run vcpkg x-update-baseline in this project's folder. Clean any build folders and then test building & playing the game.

With the GH CLI installed, run this script to download all Workflow Artifacts to build/artifacts/:

./scripts/get_artifacts.sh

On Linux, to test the Windows icon in the exe (after downloading), you can use wine explorer and then navigate to the folder to check it out.

Create a new release:

gh release create --draft --generate-notes v2.0 build/artifacts/*

Code Notes

In the beginning, I rewrote the original code for fun using SDL2 and modern C++ in a couple of days. Having enjoyed the process, I decided to flesh it out into multiple, generic files, while adding a menu and a lot of extra stuff, which took over a month.

The code is a bit over-engineered, but I designed it so that I could use parts of it in other projects. I was planning to make a simple ECS, but because the game is quite simple and the ECS code produced more files/lines of code, I decided to just stick with the original class-based structure.

Initially, src/cybel was named src/core, but I decided to make it into its own Game Engine (kind of). I then put it in its own namespace, called cybel. Because of this, I simply use using namespace cybel inside of the ekoscape namespace, as I didn't like putting cybel:: everywhere.

Credits

License

Due to The Dantares Engine being licensed under GPL, I also had to license this game under GPL. However, I might extract my Cybel Engine out (doesn't depend on The Dantares Engine) and place it under a more permissive license (like LGPL or MIT), but probably no one cares to use it anyway.

GNU GPL v3+

EkoScape (https://github.com/esotericpig/EkoScape)
Copyright (c) 2004, 2024 Bradley Whited

EkoScape is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

EkoScape is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with EkoScape. If not, see https://www.gnu.org/licenses/.

About

🎮🤖🧿 Simple 3D step-based game in C++20 using SDL2 & OpenGL, like a 3D Pac-Man. Also can run in Web browsers using Emscripten & OpenGL ES 3.0 (WebGL 2.0).

Topics

Resources

License

Stars

Watchers

Forks