Old-school FPS raycast engine written in C++ and using SFML.
C++ CMake
Permalink
Failed to load latest commit information.
resources
.gitignore adding project files Feb 3, 2016
CMakeLists.txt Moved MapTile struct to separate class and source files Feb 15, 2016
Camera.cpp adding project files Feb 3, 2016
Camera.hpp adding project files Feb 3, 2016
Entity.cpp adding project files Feb 3, 2016
Entity.hpp adding project files Feb 3, 2016
LICENSE Initial commit Feb 2, 2016
Map.cpp added function to Map for loading data from an array of MapTile objects Feb 16, 2016
Map.hpp
MapTile.cpp
MapTile.hpp Moved MapTile struct to separate class and source files Feb 15, 2016
MapUtils.h adding project files Feb 3, 2016
README.md updated readme Feb 15, 2016
Raycaster.cpp
Raycaster.hpp refactored method names in Map class Feb 10, 2016
ResourcePath.hpp adding project files Feb 3, 2016
main.cpp Map now stores data as a single dimension array. Feb 15, 2016

README.md

sfray

Old-school FPS raycast engine written in C++11 and using SFML 2.3.

Please note that this is not a complete game or even really a game at all. This project focuses on the rendering engine for the raycasting. You can build off of this to add movement, combat and the other things that make a real game. The included example showcases how to do a few of these things.

Features

  • Ability to render walls, floors and ceilings as textures or colors
  • Rendering of sprite objects (Entity class)

Roadmap

These are things I would like to explore and try to figure out, when I have more time available to do so.

  • Walls with different heights
  • Animated entities
  • Animated walls and floors/ceilings
  • More rendering methods and options to give more choices to the developer as to where to cut corners

Resources

Check out my random Youtube videos that show sort of snapshots of the development of the engine:

And here is probably the absolute best tutorial for a starting place. Note: this tutorial was not done in SFML, but the basic idea is how this is done and what I based my version off of.

Example Program

The example program (located in main.cpp) shows basic usage. I've tried to clean it up and add comments.

Demo Features

  • Floor, ceiling and wall rendering methods
  • Toggle entity drawing on and off
  • Camera movement and collision
  • Overlay "gun" example (defaults to hidden, see keybindings to key to toggle it to visible).
  • Frames-per-second output to help debug performance gains/losses.

Keybindings

  • Arrow Keys: movement/rotation
  • Z: Cycle floor rendering method
  • X: Cycle ceiling rendering method
  • C: Cycle wall rendering method
  • V: Cycle entities on and off
  • B: Cycle overlay example on and off

Raycaster

Rendering Options

There are different rendering "options" for walls, floor, ceiling and entities.

Walls

  • None
  • Colored
  • Textured

Floor

  • None
  • Colored
  • Textured

Ceiling

  • None
  • Colored
  • Textured

Entities

  • None
  • Textured

License

The MIT License (MIT). See LICENSE for more info.