Arcen Games

General Category => AI War II => Private Alpha Discussion => : Pluto011 March 29, 2018, 01:08:55 PM

: Problem With Control Groups
: Pluto011 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.
: Re: Problem With Control Groups
: x4000 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.
: Re: Problem With Control Groups
: Pluto011 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.
: Re: Problem With Control Groups
: x4000 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?
: Re: Problem With Control Groups
: Pluto011 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.
: Re: Problem With Control Groups
: x4000 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. :)
: Re: Problem With Control Groups
: BadgerBadger 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:
:
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
:
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.
: Re: Problem With Control Groups
: keith.lamothe 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

:
newEntity.EntitySpecificOrders.ControlGroup = squad.EntitySpecificOrders.ControlGroup;
with

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