Arcen Games

General Category => AI War II => Private Alpha Discussion => Topic started by: Pluto011 on March 29, 2018, 01:08:55 pm

Title: Problem With Control Groups
Post by: Pluto011 on March 29, 2018, 01:08:55 pm
Trying to give the alpha of this another play. I just unlocked mark II fighters, and the game won't allow me to add it in to a control group with my mark I ships. When I try it, the group only contains the mark I bombers and corvettes. Not sure if this is a bug or I am missing something.
Title: Re: Problem With Control Groups
Post by: x4000 on March 29, 2018, 01:24:32 pm
Do you have a savegame? In general you mark I ships should all become mark II very fast after you unlock the new mark. The ones from the same line, I mean. Fighters 1 become fighters 2 after being upgraded by a builder when you unlock fighter 2. Different from the first game. Of course, bomber 1 would stay bomber 1 if you unlock fighter 2.

There are a number of control group bugs in general right now on mantis, so it might not be related to mark levels at all, I don't know.
Title: Re: Problem With Control Groups
Post by: Pluto011 on March 29, 2018, 01:35:13 pm
Yeah all the fighters became mark 2 fine. They just weren't going in the right control group. It started working after I captured a planet, or possibly after a few of them died.

Unfortunately I don't have a save. Didn't think to make one when it was happening.
Title: Re: Problem With Control Groups
Post by: x4000 on March 29, 2018, 02:06:40 pm
No problem. If you find a way to reproduce it, please let us know. Do you think that as they upgraded they lost their control group?
Title: Re: Problem With Control Groups
Post by: Pluto011 on March 29, 2018, 02:43:55 pm
Something like that, yeah. It's definitely linked to upgrading them. I'll try to reproduce it later for you.
Title: Re: Problem With Control Groups
Post by: x4000 on March 29, 2018, 02:56:12 pm
Thank you!  If you can throw it on mantis for Keith to get if you do find a repro, that's extra awesome, too. :)
Title: Re: Problem With Control Groups
Post by: BadgerBadger on March 29, 2018, 02:59:37 pm
Can confirm Pluto011's issue. If you look at the upgrade code in Faction.cs, it does the following:
Code: [Select]
GameEntity newEntity = GameEntity.CreateNew( squad.PlanetFaction, typeICanUpgradeInto, squad.WorldLocation, Context );       
squad.EntitySpecificOrders.CopyTo( newEntity.EntitySpecificOrders );                             
newEntity.EntitySpecificOrders.ControlGroup = squad.EntitySpecificOrders.ControlGroup;       

So the newly created entity knows it should be in a control group. Unfortunately the control group doesn't know this entity is in it. I tried adding the line
Code: [Select]
newEntity.EntitySpecificOrders.ControlGroup.AddEntity(newEntity);


to this code and it seemed to fix the problem for me. I'm not positive if correct, and it's Keith part of the code, so I'd like him to bless this approach lest there be unexpected gotchas.

Pluto, in the meantime if you just hit "M" (to select all mobile military ships) then hit Ctrl-1 (to recreate control group 1 with those ships in it), that should be a suitable workaround.
Title: Re: Problem With Control Groups
Post by: keith.lamothe on March 29, 2018, 03:12:50 pm
You're quite correct, Badger.

It was goof on my part to do the assignment directly.

The best fix would be to replace

Code: [Select]
newEntity.EntitySpecificOrders.ControlGroup = squad.EntitySpecificOrders.ControlGroup;
with

Code: [Select]
if(squad.EntitySpecificOrders.ControlGroup != null)
    squad.EntitySpecificOrders.ControlGroup.AddEntity(newEntity);
Title: Re: Problem With Control Groups
Post by: BadgerBadger on March 29, 2018, 03:19:54 pm
Fix is checked in for .717. Thanks for the bug report, Pluto011!
Title: Re: Problem With Control Groups
Post by: keith.lamothe on March 29, 2018, 05:22:24 pm
Yes, thanks very much to both of you :)