Log In  

by smk
Cart #38109 | 2017-03-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
36

Purpose:
Learning pico-8.

Description:
A simple 2.5 renderer.

Features:

  • BSP-based, non-grid level rendering
  • lighting "fog"
  • 60 fps
P#32666 2016-11-21 04:28 ( Edited 2017-09-22 22:03)

Hi Smk,

This is great non-grid-based raycast code. Thanks for sharing!

I've been hacking at something like this for a while, trying to write a portal based engine, using this (http://bisqwit.iki.fi/jutut/kuvat/programming_examples/portalrendering.html) as a guide. However, your code and method for the basic wall rendering is far more stable, not to mention faster than what I have been coming up with.

Mind if I borrow some of your frustum clipping and rendering code?

Many thanks,
Electric Gryphon

P#32726 2016-11-23 20:59 ( Edited 2016-11-24 01:59)

Hey, no problems, sorry for late response.

I had another version somewhere that supported simple BSP (not sure if I uploaded it though).

P#37793 2017-02-24 19:17 ( Edited 2017-02-25 00:19)

electricgryphon dude this is NOT raycasting. This is 2d BSP. Doom used it first.

P#38242 2017-03-14 03:53 ( Edited 2017-03-14 07:53)

@smoke_th do you know who you replied to? electricgryphon is one of the pioneers of 3D on the PICO-8 and has spent the last 2 years making countless games, demos, libraries, and tutorials on the subject. Pretty sure he knows what's up. Raycasting and BSP are not mutually exclusive.

P#38245 2017-03-14 05:33 ( Edited 2017-03-14 09:34)

wow, really nice and fast!

P#38247 2017-03-14 07:40 ( Edited 2017-03-14 11:40)

So smooth!

Where can I go to start learning how to code this sort of thing? I'm constantly blown away by what people are able to create in Pico-8. I understand coding basics, but writing a renderer is so far beyond me. I wouldn't even know where to start.

What is this area of programming called? Are there some good resources I could check out to start learning?

P#38506 2017-03-21 10:17 ( Edited 2017-03-21 14:17)

@Scathe @smoke_th is right though, this code is not based on raycasting. It just transforms the walls (lines) so it's easy to cull them and judge the distances of their vertices from the camera, then interpolates them (vertical line by vertical line) with a perspective-perfect mapping. The BSP is used for culling the level - I draw from the closest to the farthest and count "drawn" lines, then proceed to the next node. If I run out of vertical lines, then there's no reason to traverse the tree any further.

It's a very simple system that I used in this JS demo as well (pure canvas, no WebGL): https://github.com/s-m-k/wolfendoom

@bugglesman Try reading about rendering techniques, about how Wolfenstein and Doom was done etc. You can read my code too, but the solution presented here is very simple. Might be useful for a pico-8 game though, since I believe it might scale pretty well with corridor-dense level design and it's simpler and more effective than raycasting.

P#38920 2017-03-31 14:44 ( Edited 2017-03-31 18:44)

Really cool. Can it do sectors of different heights? Because if not, it's just Wolf3d if Wolf3d didn't used grid system.

P#40990 2017-05-26 08:26 ( Edited 2017-05-26 12:26)

It can't, but the fact that it's not grid based makes it already a very different engine I believe.

P#42431 2017-07-13 12:47 ( Edited 2017-07-13 16:47)

Fantastic, I just started working on a new raycaster (I'm aware this isn't a raycaster, but similar 2.5 D idea anyway) in Pico-8. I keep wondering if it is possible to do fully texture mapped floors and ceilings as well as walls at 60fps, maybe not, but it'd be fun to try...

Thanks for the demo, something new to learn from.

P#42432 2017-07-13 13:28 ( Edited 2017-07-13 17:29)

No kidding, I'm starting with Pico-8 and this is like my end goal. It's simply amazing, great work!

P#44429 2017-09-22 04:56 ( Edited 2017-09-22 08:56)

Joining the chorus of n00bs - yup, that's why i started learning pico8, so that one day im able to build something like this! Thank you for sharing!

P#44456 2017-09-22 18:03 ( Edited 2017-09-22 22:03)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-19 04:11:27 | 0.028s | Q:38