MCPcopy Create free account
hub / github.com/atraczyk/2d-engine

github.com/atraczyk/2d-engine @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
340 symbols 648 edges 43 files 10 documented · 3% updated 5d ago★ 2403 open issues

Browse by type

Functions 276 Types & classes 64
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Requirements

  • Windows, Linux, or macOS
  • Git
  • CMake 3.15 or later
  • A C++ toolchain for your platform
  • Internet connection (for first-time build)

Description

A 2D platform game engine with:

  • (static/dynamic/sloped) tile and sprite collision resolution
  • Keyboard/mouse/joystick support for game and menus

A map editor to edit:

  • 3 layers:
  • background
  • foreground
  • collisions (optional)

Building the Project

Quick Start (Windows)

  1. Clone the repository: bash git clone https://github.com/yourusername/2d-engine.git cd 2d-engine

  2. Run the build script: bash build.bat

The script will automatically: - Install vcpkg if not present - Set up the build environment - Build the project in Release mode

The executable will be available in build/engine/Release/.

Quick Start (Linux/macOS)

./build.sh

The executable will be available in build/engine/.

Manual Build

If you prefer to build manually:

  1. Install vcpkg: bash git clone https://github.com/microsoft/vcpkg.git cd vcpkg # Windows: ./bootstrap-vcpkg.bat # Linux/macOS: ./bootstrap-vcpkg.sh

  2. Set the VCPKG_ROOT environment variable to your vcpkg installation path

  3. Create and enter a build directory: bash mkdir build cd build

  4. Configure and build: bash cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release

Runtime Resources

  • Runtime assets live under resources/.
  • The executable searches in this order:
  • ENGINE_RESOURCE_ROOT
  • executable-adjacent resources/
  • repo-local resources/
  • legacy relative paths

Controls

Game

  • Movement: Joy hat, W/A/S/D
  • Run: Joy button 2, M
  • Jump/Swim: Joy button 0, N
  • Attack: Joy button 3, Y
  • Unlock camera: T
  • Move camera: Up/Left/Down/Right
  • Menu toggle: Joy button 7, Space, RightClick
  • Menu select: Joy button 0, Return, LeftClick
  • Quit: Escape, joy button 6
  • Fullscreen: F1
  • Decrease size: J
  • Increase size: K
  • Slow/Fast: Joy button 4 / joy button 5
  • Layers toggle: 1-7
  • Debug: F2
  • Show collisions: F3
  • Show hit boxes: F4
  • Doublebuffer: F6
  • Bilinear and scan lines: F7
  • Curvature: F8
  • Adjust curvature: 8 / 9

Editor

  • Move camera: W/A/S/D, RightDown drag
  • Select: LeftClick
  • Paint: LeftControl + LeftClick
  • Edit front: M
  • Edit back: N
  • Edit collisions: C
  • Edit image: V
  • Draw front: 1
  • Draw back: 2
  • Draw collisions: 3
  • Fullscreen: F1
  • Decrease size: J
  • Increase size: K
  • Doublebuffer: F6
  • Quit: Escape, joy button 6

Core symbols most depended-on inside this repo

Shape

Method 210
Function 66
Class 56
Enum 8

Languages

C++99%
Python1%

Modules by API surface

engine/src/game.cpp42 symbols
engine/src/input.cpp31 symbols
engine/src/entity.cpp25 symbols
engine/src/tile.h24 symbols
engine/src/event.h21 symbols
engine/src/vector.cpp16 symbols
engine/src/entity.h16 symbols
engine/src/sound.cpp13 symbols
engine/src/rectangle.cpp12 symbols
engine/src/utils.cpp11 symbols
engine/src/program.cpp11 symbols
engine/src/tile.cpp9 symbols

For agents

$ claude mcp add 2d-engine \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page