Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Guest 6XGate

Help needed for new editor

Recommended Posts

Guest 6XGate

If there is anyone that knows how to program a depth sorting routien for a 3d preview of doom maps, I need your help. The sorting must be done with out the assisstance of the BSP tree and I don't think portal rendering would be true enough to Doom.

Share this post

Link to post
Guest MrHarmony

Well, there are plenty of ways to do that...

Anyway, we're talking about a "real" 3D view, like in the actual game, right? And as you're asking about sorting, I'm assuming you're trying to render walls and floors as polygons:

Problem: Z-sorting doesn't do the whole job!

This is because the transformed z coords of the vertexes from the map aren't enough to figure out which polygon is occluding which in all cases. Think of a very long wall and a short one, running in parallel, close to each other. The near z of the long wall is closer than the near z of the short wall, while the far z of the long wall is beyond that of the short wall. Now, what do you do!? (You can easily tell intuitively by looking at the map, but the z sorting algo doesn't have the data or "intuition"...)

One simple solution that springs to mind, that is very easy to implement for doom maps (vertical walls only) would be to detect this kind of "z overlapping", split the offending lines at each other's vertexes (seen from the camera; ie vertexes projected on the "other" wall, respectively), and then try sorting the pieces you get.

If you're *not* using polygon based rendering (ie, if you're using raycasting based software rendering), you could use an algorithm similar to the one in (most) Doom engines, although with some other solution than the BSP tree to find the linedefs. Just digging through the entire map for every "step" of every ray is going to be dog slow, however, so you probably need to do some quick scanning of the data before rendering, or rather, after moving anything on the map. Just hack the entire map up in square zones, and build a list for each zone, referencing all lines intersecting it. Way slower than the BSP, but simpler to build, and a lot faster than no optimization at all. (You just use a bitmap linedrawing style algo to traverse the 2D array of zones, doing brute force all-by-all checking of the ray and all lines in each zone.)

BTW, I'm thinking about doing some Doom editor hacking myself, although I don't really have the time for a serious effort. (Too many other projects + work + real life in general...) I'd probably start out with a simple, generic 2.5 D OpenGL based engine, and then add code to load a WAD (map + textures) and an "editor" that lets you walk around in a partially finished map, move vertexes, adjust floor/ceiling heights and apply textures.

Now, if I *do* get anything together in the next 10 years or so, it would probably be based on SDL (which runs on basically all platforms of interest; Win32, Linux, BeOS, Mac OS, IRIX etc), and, as most of my code, GPLed. :-)

I would be interested in cooperating with anyone who feels like hacking WAD file parsing (any libraries for that available?), various lump editing tools and that kind of stuff, as I'm quite new to the Doom based engines and their data formats.

Share this post

Link to post
This topic is now closed to further replies.
Sign in to follow this