1st Year University AssignmentWritten in C++, uses OpenGL for 3D drawing and SDL 2.0 to setup the window.
Inspired by the classic Resident Evil games, I wrote a simple game engine that supported 3D characters imposed on 2D backgrounds.
- 3D model loaded from .md2 files.
- Keyframe animation – Animations are stored in .md2 files, which stores discrete keyframes for each vertex. When the animation is played back it interpolates between each frame, resulting in very smooth animation from very few extreme key poses.
- Respond to input by moving around the world.
- Collision detection with other scene objects
- Split into two plates, the foreground and the background.
- The background exists behind all scene objects.
- The foreground exists in front all scene objects.
- Stored as a single texture, an alpha mask stores the shape of the foreground.
- Boundaries are stored as a collection of axis-aligned bounding boxes, which allow me to use trivial collision detection algorithms.
- Custom scene format, an example scene:
//bbox <Xmin> <Ymin> <Zmin> <Xmax> <Ymax> <Zmax> bbox 3.0 0.0 19.0 9.0 8.0 20.0 bbox -6.0 0.0 -6.0 9.0 8.0 -5.0 bbox 9.0 -0.0164255062501 -5.0 10.0 7.98357449375 19.0 bbox -6.0 0.0 1.0 3.0 8.0 19.0 bbox -7.0 0.0 -5.0 -6.0 8.0 1.0 //camera <pitch> <yaw> <roll> <offsetX> <offsetY> <offsetZ> <fov> <bgID> camera 201 10 -1 8 -4.25 -3.75 90 1 camera 165.86164727 14.7783720734 -180.0 8.36204056916 7.0816941713 -3.26673637968 90 2 //bg <bgID> <BackgroundFileName> bg 1 BG_01a.tif bg 2 BG_01b.tif //trigger <Xmin> <Ymin> <Zmin> <Xmax> <Ymax> <Zmax> <bgID> trigger -7.0 0.0 -5.0 -6.0 8.0 1.0 1 trigger -7.0 0.0 -5.0 -6.0 8.0 1.0 2 // spawn x y spawn 6.06203493234 0.0 16.9122482543 //exit <offsetX> <offsetY> <offsetZ> <roomFileName> exit 8.36204056916 7.0816941713 -3.26673637968 nextRoom exit 8.36204056916 7.0816941713 -3.26673637968 nextRoom
Some planned features were not implemented on time.
- Correct the player collision behaviour so they stop when colliding with the scene boundaries.
- Add enemies to interact with.
- Add an inventory system.
- I attempted to load camera settings directly from Autodesk Maya, but ran into problems converting the Maya transform matrices to work correctly with OpenGL. The field of view also failed to match correctly, currently all example rooms use manually set camera positions/rotation and do not match the backgrounds. (The basement background shown in the example is borrowed from Resident Evil 2 for display purposes).