Wall rendering positions /order?

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Wall rendering positions /order?

Post by Gambit37 »

I'm creating a new wall-set and running into issues designing the highlights on the seams where walls join.

I think it may be due to the order in which DSB renders each wall element: some elements seem to be drawn OVER others, when I would expect them to be drawn UNDER.

Please could I get some info about the order that DSB draws all the wall parts? This would really help, thanks! :-)
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Wall rendering positions /order?

Post by Sophia »

The first thing drawn is the ceiling, and then the floor is drawn immediately after. The code for rendering this stuff is a bit complicated due to the need to support alternate wallsets, but it all kind of "just works" from the perspective of someone designing a wallset.

There are four range values to be concerned with: 0 is the party's own square, 1 is the square just ahead, 2, and 3. Each of the ranges has a left, center, and right square, and range 3 also has far-left and far-right squares which draw those barely visible walls you can see off in the distance.

So after drawing the floor and ceiling, the next walls drawn are the range 3 far-left and far-right walls, in that order. It doesn't draw wall decorations on these walls. After that, it draws the range 3 left wall, the range 3 right wall, and finally the range 3 center wall, including drawing all wallitems and other decorative features on these walls. This left-right-center order holds throughout the process; it then draws left-2, right-2, center-2, left-1, right-1, and center-1, in that order. The code for drawing the range 1 center wall is pretty complicated due to the need to handle magic windows and such, but anyway, after all that, it draws the walls to the immediate left and right (i.e., range 0) of the party. No wall is drawn for the square the party is on.

I hope that helps! You can see the code for yourself in https://github.com/sparkletwist/DSB/blo ... r/render.c although it's, quite honestly, pretty awful code.

Anyway, I should also note that I hope you're creating an "ex" wallset, that is, a (mostly?) RTC-compatible wallset. The "standard" wallset is the style used by CSBwin and can be imported more or less directly into the CSB engine but it's actually pretty cumbersome to work with, and the difficulty of creating any new wallsets in this form are mostly why the "ex" wallsets even exist.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Wall rendering positions /order?

Post by Gambit37 »

Cool, thanks, that fits in with my current mental model of how it works.

The problem walls are the side views. When do these get drawn? My research suggests they are drawn AFTER their associated LEFT/CENTER/RIGHT walls, which causes layer ordering issues if you want to do something fancy with overlaps...

Also, why are there no wall decorations drawn on the far-left/right walls? DM/CSB do draw decorations there and use a weird stretching effect to make the wall items look "right".
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Wall rendering positions /order?

Post by Sophia »

You're right, the perspective views are drawn after the front walls. I'm not sure if changing it will break the default wallsets.

There are no wall decorations on the far-left/right walls because that's how the wallsets used with DSB work. I think the distinction is that DM 2.x didn't draw the decorations on the walls and DM 3.x did, and DSB's walls are based on 2.x-style wallsets. Anyway, actually, CSBwin doesn't draw the wall decorations on these walls, and I'm pretty sure RTC doesn't either.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Wall rendering positions /order?

Post by Gambit37 »

OK, thanks. I found a slightly different way of getting my walls to work without overlaps. I was probabaly trying to be a bit too clever...!

Interesting about the 2.x and 3.x style original walls, I didn't realise that. It would explain why the 3.x wallset actually makes the dungeon view "wider", by including a small part of wall to suggest even more tiles are visible at view 3.

Anyway, yeah, I don't mind that the far side view walls don't show wall decorations. The purist in me is aware of it, but as a player I don't really notice that they're missing.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Wall rendering positions /order?

Post by Gambit37 »

Regarding the side walls, do you think you'd change DSB to draw those BEFORE the front walls?

Basically I'd like to combine both the left & side wall in one image, like later versions of DM do. This allows for the correct edge highlights and makes it possible to do roughly cut out edges where walls overlap. (It's really hard to do that when every piece of wall is separate).

So if I could use an image like this for side1 for example, I could make left1 transparent/null.

Image
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Wall rendering positions /order?

Post by Sophia »

I'm pretty sure this will work already, actually!
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Wall rendering positions /order?

Post by Gambit37 »

Hmm, weird, I thought I had already tried it and got layering problems, but I just tried it again and it seems OK! :? :D
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Wall rendering positions /order?

Post by Gambit37 »

Just a quick update to this: You can indeed combined the left and perspective walls into one image (just set the contents of the perspective wall to powerpink so that it appears invisible). However, if you're using a combination of normal wallsets and tall wallsets with the iterative ceiling draw method, the combined wall technique WON'T WORK.

A reminder that this is what I mean by combining the left and perspective images into one:
Image
Post Reply