Author Topic: Meanings of trap/hazard shown trigger areas are inconsistent  (Read 2667 times)

0 Members and 1 Guest are viewing this topic.

Offline Forestidia86

  • Posts: 721
  • inactive
    • View Profile
Meanings of trap/hazard shown trigger areas are inconsistent
« on: October 02, 2019, 09:19:17 PM »
Not sure if that's a problem:

But e.g. the shown trigger area of the fire trap kills the lix if it touches any part of it.
The shown trigger area of the Eater only if the area touches the ground.

The shown trigger areas seem to mean different things in both cases, which seems inconsistent.

Edit: This is issue 389.
« Last Edit: November 02, 2019, 11:55:29 PM by Forestidia86 »

Offline Simon

  • Administrator
  • Posts: 3860
    • View Profile
    • Lix
Re: Meanings of trap/hazard shown trigger areas are inconsistent
« Reply #1 on: October 03, 2019, 09:41:35 AM »
Right, this is a problematic relic from eye triggering, an older physics rule from C++ Lix and early D Lix.

Goals and one-kill-at-a-time traps (e.g., the Eater) trigger only when the lix touches the trigger ara with the foot. This has always been the rule.

Fire and water trigger when the lix's foot touches the trigger area, or, in older versions of Lix with eye triggering, when the lix's eye touches the trigger area. The eye depended on the spritesheet. There is code in Lix that scans each sprite for its eye location; if a pose covered her eye with the hand, we used the previous sprite's eye.

With the eye rule, a platformer could slip underneath a buzzsaw where walkers died. This was very hard to discover for players. Also physics really shouldn't depend on such ornamental details of the spritesheet.

Instead of the eye rule, there are checks at (foot), (foot - (0, 4)), (foot - (0, 8)), and (foot - (0, 12)). This still covers a good chunk of the body, and it's independent from the spritesheet, and feels right.

Only today I'm realizing: Since the extra checks happen at a predefined, constant height, this rulel has become identical to a foot-only check against a downwards-enlarged trigger area.

I'm up to find a good solution. Should we draw a bigger trigger area in the editor? Or should we draw an extra rectangle below the current rectangle, to show the area where the foot will be when the fire/water triggers? Either way, fire and goals will then have different rectangles drawn despite identical text file definitions. But that's likely fine. I'm hesitant to change the file format, but even that is on the table.

-- Simon

Offline Forestidia86

  • Posts: 721
  • inactive
    • View Profile
Re: Meanings of trap/hazard shown trigger areas are inconsistent
« Reply #2 on: October 05, 2019, 02:47:39 PM »
I think enlarging the shown trigger area is clearest. That seems more or less what is happening.

Offline Simon

  • Administrator
  • Posts: 3860
    • View Profile
    • Lix
Re: Meanings of trap/hazard shown trigger areas are inconsistent
« Reply #3 on: October 05, 2019, 09:33:31 PM »
After looking at the source, 0.9 behavior is slightly different than I explained above.

0.9 fire is deadly to the body (= foot, foot - (0, 4), foot - (0, 8), foot - (0, 12)).

0.9 permanent flingers trigger on the foot only
0.9 one-lix-at-a-time flingers trigger on the foot only.
0.9 one-lix-at-a-time traps trigger on the foot only.
0.9 water is deadly to the foot only.
0.9 goals trigger at the foot only.

Interesting, I thought that at least water and permanent flingers (e.g., steam) would trigger on the body.

-- Simon

Offline Forestidia86

  • Posts: 721
  • inactive
    • View Profile
Re: Meanings of trap/hazard shown trigger areas are inconsistent
« Reply #4 on: October 05, 2019, 09:46:56 PM »
It's actually odd that water and fire behave differently concerning trigger areas. But makes maybe sense with view to dying animation.

Offline Proxima

  • Posts: 4562
    • View Profile
Re: Meanings of trap/hazard shown trigger areas are inconsistent
« Reply #5 on: October 05, 2019, 09:47:05 PM »
I remember, in the early days of the Lix community pack, filing a bug report against one of mobius's levels where the crowd had to mine under a pool of water and were drowning due to the body-trigger rule. I believe this was changed (for water objects) as a result.

Offline Simon

  • Administrator
  • Posts: 3860
    • View Profile
    • Lix
Re: Meanings of trap/hazard shown trigger areas are inconsistent
« Reply #6 on: October 05, 2019, 10:00:22 PM »
Yeah, water explicitly triggers only on the foot, this rule is older than D Lix from 2015. Makes sense, the Lix community pack started in 2012.

I don't remember the reasons for all the rules either.

Even the code has relics of body-triggered steam: If the body (which includes the foot) encountered any flinger trigger arers this physics update, then find a flinger that we touched with the foot and use it. It's possible that this finds nothing, and the code is happy with that too.

I'm considering to rip body encounters from the codebase, keep only foot encounters, and extend all fire trigger areas downwards by 12 pixels. Won't change the gadget file format, at least not yet during 0.9.*. If nothing else, we'll draw better trigger areas for fire, and maybe the tumbler gets slightly more performant from fewer checks.

But have to be careful; this can inadvertently change physics even though I really want them constant across 0.9.*. Maybe we should keep the body encounters and only draw larger fire trigger areas in the editor, and keep the exact 0.9 trigger area physics implementation.

-- Simon