QB64 Phoenix Edition
Fun with Ray Casting - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26)
+---- Forum: a740g (https://qb64phoenix.com/forum/forumdisplay.php?fid=56)
+---- Thread: Fun with Ray Casting (/showthread.php?tid=3372)



Fun with Ray Casting - a740g - 01-13-2025

It all started with this post.

This is an implementation of the Voxel Space ray casting in QB64-PE. The algorithm is explained here.

You'll need QB64-PE v4 to compile and tinker. This is just a demo, not a complete game. At best, it can be called a walking simulator. Big Grin

The demo is configured to best perform for my Ryzen 5600x system. If you see low FPS, tweak the RENDER_DISTANCE and RENDER_DELTA_Z_INCREMENT constants at the top of the source code.

Code: (Select All)
CONTROLS:

KEYBOARD:
   FORWARD:        W / UP
   BACK:           S / DOWN
   STRAFE LEFT:    A
   STRAFE RIGHT:   D
   TURN LEFT:      LEFT
   TURN RIGHT:     RIGHT
   NEXT MAP:       SPACE

MOUSE: MOUSE LOOK

Mouselook may be broken on Linux because of how _MOUSEMOVEMENTX/Y is implemented in QB64. We'll fix this soon.

Have fun. Cheers!

[Image: Screenshot-2025-01-13-063920.png]

Adding my original solid-wall RayCaster here for completeness. I'll keep posting other ray-casting-related stuff in this thread in the future.

[Image: Screenshot-2025-01-13-063807.png]


RE: Fun with Ray Casting - Bhsdfa - 01-13-2025

Code: (Select All)

Type Player
    position As Vector2f
    height As Single
    camera As Camera
End Type


I didn't know that making a type variable as a type was even possible :o