Title: Sweet Darkness
Author: James Gualtieri
Design Document: Sweet Darkness
Screen Shot:
How To Play:
The Goal of the game is to avoid the path of light, and stay in the shadows. The A and D keys move the plate in counter-clockwise or clockwise rotations respectfully (note: you will be stationary when the game begins, so act fast!). The movement of the light will rotate in one of these directions as well, but it will switch at random!
Avoid the light, stay in the darkness, and prevent yourself from melting. Your score will increase as time goes on, and if you spend too much time in the light you will melt. Once completely melted, the game will end.
Changes From The Design Document:
Game would have been really really easy if could move completely in 2-D space, so I changed the movement options to force the player to move either clockwise or counter clockwise in order to keep up with the shadow.
Good / Bad / Ugly Code:
Bad code: I spent so long trying to do the good way of the shadow buffer read stuff and copped out for the angle-based implementation I made to test early on.
But I think it looks nice?
The meshes/export-meshes.py
script can write mesh data including a variety of attributes (e.g., positions, normals, colors, texcoords) from a selected layer of a blend file:
blender --background --python meshes/export-meshes.py -- meshes/crates.blend:1 dist/crates.pnc
The meshes/export-scene.py
script can write the transformation hierarchy of the scene from a selected layer of a blend file, and includes references to meshes (by name):
blender --background --python meshes/export-scene.py -- meshes/crates.blend:1 dist/crates.scene
The meshes/export-walkmeshes.py
script can writes vertices, normals, and triangle indicies of all meshes on a selected layer of a .blend file:
blender --background --python meshes/export-walkmeshes.py -- meshes/crates.blend:3 dist/crates.walkmesh
There is a Makefile in the meshes
directory with some example commands of this sort in it as well.
The runtime code has been set up to be built with FT Jam.
For more information on Jam, see the Jam Documentation page at Perforce, which includes both reference documentation and a getting started guide.
On unixish OSs, Jam is available from your package manager:
brew install ftjam #on OSX
apt get ftjam #on Debian-ish Linux
On Windows, you can get a binary from sourceforge,
and put it somewhere in your %PATH%
.
(Possibly: also set the JAM_TOOLSET
variable to VISUALC
.)
This code uses the libSDL library to create an OpenGL context, and the glm library for OpenGL-friendly matrix/vector types. On MacOS and Linux, the code should work out-of-the-box if if you have these installed through your package manager.
If you are compiling on Windows or don't want to install these libraries globally there are pre-built library packages available in the kit-libs-linux, kit-libs-osx, and kit-libs-win repositories. Simply clone into a subfolder and the build should work.
Open a terminal (or x64 Native Tools Command Prompt for VS 2017
on Windows), change to the directory containing this code, and type:
jam
That's it. You can use jam -jN
to run N
parallel jobs if you'd like; jam -q
to instruct jam to quit after the first error; jam -dx
to show commands being executed; or jam main.o
to build a specific file (in this case, main.cpp). jam -h
will print help on additional options.