I love the masterpiece that is the Wolfenstein 3D port, done many years ago. So I have a couple of questions- did the coder use a combination of Mode7
and raycasting, or was there some other method used? Unfortunately, the source code wasn't shared for the port, so its secrets are kept tightly
wrapped.
The other question is, how would one go about achieving similar results? I can't wrap my head around the various raycasting tutorials for other
languages strewn around the 'net as they would compare to DIV. Thanks in advance if anyone can help.
Okay, well as far as I can tell, Adherbals Wolfenstein 3D remake uses two techniques. One for collisions, another for the walls themselves.
For the walls themselves - they are rows of narrow sprites. This is why they appear jagged at the edges, zig zagging sort of, it's because theyre
turning to face the camera when you move, as sprites do :p these sprites are so close together that you can't see between them, this is done in a long
row.
And for the collisions with those sprites - I believe it's likely to of been done using a hardness map. So, what this will mean is that the
player/camera process will constantly refer to a graphic stored in the memory every frame, and will check what colour is beneath it. This will be sort
of like a permissable/non-permissable areas map for the player. If the colour beneath the player is a certain colour, then the player will be reset to
their last X and Y coordinate, which is easy enough to do (just put old_x=x; old_y=y; just after the main LOOP in the player/camera process, and then
use " if (get_map_pixel(x, y)==whatever the colour is) x=old_x; y=old_y; End " below it.
Then, each one of the sprites in the sprite bar probably places a block of that specific colour on that graphic in the memory.
You could also use the same technique to create areas with water, areas that turn on alarms, or open doors, etc. Hardness maps + mode 7 work really
well together :D
Okay, well as far as I can tell, Adherbals Wolfenstein 3D remake uses two techniques. One for collisions, another for the walls themselves.
For the walls themselves - they are rows of narrow sprites. This is why they appear jagged at the edges, zig zagging sort of, it's because theyre
turning to face the camera when you move, as sprites do :p these sprites are so close together that you can't see between them, this is done in a long
row.
And for the collisions with those sprites - I believe it's likely to of been done using a hardness map. So, what this will mean is that the
player/camera process will constantly refer to a graphic stored in the memory every frame, and will check what colour is beneath it. This will be sort
of like a permissable/non-permissable areas map for the player. If the colour beneath the player is a certain colour, then the player will be reset to
their last X and Y coordinate, which is easy enough to do (just put old_x=x; old_y=y; just after the main LOOP in the player/camera process, and then
use " if (get_map_pixel(x, y)==whatever the colour is) x=old_x; y=old_y; End " below it.
Then, each one of the sprites in the sprite bar probably places a block of that specific colour on that graphic in the memory.
You could also use the same technique to create areas with water, areas that turn on alarms, or open doors, etc. Hardness maps + mode 7 work really
well together :D
Happy coding!!!
/BC
[Edited on 22-12-2016 by BreadCaster]
Wow. That's a lot to get my head around. I think I'll explore Mode8 a little further instead. However, that's a pretty ingenious method that you've
described. Thanks for your comment!