less_retarded_wiki/raycastlib.md
2024-10-07 14:24:18 +02:00

3.3 KiB

Raycastlib

Raycastlib (RCL) is a public domain (CC0) LRS C library for advanced 2D raycasting, i.e. "2.5D/pseudo3D" rendering. It was made by drummyfish, initially as an experiment for Pokitto -- later he utilized the library in his game Anarch. It is in spirit similar to his other LRS libraries such as small3dlib and tinyphysicsengine; just as those raycastlib is kept extremely simple, it is written in pure C99, with zero dependencies (not even standard library), it's written as a single file single header library, using no floating point and tested to run interactively even on very weak devices (simplified version was made run on Arduboy with some 2 KiB of RAM). It is very flexible thanks to use of callbacks for communication, allowing e.g. programming arbitrary "shader" code to implement all kinds of effects the user desires or using procedurally generated environments without having to store any data. The library implements advanced features such as floor and ceiling with different heights, textured floor, opening door, simple collision detection etc. It is written in just a bit over 2000 lines of code.

The repository is available at https://git.coom.tech/drummyfish/raycastlib. The project got 45 stars on gitlab before being banned for author's political opinions.

................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
...........XXXXXXXXXXXX/..........XXXXXXXXXXXXXXXXXXXXXX.......................o
...........XXXXXXXXXXXX////.......XXXXXXXXXXXXXXXXXXXXXX......................oo
XXXXXXXXXXXXXXXXXXXXXXX//////.....XXXXXXXXXXXXXXXXXXXXXX...............ooooooooo
XXXXXXXXXXXXXXXXXXXXXXX/////////..XXXXXXXXXXXXXXXXXXXXXX........oooooooooooooooo
XXXXXXXXXXXXXXXXXXXXXXX//////////.XXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooooooo
XXXXXXXXXXXXXXXXXXXXXXX//////////XXXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooooooo
XXXXXXXXXXXXXXXXXXXXXXX//////////.XXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooooooo
XXXXXXXXXXXXXXXXXXXXXXX/////////..XXXXXXXXXXXXXXXXXXXXXX........oooooooooooooooo
XXXXXXXXXXXXXXXXXXXXXXX//////.....XXXXXXXXXXXXXXXXXXXXXX...............ooooooooo
...........XXXXXXXXXXXX////.......XXXXXXXXXXXXXXXXXXXXXX......................oo
...........XXXXXXXXXXXX/..........XXXXXXXXXXXXXXXXXXXXXX.......................o
................................................................................
................................................................................
................................................................................
................................................................................

Simple rendering made with raycastlib.