Or you could just look at the spooky maze code. The author kindly made a raycating library to help you make your own 3D-ish games. Doom actually uses something else called a BSP tree. Not sure if you can do that in SmileBasic with no pointers, but it allows for non-grid geometry. However it wasn't really 3D either, but Quake was.