Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => The Theory of Everything => Topic started by: Earthmichael on January 19, 2013, 06:31:54 AM

Title: Echelon Mirror causes crashes
Post by: Earthmichael on January 19, 2013, 06:31:54 AM
I just encountered a bug that I had only seen once before, where the SMAX crashes when I move my cursor to a particular square.  I did not track down the cause the first time, but when I encountered the bug again, I spend some time tracking down the cause.

The crash appears to be triggered by an Echelon Mirror.  There are several odd aspects to this bug:
1. I had built the Echelon Mirror over 20 turns before the turn where it causes the crash.
2. The crash occurs only after I save and load the game.

The solution was fairly straightforward: I went back to a save one turn earlier, and destroyed the Echelon Mirror before it started triggering crashes.

Has anyone else observed this bug?

Does anyone know of any other solution other than destroying the Echelon Mirror?
Title: Re: Echelon Mirror causes crashes
Post by: Petek on January 19, 2013, 12:26:03 PM
Do you have a save file that illustrates the bug?
Which game (SMAC or SMAX) and which version (original, SOS, GOG, etc.) and which (if any) unofficial patch?
This might be a corruption of the Echelon Mirror graphic. Does anyone know in which file that graphic is kept?
Title: Re: Echelon Mirror causes crashes
Post by: Buster's Uncle on January 19, 2013, 03:09:56 PM
That would be ter1.pcx - but I cannot imagine how a corrupted graphics file would have any effect other than displaying corrupted.
Title: Re: Echelon Mirror causes crashes
Post by: Earthmichael on January 19, 2013, 03:19:56 PM
The installation is GOG with all updates and the unofficial patch.

The game is T_Ras vs. Earthmichael.  It is the Drones that experience the problem at the mirror on the far west of their domain.  I have posted a save.
Title: Re: Echelon Mirror causes crashes
Post by: Earthmichael on January 19, 2013, 03:22:26 PM
To be clear, the bug occurs by moving the cursor adjacent to the mirror.  At this point, the game crashes.  If a graphics bug were to cause a crash, I don't see how it could be triggered by moving the cursor next to, but not on, the mirror.
Title: Re: Echelon Mirror causes crashes
Post by: Buster's Uncle on January 19, 2013, 03:41:09 PM
It sounds to me like the north pole bug - sometimes a square on or near the northern edge of the map crashes the game if you do anything there.  It usually goes away if you avoid the square for a turn.  I never found a cause like your echelon mirror.
Title: Re: Echelon Mirror causes crashes
Post by: Earthmichael on January 19, 2013, 04:56:04 PM
This is different from the north pole bug.  For one thing, the location is not very close to the north pole.  And destroying the echelon mirror seems to have eliminated the bug.
Title: Re: Echelon Mirror causes crashes
Post by: Petek on January 19, 2013, 05:56:54 PM
I need the password to open the game. If you can't post it in public, you could PM it to me, if you wish. Is the tile in question near the "international date line"? That's the vertical strip where the tile coordinates roll over. I think there have been some bugs associated with that.
Title: Re: Echelon Mirror causes crashes
Post by: Petek on January 19, 2013, 08:30:19 PM
OK, so I opened the save game. I think I see what's causing the crash. There's a crawler NW of the Echelon Mirror that is crawling 7 EC/turn for Free Drone Central. However, if you open the Free Drone Central base screen, the Forces Supported display does not list any crawler crawling 7 ECs. In fact, if you click on each of the crawlers in that display, the crawler in question never activates. I guess that something in the internal game tables got out of synch. Destroying the Echelon Mirror in the previous turn prevented that from happening. A save game from the turn before this happened might allow Yitzi or kyrub to see the problem, but probably isn't worth the effort. Just my opinion.
Title: Re: Echelon Mirror causes crashes
Post by: Earthmichael on January 19, 2013, 09:58:02 PM
Thanks for looking into it!  If anyone wants to look at earlier turns, that is fine with me.  I have all of the saves back to the beginning of the game, in case I later want to do an AAR.
Title: Re: Echelon Mirror causes crashes
Post by: Yitzi on February 07, 2013, 08:13:53 PM
I tried to look at it, but I don't know the password to get into the game...
Title: Re: Echelon Mirror causes crashes
Post by: Yitzi on February 07, 2013, 10:14:18 PM
OK, so I opened the save game. I think I see what's causing the crash. There's a crawler NW of the Echelon Mirror that is crawling 7 EC/turn for Free Drone Central. However, if you open the Free Drone Central base screen, the Forces Supported display does not list any crawler crawling 7 ECs. In fact, if you click on each of the crawlers in that display, the crawler in question never activates.

That's because it's not 1 of the first 15 crawlers; only the first 15 crawlers show, and I think that's part of why it gets messed up; disbanding one of the earlier crawlers (so that one is no longer #16) makes it not crash.  More investigation will be needed.
Title: Re: Echelon Mirror causes crashes
Post by: Yitzi on February 08, 2013, 01:40:57 AM
Ok, turns out that it has nothing to do with the fact that it's not one of the first 15 crawlers and does not show on the base screen; what caused it not to crash when I disbanded the other crawlers from the base screen is that I had entered the base screen:

The culprit here is the obscure rule that if echelon mirrors outside your territory don't help you.  Thus, if I'm reading things correctly, the program, once it's found an echelon mirror next to the (collector-holding) square it's investigating, does as follows:
"If the mirror-ed square is in the territory of the base's owner, add +1 to the energy value of the square."  Seems pretty sensible...as long as "the base" exists.  If it doesn't, you get a crash.  For this reason, I expect that you will get a crash when checking the energy production of a square with a solar collector (or check its energy production if it had a solar collector) which is next to a square with an echelon mirror if and only if you do it before going into any bases.  Now, there are two ways to check the energy production of a square without going into any bases: Either look at a crawler that is crawling energy from it, or go to that square and then click on the square display to see how much of each resource it produces.

This also suggests an easy way to prevent the crash: As long as you check on one of your bases before clicking on that square, you should be fine.  Checking on someone else's bases (e.g. via infiltration) should also work, but will cause the energy production displayed to be wrong.

Now, it would be fairly easy to fix it to not crash, but might be somewhat more work to make it work properly (i.e. also show the right value under all circumstances.)  Even with the easy fix, the actual effect will work right, it's just the display that might have some mistakes.  Until I do whichever, checking on a base beforehand should prevent the crash.
Title: Re: Echelon Mirror causes crashes
Post by: Yitzi on February 12, 2013, 02:18:59 AM
Ok, I just looked into it, and it's actually a fairly simple fix (which will also fix an obscure error that in similar cases can cause a crawler to show the wrong amount being crawled), so it will be included in version 1.3 of my patch.  Until then, just make sure to enter a base before checking any crawlers benefiting from echelon mirrors, and you'll avoid the crash.
Title: Re: Echelon Mirror causes crashes
Post by: ete on February 12, 2013, 04:30:43 PM
Good find and fix Yitzi :).
Title: Re: Echelon Mirror causes crashes
Post by: Yitzi on February 12, 2013, 05:10:35 PM
It's actually Earthmichael's find, but thanks.
Title: Re: Echelon Mirror causes crashes
Post by: ete on February 12, 2013, 05:43:01 PM
You found the problem in the code/identified exactly what the problem was, which is what I meant.
Title: Re: Echelon Mirror causes crashes
Post by: Earthmichael on February 12, 2013, 08:35:34 PM
Exactly right, Yitzi!  My best fix was to destroy my mirror; I think yours is much better!
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 31 - 840KB. (show)
Queries used: 14.

[Show Queries]