Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fun with Ray Casting
#1
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]


Attached Files
.zip   VoxelSpace.zip (Size: 26.27 MB / Downloads: 3)
.bas   raycaster.bas (Size: 12.67 KB / Downloads: 2)
Reply
#2
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
Reply




Users browsing this thread: 1 Guest(s)