Too many Friendlies at Korolov Station

These are old bug reports that have been closed.
infomaniac50
Anarchist
Anarchist
Posts: 5
Joined: Mon Aug 25, 2008 12:56 am

I'm having a problem with the AI Ships not wanting to undock from the Korolov Shipping station. None of the docked ships are freighters. They look like station defenders. There are many other ships waiting to dock as well. See image escort a palooza. enemy ships always seem to fly by the station on their way to somewhere else so i'm not sure if the station has just called in too many reinforcements.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

I had that same problem

And yes, I do beleive it is related to calling too many reinforcements.
It's even worse when one of those light IAV's gets killed by you when you are trying to kill the enemies at the station: because then all the defenders turn on you! (that early on, a bunch of centurions, let alone that mob of escort ships, will simply slaughter the player)
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

infomaniac50 wrote:I'm having a problem with the AI Ships not wanting to undock from the Korolov Shipping station. None of the docked ships are freighters. They look like station defenders. There are many other ships waiting to dock as well. See image escort a palooza. enemy ships always seem to fly by the station on their way to somewhere else so i'm not sure if the station has just called in too many reinforcements.
Are you using any mods? What are those Molotoks doing there? What system are you in? If you've got a save file that reproduces the problem, I'd love to see it.
infomaniac50
Anarchist
Anarchist
Posts: 5
Joined: Mon Aug 25, 2008 12:56 am

There are no mods on the RC version I run. As for the molotoks I'm not sure I think one of them is docked at the station. The system is Kaus Media. I've uploaded the save file here.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

oh yeah, same thing for me: no mods, just plain rc3
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
User avatar
Song
Fleet Admiral
Fleet Admiral
Posts: 2801
Joined: Mon Aug 17, 2009 4:27 am

I'm using the G.O.D Mod.....and it happens to me as well. Not just Korolev, either. Friendly stations in general have too many ships docked.

..I once had to use the wonderful "Cause Havoc" button to clear up dock spaces, once. Generally I spawn a corsair to get them off, but it's really annoying. :evil:
Mischievous local moderator. She/Her pronouns.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

infomaniac50 wrote:There are no mods on the RC version I run. As for the molotoks I'm not sure I think one of them is docked at the station. The system is Kaus Media. I've uploaded the save file here.
Thanks, the save file helps.

Unfortunately, I still can't figure out the problem. I've added some debug code so that hopefully I the next time it happens I can get more info. Meanwhile I've added code to Korolov to free up docks when needed.

Thanks!
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Thanks ^^
those empty docking ports will be sorely needed ^^

(actually, I think all stations should have that)
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

It might be a good idea to hardcode the AI no never dock unless there are two open ports, always leaving the last for the player.
User avatar
Aury
Fleet Admiral
Fleet Admiral
Posts: 5421
Joined: Tue Feb 05, 2008 1:10 am
Location: Somewhere in the Frontier on a Hycrotan station, working on new ships.

