Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 2.92 KB

File metadata and controls

68 lines (48 loc) · 2.92 KB

KFighter physics engine

KFighter screenshot

The rigid-body physics engine for the unfinished game 'KFighter'.

About

It's written from scratch in C++ but it may as well be in C since it uses so few of C++ features. It's currently Windows only but it's designed to be extended to other platforms in the future. I started it by following a tutorial by the brilliant Casey Muratori. The physics engine is based off talks done by Erin Catto of Box2D fame and works by iteratively solving a set of constraints.

Features

  • Collision detection and resolution
    • Rectangle collision
    • Friction
    • Collision islands (collections of objects typically connected by joints or other constraints that shouldn't collide with each other)
    • Multiple collision points
    • Stable stacking
  • Joints
    • Angle constraints
    • Joint friction
    • PID controlled motors
  • Loop live code editing
  • Pose matching

Controls

  • Arrow keys: Adjust gravity
  • Space bar: Cycle poses
  • Escape: Quit
  • [,]: Increment/decrement random seed
  • L: Cycle key recording; cycle between the following three actions: begin recording, end recording and begin playback, and end playback
  • R: Reset game (keeping the seed the same)

How to run

You will need:

  • Windows 7 or later (only tested on Windows 10, may work on older versions).
  • Visual Studio build tools 2015 or later (may work on earlier versions)

Instructions:

  1. Download this repo as a zip (or clone it)
  2. Run kfighter\build\win32_kfighter.exe

Directories

How to build

You will need:

  • Windows 7 or later (only tested on Windows 10, may work on older versions).
  • Visual Studio build tools 2015 or later (may work on earlier versions)

Instructions:

  1. Download this repo as a zip (or clone it)
  2. Open kfighter\code\build.bat in a text editor
  3. Change the second line: pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\" to be inside the directory of your version of Visual Studio
  4. cd kfighter\code
  5. Run build.bat