Hello.
So the past few days or so I found myself increasingly interested in exploring
ray casting to create an old school 3D game.
I finally got around to it today. I looked at several different tutorials online and checked out source code for a few different implementations.
Finally, I found the source code for a very simple ray casting engine written in Blitz.
So I ported it over to AGK2. Then I made some improvements to the engine such as removing the "fish eye" problem and structuring the code to be cleaner.
I also added a lot of comments to the code to make it easier to follow.
What I found out is using the DrawLine command in AGK2 is not the way to do this. lol
Although it is fast enough on desktop to be used as the basis for a game when exported to HTML5 it is extremely slow.
I think for AGK2 we'd need to use sprites for all of the slices. The work involved in that however makes me think why not just use 3D to begin with? I think it would make more sense.
What could be done however is something I did long ago on the C64 where I had created a series of simple tiles and the player can move from block to block and the whole thing is quickly drawn.
I might try that for my next experiment.
Source code is attached to this post. It's very simple and should be very straightforward to follow especially with all of the comments I added.TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)