Snipers trying to target enemies outside of map boundaries -> game freezes

Started by eduran, January 11, 2014, 05:38:48 AM

Previous topic - Next topic

eduran

I created a custom flying unit with a movement pattern like a strafer. Due to the finite turn rate it can occasionally end up outside of the map's boundaries. Which was not a problem, until I allowed it to be targeted by Snipers. Now, as soon as one of the units leaves the map, the game locks up. The only thing still moving is the offending unit, everything else freezes. The snipers don't even have to be in range, just somewhere on the map.

J

Do you have the latest game version? I remember this being reported earlier, not sure if it was fixed.

eduran


Grauniad

There was a fix for this in V1.51 of the game. If you still experience this, then attach a game save and your log file so Virgil can find and fix the issue easier.
A goodnight to all and to all a good night - Goodnight Moon

knucracker

Yeah, email me a save of your map right before it happens (to support@knucklecracker.com).  That will allow me to quickly repro it and to make sure I fix it properly.

eduran

A test map to showcase the bug. There is only one script: it makes the CRPL core a sniper target and then moves it by setting its own pixel coordinates. As soon as it crosses the top or bottom edge of the map the bug occurs. Moving left/right does not trigger the bug. Moving the core out of bounds manually works fine, too.

knucracker

I had to change the condition in the test script to get it to move out of bounds, but when it does... sure enough, kaboom.  The issue had to do with the core updating its position in an array that is used by snipers.  For efficiency, snipers scan across an array looking for things to shoot at rather than through all units comparing distances.  That array is single dimensional but represents the entire 2D map (much like our 3d universe is probably backed by a 2d substrate according to the holographic principle :) )

That's why it can move right and left off the map.  When it does it just wraps around to a lower or higher level  c = x + width*y, where c is the location in the single dimensional array, a and y are the 2d map coordinates, and width is the width of the 2d map.

I've fixed this and will publish a build shortly after I take a look at a couple other things.  My goal is to actually get a new primary version released and everyone updated ASAP across all stores and channels.

eduran

I hate to say it, but it's still happening in 1.59. It is now harder to produce the bug, but still possible. What you need to to do is have the targetable CRPL core cross the map boundary while it is in range of a sniper. The attached map does that. If you remove the sniper in the top right corner, where the core starts, everything works fine.

knucracker

Can you double check to make sure you are running 1.59?  I just loaded the save and don't get a problem.  Is the core supposed to move up slightly then off the the left?

I'll keep messing around with it to see if something shakes out...

--edit--

Ok, if it edit your test2 script so the core moves off the top of the map, I definitely get a new exception.

eduran

The core is supposed to move up first and then over to the left (I wanted to see what happens when I remove the top right sniper and move the core past the left one). Not sure how i managed to attach the wrong script twice now, sorry for that.