Any tutorials on Doom style engines?

Started by
35 comments, last by robertgamble 21 years, 6 months ago
If DOOM used raycasting...then why does it draw the floors and ceilings completely to the top/bottm screen edges when you noclip through walls? ... Start in a level...type in the noclip cheat and walk backwords...soon you will pass through a wall, keep going...notice how the floors and ceilings are extending?

Here is a way to make a non-raycasting Doom type engine:

There are three systems.

1) game map...stored as a collection of 2D lines with related floor/ceiling data (as well as wall type solid/not solid/etc.)

2) polygon system...(explained below)

3) screen rendering system...(explained below)


For a typical game frame...the engine grabs a list of line walls (by walking the BSP, OCT, or portal "trees")...the walls on this list are then translated and rotated in relation to the player...walls behind the player are removed from the list.....

as well as walls faceing away from the player (except if they are "shared", as in the player is able to pass/see through them)....actually this part of the culling process would be super quick as the wall points would be listed in left to right order...so a (p1>p2) check would determine if they are faceing the other way.

So we now have our culled list...so we will turn them into polygons (quads to be exact)...wall line p1->X becomes polygon P1->X ....and wall line p1->Y becomes poly p1->Z...and the translated floor/ceiling locations become the Y value.

You can then sort the polys by thier Z values (as the walls won''t intersect in a BSP-tree anyway...there is no need for a Z-buffer)....project them and render away...

However now that you have the screen points of these walls (and thay are always vertical) you can optimise things for much faster rendering buy useing the screen X cords of the projected walls to cull portions of the wall polygons down to manageable levels....this allows you to render only the section of wall that would be visable...this can be done by resorting useing the screen X cord as a base, or various other meens....all the walls and "sprite billboards" feature virtical edges...so the projected screen X value can be very usefull in clipping "overdraw".

To actually render...first you draw the floor and ceilings...(if the floor is above screen center don''t draw it...same if the roof is below screen center)...by useing the projected wall Y value..we now have a place to start...the ceiling is the top half, floor the bottom....a special rendering function is used for this....this center line represents the horizon...all you need is a Look-Up-Table indicateing the players angle....this is used to "scan" through the floor/roof texture and is offset by the players map location (as the tile can only be a square 64*64 tile aligned to world center...so the player''s world location can be used to offset things)...this generates values we can use to scan through the texture with, then in combination with the wall Z value, we can render the floor/ceilings (useing the walls projected X values as left/right cliping zones)....then render the wall polygon on top of it (or just the top/bottom sections if the wall can be seen through)....this isn''t exact...and you can see in DOOM if you look closely that the floor/ceiling "slides" slightly when approching a wall.

Advertisement
Very nice explanation Especially the noclip observation.

Now can all the people who say Doom uses Raycasting please explain where and why.





quote:Original post by Anonymous Poster
And there''s no OpenGL port from original Doom.
Actually there is...i''ve played it some time agom but i can''t remember the name.

http://legacy.newdoom.com/gl/doomlgle.shtml
Doom did not use polys. If it did use polys then why does one of the documents that comes with the linux doom source talk about converting it to use polys? (readme.gl)

Just cause an OpenGL port uses polys doesn''t mean the original engine does. It just makes sense to make use of modern hardware acceleration.

Correct me if I''m wrong but BSP is pretty much irrelevant to whether the engine renders polys or not?
This is getting really dumb
------------------http://www.nentari.com
Okay...yes DOOM doesn''t render the walls as a true polygon...the walls are always vertical...so it can render the walls as a "scaleable" sprite that is anywhere from 1 pixal wide to the whole screen wide.


Yeah, you can make a DOOM like engine by raycasting...but this is slow, and innaccurite...

Consider that the game was developed for the old 486 computer....and that not even extreamly wide open areas slowed the engine down...even assembler has it''s limits.

This topic is closed to new replies.

Advertisement