This commit is contained in:
Miloslav Číž 2018-10-01 17:05:12 +02:00
commit 3f360e1ed6

View file

@ -4,24 +4,52 @@ These are demos showing ray casting (pseudo) 3D rendering technique using
raycastlib (a Pokitto-independent C library I made along with this project) on raycastlib (a Pokitto-independent C library I made along with this project) on
a small gaming console Pokitto. a small gaming console Pokitto.
![](https://gitlab.com/drummyfish/raycastlib/raw/master/media/pokitto1.gif)
![](https://gitlab.com/drummyfish/raycastlib/raw/master/media/pokitto2.gif)
![](https://gitlab.com/drummyfish/raycastlib/raw/master/media/pokitto3.gif)
There are these demos: There are these demos:
- helloRay: Hello world program showing the very basic usage of raycastlib - **helloRay**: Hello world program showing the very basic usage of raycastlib
on Pokitto. If you want to learn about the code, start here. on Pokitto. If you want to learn about the code, start here.
- demo1: Showoff RPG-like program demonstrating most raycastlib features. - **demo1**: Showoff RPG-like program demonstrating most raycastlib features. Controls:
- demo2: Classic "flat/1D" ray casting program in a sci-fi mood. - arrows: move, rotate
- demo3: Minecraft-like demo with procedurally generated editable world. - A + arrows: strafe, look up/down
- B: jump
- C: toggle running
- **demo2**: Classic "flat/1D" ray casting program in a sci-fi mood. Controls:
- arrows: move, rotate
- A: strafe
- B: shoot plasma
- **demo3**: Minecraft-like demo with procedurally generated editable world. Controls:
- arrows: move, rotate
- A + arrows: strafe, look up/down
- B: jump
- C: toggle square editing (up/down: change height, left/right: change color)
Included are also other tools I created, such as Python scripts for image Included are also other tools I created, such as Python scripts for image
conversion to the format I use. Everything should be sufficiently commented. conversion to the format I use. Everything should be sufficiently commented.
The last three demos use common definitions from the general.hpp file. This The last three demos use common definitions from the *general.hpp* file. This
file contains some useful resources that you can use in your own game. You can file contains some useful resources that you can use in your own game. You can
of course as well create a game by expanding any of the demos. of course as well create a game by expanding any of the demos.
There are a lot of compile-time options you can try out, like turning various There are a lot of compile-time options you can try out (especially in demo2),
effects on/off, setting the rendering quality etc. Check out the defines at like turning various effects on/off, setting the rendering quality etc. Check
the beginning of each source code file. out the defines at the beginning of each source code file.
The biggest impact on performance comes from per-pixel operations, so try to
keep the `pixelFunc` as fast as possible. Turn unneeded raycastlib features off
with given defines.
The most effective way of increasing FPS is subsampling -- that means decreasing
horizontal resolution -- it looks uglier, but still very okay as the vertical
resolution still stays the same. You can do this by defining `SUBSAMPLE` to a
specific value (1 = full resolution, 2 = half resolution etc.) **before**
including *general.hpp* header. You can also cut the resolution by e.g. adding
an info bar to the screen (it's better to add a vertical bar to the screen side
as that will also reduce the number of rays cast).
This repository contains the version of raycastlib that I tested the demos This repository contains the version of raycastlib that I tested the demos
with, but you can find the most recent version of the library among my other with, but you can find the most recent version of the library among my other