Page 1 of 3

[FIXED] BUG: item spawn spot ahead of monsters dying tile

Posted: Wed Dec 03, 2014 4:39 am
by Dr.Disaster
Just run in a very rare but annoying bug regarding items spawned upon a monster's death.
It might be that it was reported already (i think i've read about it here) but can't locate the post so i re-report it.

Assume you fight a monster in such a room setup:

Code: Select all

.: free tile
M: Monster
P: Party
W: Wall

. . . . W
. . M . W
. . . . W
. . . P W
Assume the monster
- is supposed to drop loot
- drop all missiles/throwing weapons it was hit with
when killed

Now assume:
- the monster moves towards the wall
- the party does a ranged attack that kills the monster before it can either finish it's move or turn towards the player

Now the following can happen (very hard to reproduce):
the items the monster is supposed to drop are not spawned on the tile the monster moved to but one tile further ahead!

Code: Select all

.: free tile
D: Monster death tile
L: Loot spawn tile
P: Party
W: Wall

. . . . W
. . . D L
. . . . W
. . . P W
Now WHEN the tile any items are spawned on is a solid wall or a large enough blocker the player is unable to collect the loot / recollect his ammo. Depending on what that monster's loot is i.e. a power gem this might result into a gamebreaking condition!

The condition which causes items to spawn 1 tile ahead of a killed monster yet eludes me plus the bug is pretty hard to trigger.
Up to now i've seen it only twice since release:
- fighting a spider in the mine which walked into a tile before a large rock
- fighting a ratling thrower in the twigroot tunnels

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Wed Dec 03, 2014 11:41 am
by Komag
It's possible it's just a matter of exact timing, killing just before Lua code tells program monster has stopped moving, but after reaching the square next to wall, so other loot/item drop code looks for next square in same movement direction, or something like that.

You could maybe test it by setting up a spider with 1 health and some big obvious loot drop and make a button spawn the spider just around the corner so it always walks toward a wall in front of player,

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Wed Dec 03, 2014 11:58 am
by Drakkan
and NOW that explains why my ammo was sometimes hideously missing ! :)

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Thu Dec 04, 2014 12:04 pm
by badhabit
Komag wrote:It's possible it's just a matter of exact timing, killing just before Lua code tells program monster has stopped moving, but after reaching the square next to wall, so other loot/item drop code looks for next square in same movement direction, or something like that.

You could maybe test it by setting up a spider with 1 health and some big obvious loot drop and make a button spawn the spider just around the corner so it always walks toward a wall in front of player,
Timing problems again of the engine, Non-atomic operations.... :(

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Thu Dec 04, 2014 5:23 pm
by Dr.Disaster
Komag wrote:It's possible it's just a matter of exact timing, killing just before Lua code tells program monster has stopped moving, but after reaching the square next to wall, so other loot/item drop code looks for next square in same movement direction, or something like that.
A strange sounding possibility; it's like the anticipation of movement that has not even started. During regular combat i can sometimes see the dealt damage numbers being displayed on a tile beside a monster (to left or right, whatever circling/strafing is done). Perhaps some monster path pre-selection routine thing not paying attention to surroundings?

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Tue Dec 09, 2014 2:53 pm
by petri
Thanks for the bug report! I will try to reproduce the issue here.

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Fri Feb 06, 2015 11:41 am
by petri
This one is next on my todo list but so far I have been unable to reproduce this bug. Any ideas?

EDIT: was the dropped item clearly in the next cell or was it near the edge between two cells?

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Fri Feb 06, 2015 12:01 pm
by Dr.Disaster
petri wrote:This one is next on my todo list but so far I have been unable to reproduce this bug. Any ideas?
Yeah this one is hard to reproduce. The best idea i can offer is to kill a monster while it is moving towards a blocker/wall before it finishes the move.

It might be possible that it does not happen with all monsters. As reported i have seen it happen with spiders and a thrower ratling.
In later games i've also seen it happen with a medusa in the pyramid in that 6 altar 9 pit puzzle room (projectiles were dropped under/behind an altar; could see but not grab them) and a dark acolyte.
petri wrote:EDIT: was the dropped item clearly in the next cell or was it near the edge between two cells?
The items were clearly in the next cell. Clicking at the bottom of the wall or blocker the items fell into did not grab them. Now walking/teleporting into the next cell with collision off or party:setPosition even auto-picked up the "lost" projectiles.

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Fri Feb 06, 2015 12:08 pm
by petri
Ok, thanks! Maybe it's possible to automate testing of this bug. Spawn a spider with an item, kill it after random amount of time, check for position of dropped item in script, repeat. Hmm..

Re: BUG: item spawn spot ahead of monsters dying tile

Posted: Fri Feb 06, 2015 2:54 pm
by badhabit
petri wrote:This one is next on my todo list but so far I have been unable to reproduce this bug. Any ideas?

EDIT: was the dropped item clearly in the next cell or was it near the edge between two cells?
If this is again a timing problem (like previous arrow droppign and wall piercing problems) it could be again also FPS dependent. I guess your system is plainly to good to expose these problems often enough. Therefore tests on a multitude of systesm are important. Test this case on a slower rig where you end up with <30FPS (or downclock CPU/GPU of your main system, maybe even FPS limiter is enough).