Skip to content

Bleskocvok/frog-engine

Repository files navigation

frog-engine

Simple game engine in C++.

Build 2D Build 3D Tests coverage badge

Table of contents

Build examples

  1. Clone repository and install engine dependencies.

    git clone https://github.com/Bleskocvok/frog-engine.git
    cd frog-engine
    sh ./script/libraries.sh

    Folder game contains an example 3D game and folder game2d contains a sample of 2D game code.

3D example

  1. The build might need additional system packages installed: libgl1-mesa-dev, mesa-common-dev, libxrandr-dev, libxinerama-dev, libxcursor-dev and libxi-dev should cover it. These will be probably in your package manager's repository.

  2. It can be build by using the helper build script.

    sh ./script/build -o bin-game -b Release gen-build game
  3. Or by manually invoking cmake commands.

    cmake -S game -B bin-game
    cmake --build bin-game -j4
  4. To run the compiled example, execute the Game binary.

    ./bin-game/Game

2D example

  1. It can be build by using the helper build script.

    sh ./script/build -o bin-game2d -b Release gen-build game2d
  2. Or by manually invoking cmake commands.

    cmake -S game2d -B bin-game2d
    cmake --build bin-game2d -j4
  3. To run the compiled example, execute the Game binary.

    ./bin-game2d/game_2d

Folder structure:

1. Engine


  • ./engine/assets/ the engine assets such as shaders and font atlas

2. Game

  • ./src/ source files of the game

  • ./game_assets/ textures used in the game

  • ./bin-win/Game.exe and ./bin-lin/Game the resulting compiled game for Windows and Linux respectively

  • ./out/build/x64-Debug/Debug/Game.exe the resulting compiled game for Windows when compiled in Visual Studio

Notes

  1. The engine is wrapped in the namespace frog and individual components are separated into nested namespaces:

    • frog - core engine part
    • frog::geo - geometry & maths: matrix, vector, etc.
    • frog::gl - graphics stuff: rendering, mesh, mesh generation
    • frog::os - system stuff: window creation, events handling

  1. Font in ./engine/assets/font.png is based off of my own font from this repository

  2. The architecture used for the engine is inspired by Unity:

    • the engine follows this structure: engine -> scene_manager -> scene -> game_object -> script

Windows build instructions

a. Using Visual Studio 🤮

  • It should just work in VS 2019 (the C++ VS components need to be installed in VS Installer)

  • Make sure to select the desired target (Game.exe or game_2d.exe)

b. Using command line

  1. Install necessary tools: cmake, mingw64

  2. In PowerShell, enter the root folder of the project; If you perform the ls command, you should see files such as CMakeLists.txt, README.md, engine/, ...

  3. Make sure the folder bin-win is empty

  4. Call script/build.bat

  5. Pray that it works; if not, return to step 1. and try to reconfigure the installation of cmake or mingw

  6. If it worked, after it has finished you should be able to open bin-win/Game.exe, which starts the game

Misc

Originally made as a project assignment.

Link to the original repository pa199-project

Development tracking