I am trying to create sort of a tunnel with %90 opacity so you can barely see the lemmings walk behind. I want it to physically be pass-through but visually on top of everything.
OR think of a scenario of a dungeon where some of the moss textures appear in front of the lemmings which is also something I like to achieve.
I tried decoration and one way flags as effect but I can't seem to achieve this. "No overwrite" nor "Draw Last" options don't help. I even edited the level file giving the $gadget "foreground" flag but that also didn't work.
I've been searching the internet, these forums and old documentations for reference but so far no luck.
How does one go about creating a foreground terrain/object/decoration which is occluding but pass-through?
Currently, the only thing that's drawn to a higher layer than the lemmings themselves is the lemming "effects" (such as the Timebomber countdown, portal warp, balloon pop, freezing/unfreezing overlays, etc)
The layers are structured like this, from soonest -> latest in draw order:
TRenderLayer = (rlBackground,
rlDecorations,
rlGadgetsLow,
rlShadowsLow,
rlTerrain,
rlLemmingsLow,
rlOnTerrainGadgets,
rlOneWayArrows,
rlGadgetsHigh,
rlTriggers,
rlShadowsHigh,
rlObjectHelpers,
rlParticles,
rlLemmingsHigh, <--- vast majority of lemming states are drawn here
rlEffects); <--- effects are drawn here
To achieve what you're suggesting, we could allow paint gadgets to be drawn to the "Effects" layer, but there are 2 potential issues with this, both of which add what I would consider to be undue complexity:
1) Existing lemming effects may still be drawn above the paint gadget. There may be a way to ensure that this doesn't happen, but it isn't a gimme.
2) Perhaps more importantly, we'd be introducing a way to potentially hide lemmings from the player. The community in general is already fairly prickly when it comes to hiding things like traps, exits and steel. Even speaking as someone who doesn't mind the odd hidden object now and again, hiding the lemmings is definitely a step too far. I do realise that this isn't what you're suggesting, and I can imagine that the effect you've described could look very cool. But, to avoid controversy, we'd have to implement some way to "reveal" the lemming when the cursor is over them, which adds further complexity to the feature. The more complex the feature, the more prone it is to bugs and the more justification it needs.
Then again, with all that said, I do like the idea you've suggested and I'd be interested to see if it could be made to work. If it isn't too problematic to set up, I personally wouldn't mind allowing paint objects to be drawn to the Effects layer. The only thing I'll rule out for definite is adding another rendering layer just to support this very niche feature. The rendering is already stretched pretty far as it is in SuperLemmix (given the 32-bit platform), so anything we can do to reduce the load is desirable.
Let me look into it and see what's possible.
To be totally frank, I was trying to build a realistic passageway to increase the immersiveness in the level. Giving a feeling of "3D" in Z axis. But then the idea of "hiding" the lemmings struck me and I tried to remember any level where I couldn't see my lemmings... I couldn't (obviously). Then I thought how exciting and perhaps nerve-racking it would be during the passage: "Will they fall somewhere? Is there a trap? Are they lost? Did they die? Is this a bug?" and then "OMG THEY WALKED BEHIND!"
While trying to figure out how to implement this, I actually wanted the player to still be able to see their lemmings walk in all fairness to the player. That's why I initially aimed for ~90% opacity. So yes, I was never really going for full concealment, more of a "veil" effect (Like the hanging moss).
Your concern about hiding lemmings from the player is completely fair, and I think opacity itself might be the natural answer to it. If the foreground decoration is drawn to rlEffects but respects the alpha of the source PNG, the level designer controls visibility directly: a 90% opacity tunnel still lets the player track their lemmings, a 100% opaque one is a deliberate and obvious artistic choice rather than a hidden 'gotcha'. The community's concern tends to be with *deceptive* hiding (concealed traps, invisible steel). A visually prominent arch that lemmings clearly walk behind feels categorically different.
On your concern about existing lemming effects (countdowns, balloon pop, etc.) potentially rendering beneath the foreground object: for this use case that's actually acceptable or even preferable. A timebomb countdown visible through a tunnel arch would look fine and is arguably better than it being hidden.
So the implementation I'd humbly suggest, if I may and if you do wish to pursue this:
- Allow DOM_DECORATION gadgets with a FOREGROUND flag to draw to rlEffects (exactly as you outlined; no new layer needed, the existing layer does the job).
- Honour the source PNG's alpha channel as-is during that draw, rather than forcing full opacity. This keeps the designer in control of how "veiled" the effect feels.
- Additionally, when a lemming's position is covered by a FOREGROUND-flagged decoration, you can have the engine draw a simple outline or silhouette of that lemming to rlEffects as well, ater the decoration is composited. Since both would write to the same layer and decorations are drawn before lemmings in the pipeline, the outline would naturally sit on top of the foreground asset. I believe the infrastructure for this already exists in the codebase as the CombineFixedColor is already used for similar fixed-color overlay passes and the lemming's bounding rect is readily available at draw time.
This approach sidesteps the "hidden lemmings" concern entirely without needing a cursor-hover mechanic. The outline guarantees the player always knows where their lemmings are, regardless of how opaque the foreground asset is. It also means no special documentation warnings like "Designer beware" are needed as the game handles visibility automatically...
The cursor-hover silhouette you mentioned could still be a nice additional polish if it's not too costly, but I think the outline alone would be sufficient.
THANK YOU for taking the time to look into this and for the detailed breakdown of the layer stack. That alone was incredibly helpful for understanding why my earlier attempts weren't working.
And sincerely thank you for keeping "The" nostalgia alive and keep improving it up to this day. I was stunned with disbelief when I discovered your fork (and NeoLemmix to be totally frank).
I wish you a great day!