Page 1 of 1

Specific units crashing the game

Posted: Mon Jan 30, 2012 10:04 pm
by El_Condoro
I have created over 20 'new' units (new icons using the same stats as existing units) and all of them work properly except 2 - the new StuG IV and StuH 42 units. I created a test scenario and placed all the new units, including these two. When I play the scenario all units can be selected and moved and the sound effects etc are as intended. As soon as I click on one of the two above the game freezes.

I have checked the efx and equipment files and will continue to do so, but I thought I'd ask if anyone has any hints.

To create the units I used the Equipment Editor, Add unit (StuG/StuH), changed the image icon (used custom named icon from rezaf's new camouflage set) and stats to allow switching with the correct counterpart type (ART/AT), Commit unit, Save. Stats appear in the file and they can be placed in the Scenario Editor and they appear in the game.

Thanks for any help.

Posted: Mon Jan 30, 2012 10:12 pm
by VPaulus
No clue. But usually it's a problem with the equipment file. But you already checked that.
Do you want me to test them in my PC?

Posted: Mon Jan 30, 2012 10:15 pm
by El_Condoro
I'll try a completely dry run and let you know. Cheers

Posted: Mon Jan 30, 2012 10:18 pm
by Kerensky
I suspect this may help.
#3. Critical bug with the German su-122.
Step 1: Place german su-122 on map with editor included in BETA 1.05
Step 2: Start game and launch map
Step 3: Click on German Su-122 unit
Step 4: Notice game is frozen

I couldn't figure out what was causing this, the efx and equipment file both look configured correctly.


Bug #3 was actually pretty interesting. Here is what happened there.

- If a unit is switchable, one type in the switch chain (which can have more than 2 units btw) is considered "primary". This is the type which determined unit's "real" class, and is used to provide the right upgrade options.
- In the past, all types except the primary one had "nopurchase" trait, because a switchable unit can only be bought using its primary type. So this is how the game determined which type should be considered primary.
- Here comes the problem: in case of captured SU-122 all modes of the unit have "nopurchase", so the game could not determine its primary type.
- This unexpected situation caused the engine to fail.

To solve this, I decided to separate "nopurchase" and "primary" attributes of a unit, because, as we've learned from this example, they are not always directly related. Captured SU-122 must have "nopurchase" trait, but still it must have a valid primary type, because it is essentially an artillery, and must be upgraded as artillery, not as SPAT.

So now we have a new trait supported by the game:
"primary"

For now, the only unit which must have this trait is german SU-122 (artillery mode). For other units, the game will default to the old behavior in case "primary" trait is not found. However, it would be much better if we assign "primary" trait to all units that should have it, and then I can disable the old problematic mechanism altogether, and always use new one ("primary" trait) to determine primary unit type.

Alex

Posted: Mon Jan 30, 2012 10:28 pm
by El_Condoro
Thank you! I haven't tested it but am certain this will be the issue - I am making these new units both nopurchase. Thanks again and will report back here any other things I might find related to it.

Posted: Mon Jan 30, 2012 10:33 pm
by VPaulus
So that's what happened with a user in Matrix forum:
http://www.matrixgames.com/forums/tm.as ... 44&mpage=3

Niki, will like to know about that.

Thnaks, Kerensky. :)

Posted: Mon Jan 30, 2012 10:35 pm
by El_Condoro
Yes, I can confirm that was what caused the problem - I removed the nopurchase trait from the AT versions and they now work perfectly. Since the units are for the AI to use in Red Dawn it won't matter. Thanks again. Cheers.