Log In  

Hi everyone!
I got pico-8 yesterday and I am trying to learn lua.
for my first project I am trying to mod the raycasting demo to be a 3d platformer.
I got the running and jumping set to what I like, but I don't know how to set the map
so that it doesn't crash once it looks off the first screen in the editor. Any ideas?
I added a gif to show what it looks like. after the gif stops it means that my program crashes or
does not let me move, look, or jump in the game.

P#99690 2021-11-06 16:03

:: Numzyx

what does your raycaster code look like?
also, to clarify, crashes occur when a ray is cast and it never ends up hitting a wall? i've made a raycaster and encountered this same issue. there are a couple workarounds:
1: in the ray step routine, add a check to see if the ray steps outside the map area. if it does, stop stepping the ray and don't draw a vertical strip for that ray. will probably produce weird results if the ray starts outside the map area.
2: in the ray step routine, add a check to see if the ray is longer than a set threshold so the raycast can't take too long to find a wall. you'll probably need to figure out what a good maximum distance is and what to do if that maximum distance is reached.
3: silly solution that i used, just design the level to be completely enclosed so this never happens

P#99754 2021-11-07 20:21 ( Edited 2021-11-08 13:46)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-01-26 10:53:05 | 0.007s | Q:13