Skip to main content
gamedev.net
🔒 Locked

Quick raycasting

Started by The Alchemist 3 replies 850+ views
Original Post
The Alchemist
The Alchemist
hi im making a doom like engine, and how exactily u make a quick ray casting? with wolf3d the whole tile based nature of the maps make it easy, but without tiles, how u make it fast?
"Everything works out in the end, if it doesn't then it is not the end"
nts
nts
If i am not mistaken doom is GLP'ed, so u could look at the source and find out :)

Quake 2 is and it has a software renderer, could also take a look at it
Wyrframe
Wyrframe
Doom isn't a raycaster. It uses BSP to reduce the world to "front" and "back" sides of walls, and shatters the world into managable chunks which are renderable with a very quick tree traversal with almost zero overdraw.

The matter of floors and ceilings at different heights does create some overdraw, but it is overall a really interesting way to do it. The only nasty and difficult bits of the entire system is keeping your BSP tree balanced, and actually rendering your floors and ceilings without using floating-point ops.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
The Alchemist
The Alchemist
how does doom render the walls then?
"Everything works out in the end, if it doesn't then it is not the end"
Wyrframe
Wyrframe
Depends what part of "render" you mean.

How is the BSP tree traversed? I don't remember off the top of my head. I'd conjecture off the top of my head that the engine first looks at the "room" the camera is in, and picks any on-screen wall (simple two-plane frustrum test). It then very likely traverses the BSP tree first towards, and then away from, the camera, using potential-visibility calculations which I haven't memorized, and rendering both walls and floor/ceiling on the away-from pass, knowing as it goes which columns of the screen have been rendered to already (the simplicity of the map makes this very easy; at 320x256 viewport size, at most 640 bytes are needed to store complete has-drawn-here information).

How are the walls rendered? A simple perspective-corrected unsheared textured polygon blit. Nothing complicated.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.