Atarlost wrote:It might be a good idea to hardcode the AI no never dock unless there are two open ports, always leaving the last for the player.
mission ship docking would need to force the station to undock a ship. i think it should be managed station-side, not ship-side
(shpOrder gPlayership 'barrelRoll)
(plySetGenome gPlayer (list 'Varalyn 'nonBinary))
Homelab Servers: Xeon Silver 4110, 16GB | Via Quadcore C4650, 16GB | Athlon 200GE, 8GB | i7 7800X, 32GB | Threadripper 1950X, 32GB | Atom x5 8350, 4GB | Opteron 8174, 16GB | Xeon E5 2620 v3, 8GB | 2x Xeon Silver 4116, 96GB, 2x 1080ti | i7 8700, 32GB, 6500XT
Workstations & Render machines: Threadripper 3990X, 128GB, 6900XT | Threadripper 2990WX, 32GB, 1080ti | Xeon Platinum 8173M, 48GB, 1070ti | R9 3900X, 16GB, Vega64 | 2x E5 2430L v2, 24GB, 970 | R7 3700X, 32GB, A6000
Gaming Systems: R9 5950X, 32GB, 6700XT
Office Systems: Xeon 5318Y, 256GB, A4000
Misc Systems: R5 3500U, 20GB | R5 2400G, 16GB | i5 7640X, 16GB, Vega56 | E5 2620, 8GB, R5 260 | P4 1.8ghz, 0.75GB, Voodoo 5 5500 | Athlon 64 x2 4400+, 1.5GB, FX 5800 Ultra | Pentium D 3.2ghz, 4GB, 7600gt | Celeron g460, 8GB, 730gt | 2x Athlon FX 74, 8GB, 8800gts 512 | FX 9590, 16GB, R9 295x2 | E350, 8GB | Phenom X4 2.6ghz, 16GB, 8800gt | random core2 duo/atom/i5/i7 laptops
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

This bug has had me worried recently. It was first reported in RC1:

http://www.neurohack.com/transcendence/ ... php?t=2426

But with infomaniac50's post and an email from Kris Parker I was able to narrow it down to a single point in the code.

In the Korolov code, when a freighter docks with Korolov, there is code that takes the escorts from the freighters and tells them to guard Korolov. The code is very simple (and made simpler below for readability):

Code: Select all

(enum (sysFindObject aObjDocked "sO:escort") theEscort
   (block Nil
      (shpCancelOrders theEscort)
      (shpOrder theEscort "guard" gSource)
      )
   )
sysFindObject returns all the ships that are ordered to escort aObjDocked (which is the freighter that just docked). We then enum over that list and tell the escorts to guard gSource (Korolov). Simple as can be.

The symptom that I was getting was that sometimes, under some conditions that I could not reproduce, sysFindObject was returning way more objects than just the ones that were escorting the freighter.

Once that happened, all those ships were ordered to guard Korolov.

But why was sysFindObject failing?

The fact that the problem only happened sometimes and the fact that savefiles never reproduced the problem meant to me that it had to be something in temporary memory (not something that's saved out with objects). Somehow memory was being corrupted.

Memory corruption is the scariest bug there is. There is no telling where it originates. A bug in some part of the code could be corrupting memory in a completely different part. The sympton that you see could be totally unrelated to the root of the problem.

I despaired for a bit, but there there two clues that made me feel better: (1) the bug only happened in sysFindObject--if some other part of the code were corrupting memory, then we would get all sorts of strange crashes. (2) Other uses of sysFindObject were working fine--it was just this particular case that seemed to fail sometimes.

After stepping through the code line by line for a while, I finally found it:

Notice that the criteria in the code above does not have a semi-colon at the end of the word 'escort':

(sysFindObject aObjDocked "sO:escort")

The code that parsed the criteria would correctly parse the word 'escort' but, expecting a semi-colon, would continue parsing the string past the end-string character. Once it got past the end of the string, it started parsing whatever garbage it found until it found another end-string character.

Most of the time, it would find the end-string character quickly and no harm would be done. But sometimes, depending on the state of temporary memory, it would find characters that altered the sense of the query.

In particular, if it found another 'O' character it would assume a new order, and if it couldn't understand the order, it just assumed any order. In other words, the criteria was being changed to find any ship with any order (not just the ones escorting the freighter).

This turned out to be a very serious bug. There were other parts of the game that had omitted the ending semi-colon--though it showed up most in Korolov because the query is run so often.

In RC5, I've fixed the code so that sysFindObject behaves properly. I feel a lot better.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Oh man,

I wish I had been paying attention to this earlier...

I have several times run into this behaviour, just in completely different cases. As a result I always end all my criteria with semi-colons...

Will try to be more attentive in the future. I would have liked to be able to help with this one...
User avatar
Prophet
Militia Captain
Militia Captain
Posts: 826
Joined: Tue Nov 18, 2008 6:09 pm

Coincidentally, we were talking about ending semicolons in criteria strings in IRC just a few days ago. Perhaps we should add a reminder to the function help on Xelerus to prevent further occurances of this bug?
Coming soon: The Syrtian War adventure mod!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Prophet wrote:Coincidentally, we were talking about ending semicolons in criteria strings in IRC just a few days ago. Perhaps we should add a reminder to the function help on Xelerus to prevent further occurances of this bug?
That certainly wouldn't hurt. But I've fixed the specific problem in RC5.

I'm also considering allowing spaces as a delimeter. Thus:

(sysFindObject aObj "s O:escort +Ares")

The downside is that it means that attributes cannot have spaces (which, I think is OK).

What do you all think?
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

I think everyone so far has assumed attributes couldn't have spaces anyhow.
Locked