Thanks for the link, Richard! I have shading working:
The Wikipedia link that you provided served as a great starting point. The pseudocode in that article is not well-structured. (Talk about spaghetti code; Dykstra would throw a fit!) So, I did some poking around and found this:
I basically ported that to MakeCode Arcade. It’s a bit too slow, so I’m going to have to go with something a bit faster (even if it chews up additional memory). I’ll keep playing with this, though, to find an algorithm that balances efficiency for speed. For now, though, it does the job.
You’re all welcome to play in my current sandbox! The algorithm renders the dungeon from a tile map. You can walk around the dungeon with the arrow buttons, and you can pick the colors for the wall outlines and the wall textures. If you set the wall texture to zero, then you get a wireframe rendering (without the penalty of filling the polygons). Those three constants are at the top of the
main.js file. It even works on hardware!
Don’t mind the hidden
game.splash calls. Most of those were there to help me diagnose a problem when running the code on hardware (which I’ve since fixed).
Nota bene: Pathways can only be one tile wide right now. If you try to have pathways that are wider, I doubt highly that it will render properly.