Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Bug #867958

edit.create_unit() called from unit_lost_callback() leaves a zombie

Added by Dean Brown about 2 years ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Category:
Scripting API
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

See this forum thread for what I'm trying to do -
[[http://forum.freeciv.org/f/viewtopic.php?f=11&t=91367#p102264]]

Calling edit.create_unit() from a unit_lost_callback() in script.lua results in a zombie remnant of the killed unit. It sometimes appears and sometimes disappears, when it appears its health bar is empty, it can't be moved, the disband menu option is there but doesn't do anything, it gets counted in the units screen.

Seen in 2.6.0 and 2.6.2

To repro - need a bunch of files for my "dino" ruleset that enable animals. From the zip file -
"animals.png" goes into "...share/freeciv/amplio2/animals.png"
"animals.spec" goes into "..share/freeciv/amplio2/animals.spec"
"animals.tilespec" goes into "...share/freeciv/amplio2.tilespec"
ruleset files and script.lua are in folder "dino", goes in "...share/freeciv/dino"

Pick "dino" ruleset, start a new game, explore with the explorer til you find a mountain lion, park the explorer on a low defense tile next to the mountain lion and let it get killed. The tile will now contain a new explorer and the zombie explorer.

History

#1 Updated by Marko Lindqvist over 1 year ago

  • Sprint/Milestone changed from 2.6.3 to 2.6.4

#2 Updated by Marko Lindqvist about 1 year ago

  • Sprint/Milestone changed from 2.6.4 to 2.6.5

#3 Updated by Marko Lindqvist about 1 year ago

  • Sprint/Milestone changed from 2.6.5 to 2.6.6

#4 Updated by Marko Lindqvist 7 months ago

  • Sprint/Milestone changed from 2.6.6 to 3.0.1

#5 Updated by Marko Lindqvist 3 months ago

Dean Brown wrote:

See this forum thread for what I'm trying to do -
[[http://forum.freeciv.org/f/viewtopic.php?f=11&t=91367#p102264]]

Calling edit.create_unit() from a unit_lost_callback() in script.lua results in a zombie remnant of the killed unit. It sometimes appears and sometimes disappears, when it appears its health bar is empty, it can't be moved, the disband menu option is there but doesn't do anything, it gets counted in the units screen.

Likely not a zombie, but a ghost. That's the established term for a unit that does not exist in the server, but exist in the client. That this the case can be confirmed simply by disconnecting and reconnecting the client - if the unit isn't there afterwards, it did not exist in the server for the server to send it.

#6 Updated by Marko Lindqvist 3 months ago

Reproduced in S3_0 with trivial addition to default.lua + two client game + editor.

1) It's a ghost issue
2) I got the idea that it have something to do how the new unit gives vision of the area before the dying one loses it. Tested if it makes a difference if the dying unit is the only one seeing the area where it is, or does someone else see it too. That test supports my idea, as the ghost does not remain when someone else is witnessing the death, but it remains when there's no witnesses.

So I guess that the such dying unit would normally be removed from the client just because we lose vision of its tile. Now, the bug occurs when the newly created unit from the script gives vision of the area before it ever goes dark.

#7 Updated by Marko Lindqvist 3 months ago

  • Sprint/Milestone changed from 3.0.1 to 3.0.2

I have a patch for this in testing, but 3.0.1 release work is now the priority.

#8 Updated by Marko Lindqvist 2 months ago

It wasn't exactly that the unit was not removed from the client.

It had already been removed from the client, but it still existed in the server side (especially: it existed in the tile's unit list). Vision provided by the unit was already removed, so when the vision for the new unit was added, it caused tiles to get revealed (as opposed to being visible all the time). So the unit still on the server side was revealed, and sent back to client.

Planning to push attached fix even to S2_6.

#9 Updated by Marko Lindqvist 2 months ago

Marko Lindqvist wrote:

sent back to client.

So, the original description as "zombie" was accurate! It was not a ghost, but a reanimated body.

#10 Updated by Marko Lindqvist 2 months ago

  • Status changed from Resolved to Closed

Fix is now in, if you want to test, e.g., with the nightly build coming out in a few hours.

Also available in: Atom PDF