View Issue Details

IDProjectCategoryLast Update
0026984AI War 2Bug - GameplayApr 19, 2022 12:06 pm
ReporterDragoris Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product Version4.020 Hotfix 
Summary0026984: Errors when creating games with only NA expansion active
DescriptionI am trying to create a quicksave game, and only have the NA expansion on turned on. When I try to add a faction such as the Neinzul Custodians, I get this error.
TagsNo tags attached.

Relationships

related to 0027003 resolvedChris_McElligottPark Hot-swapping Mods/Expansions Error 

Activities

Dragoris

Apr 15, 2022 7:29 pm

reporter  

MapGenError.png (1,423,397 bytes)

BadgerBadger

Apr 15, 2022 7:50 pm

manager   ~0066066

Closing and reopening the program seems to resolve the problem. But yeah, if you disable those expansions then start a new game immediately it's very busted

BadgerBadger

Apr 15, 2022 7:52 pm

manager   ~0066067

Reproduction: Start the program with all 3 expansions enabled. In Settings, disable TSR and ZO. Now try to start a new game from the lobby

Dragoris

Apr 15, 2022 8:10 pm

reporter   ~0066068

This resolution did not work for me, as I closed the program twice with no effect. I had to validate my files for AI War 2 to make it stop.

Chris_McElligottPark

Apr 19, 2022 12:06 pm

administrator   ~0066138

Sounds like you had a corrupt download on top of the other issues, if the steam sync fixed it. Nevertheless, this was a great find. Thanks!

* Fixed a subtle reflection-based bug that happened with trying to load the external data links after you changed your mod and expansion statuses around.
** The most notable extant example of this was having a necromancer faction selected in the lobby, and then disabling some DLCs but leaving DLC3 on. However, there were a variety of other ways this could be hit, as this was a generalized issue. It was just subtle enough that it was hard to bring out any other fashion.
** The core of this issue is actually a very interesting computer science situation. Essentially, it went like this:
*** Class ExternalInfo has a variable CachedExternalType on it, and a Pool that uses "this.CachedExternalType" inside an anonymous method to generate members of the pool.
*** After reload of the xml and thus also reset of ExternalInfo, the following things would be true:
**** CachedExternalType was not null in the outer method, and in fact was reset just perfectly.
**** Inside the anonymous method, it "this.CachedExternalType" would be null, presumably because it had been JIT compiled to point to a specific reference that no longer exists. This is one of those places where the intent of reflection and anonymous methods can get a bit lost.
*** Years ago, Keith and I had found the general solution to this is to declare a local working variable copy of the member variable, and have the anonymous method simply refer to the cached local copy. This tends to solve a number of issues, but in general ensures that the anonymous method always has the latest copy of whatever is going on in its specific local context.
**** It's actually possible that this is not a reflection issue, but an order of operation threading issue, although I doubt it. Experiments could be run, if we wanted to figure out the exact cause; or we could look at the JIT results. But really, diving that deep serves no particular purpose at this point. The solution is simply to remember to use local cached copies, regardless, and this is a case where I did not.
** Anyhow, this seems to solve the reported problems, and may solve some other unrelated problems after doing an xml reload, as well.

Issue History

Date Modified Username Field Change
Apr 15, 2022 7:29 pm Dragoris New Issue
Apr 15, 2022 7:29 pm Dragoris File Added: MapGenError.png
Apr 15, 2022 7:50 pm BadgerBadger Note Added: 0066066
Apr 15, 2022 7:52 pm BadgerBadger Assigned To => Chris_McElligottPark
Apr 15, 2022 7:52 pm BadgerBadger Status new => assigned
Apr 15, 2022 7:52 pm BadgerBadger Note Added: 0066067
Apr 15, 2022 7:52 pm BadgerBadger Sticky Issue No => Yes
Apr 15, 2022 8:10 pm Dragoris Note Added: 0066068
Apr 18, 2022 9:43 pm Chris_McElligottPark Relationship added related to 0027003
Apr 19, 2022 12:06 pm Chris_McElligottPark Status assigned => resolved
Apr 19, 2022 12:06 pm Chris_McElligottPark Resolution open => fixed
Apr 19, 2022 12:06 pm Chris_McElligottPark Note Added: 0066138
Apr 19, 2022 12:06 pm Chris_McElligottPark Sticky Issue Yes => No