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

Have trouble running Legend of Grimrock 2 or do you have questions about the purchasing options? Look for help here.
User avatar
Dr.Disaster
Posts: 2874
Joined: Wed Aug 15, 2012 11:48 am

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

Post 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
Last edited by Dr.Disaster on Wed Jan 13, 2016 8:56 pm, edited 1 time in total.
User avatar
Komag
Posts: 3654
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

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

Post 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,
Finished Dungeons - complete mods to play
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

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

Post by Drakkan »

and NOW that explains why my ammo was sometimes hideously missing ! :)
Breath from the unpromising waters.
Eye of the Atlantis
badhabit
Posts: 467
Joined: Sat May 05, 2012 2:24 pm

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

Post 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.... :(
User avatar
Dr.Disaster
Posts: 2874
Joined: Wed Aug 15, 2012 11:48 am

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

Post 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?
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

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

Post by petri »

Thanks for the bug report! I will try to reproduce the issue here.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

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

Post 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?
User avatar
Dr.Disaster
Posts: 2874
Joined: Wed Aug 15, 2012 11:48 am

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

Post 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.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

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

Post 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..
badhabit
Posts: 467
Joined: Sat May 05, 2012 2:24 pm

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

Post 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).
Post Reply