Skip to content

Walk around a 3D world rendered with raycasting

Notifications You must be signed in to change notification settings

jackwherry/raycast

Repository files navigation

Raycast

Walk around a 3D world rendered with raycasting

Game screenshot

Features:

  • Arbitrary wall geometry; not restricted to boxes
  • Sector and portal-based rendering with arbitrary floor and ceiling heights
  • Simple wall collision detection
  • Level files specified in JSON
  • Immediate mode GUI overlay (using Nuklear)
  • Level/map editor; modify map geometry while the game is running
  • Visual effects with color and gradients
  • Runs at 60 frames per second using software rendering (even on a 12-year-old ThinkPad X220)

Inspired by https://www.youtube.com/watch?v=fSjc8vLMg8c and https://www.youtube.com/watch?v=HQYsFshbkYw. Some renderer code and general structure modified from/insipired by this demo.

Building and running

macOS

Install SDL2 by copying the most recent DMG from here to /Library/Frameworks.

$ make
$ ./raycast

You may be able to use the Xcode build system if you'd prefer.

Linux

Install SDL2 with your distribution's package manager (or from source) and run make. You may need to modify the include or link flags in the Makefile.

Windows

The Makefile might work with MinGW similarly to how it does on Linux. You could also use the Visual Studio build system instead.

Third-party libraries used

I chose to include Nuklear and cJSON alongside my source code in this repository, so you won't need to download those in order to build this project. SDL is an external dependency.

About

Walk around a 3D world rendered with raycasting

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published