Skip to content

Latest commit

 

History

History
110 lines (85 loc) · 4.61 KB

README.md

File metadata and controls

110 lines (85 loc) · 4.61 KB

068A source code dump

This is a dump of the source code for the engine, graphics tool and player for 068A, our 64k demo released at Syntax 2017. It's been updated to fix a couple of minor things that have broken since release, but for the most part is identical to what we showed in the breakdown video with Ferris.

Goals of this dump:

  • You should be able to build and run a fully-functional demo and toolset.
  • You should be able to explore the code in this repo and maybe learn some things about how we built it.

To that end, we will accept pull requests and issue reports that help us achieve these goals. Other PRs and issues will not be accepted. For instance, a PR to fix a crash when starting the player is fine, but a PR that replaces part of our post-processing stack or fixes a synth bug is not.

Building

You'll need a 32-bit copy of mingw-w64. The MingW-W64-builds package works fine. Make sure to install the 32-bit version!

The demo is built with CMake. The Debug build plays an audio file, loads shaders from disk, supports live reloading and connecting to a Rocket compatible editor for sync-tracking. The Release build bundles up a synth, shaders and tracks into an optimized executable that plays the demo from start to end and can be krunched to around 50kb.

For example, to create a Debug build:

  • Create a folder at tool/cmake-build-debug
  • Inside that folder in the MinGW environment, run the following commands:
    > cmake -DCMAKE_BUILD_TYPE=Debug -G "MinGW Makefiles" ..
    > cmake --build . --target tool
    

And to create a Release build:

  • Ensure the Debug build has run at least once to generate the export blob - see the section below on running the tool.
  • Create a folder at tool/cmake-build-release
  • Inside that folder in the MinGW environment, run the following commands:
    > cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" ..
    > cmake --build . --target tool
    

Running the tool

The Debug build of the demo which is sometimes referred to as the "tool", has a few differing features from the Release build:

  • Playback and animations are all handled by the Rocket library and a compatible editor. I used emoon's editor mainly for folding and grouping support, which is included as rocket.exe in the repo.
  • Audio is played from a file instead of being generated by the executable. You can swap out audio.ogg in the repo with your own audio file to use different music.
  • Shaders are loaded from disk, can include other shaders, and support live reloading. Shaders are also validated with glslang before being compiled.
  • There's a "free camera" mode that allows you to fly around and experiment with different angles, focal lengths, etc.
  • The tool has a performance meter and debugging tools for textures and lights.

Before running the tool, make sure to open your Rocket editor and load the TRACKER.rocket file to import the tracking data used for the demo.

To use the "free camera" mode, click anywhere in the tool outside the debug windows. You can now use the following controls:

  • W/A/S/D to move around, Space to fly up and Ctrl to fly down, Shift to move faster.
  • Q/E to roll the camera left and right, R to reset roll and FOV.
  • Scroll wheel to adjust FOV.
  • P to print the camera position and direction to the debug console.
  • Escape to leave free camera mode and reset the camera to the tracker's settings.

When closed, the tool generates a binary blob of shaders and tracking data to be packed into a Release build. This is placed in ../player/export.cpp relative to the tool's current directory, which should Just Work if you run the tool from tool/cmake-build-debug.

Known issues

  • The rover doesn't show in Debug builds. It might just be in some weird place since the tracks aren't showing either.
  • Release builds seem to be overwriting the coloured output with the ambient occlusion channel.

License

The demo code is provided under the MIT license. It contains code from Rocket which is provided under the zlib license.

glslang is licensed under the 3-clause BSD license.

emoon's Rocket editor is provided under the zlib license.

Un4seen Developments' BASS audio library is used under a free for non-commercial use license.