Author Topic: AI War 2 v0.507 Released! "When Menus Attack"  (Read 424 times)

Online keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,257
AI War 2 v0.507 Released! "When Menus Attack"
« on: August 08, 2017, 07:33:50 AM »
Release notes here!

This was actually out last night but I didn't know I was supposed to write the post :)

It's UI all the way down this time. More revisions to the build menu to drive that towards complete-for-1.0, and the tech menu is back (and a lot like the new build menu), and condensing some key info from a debug/prototype location into the sidebar.

Much of the work was recorded, if you're interested:

Part 1 - Programming : How Not To Program
Part 2 - Programming : Sidebar Summary Counts
Part 3 - Programming : Build Queue Color Change

Enjoy :)

Keith
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 578
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #1 on: August 08, 2017, 06:00:11 PM »
How would people feel about including the "Strength" of a world's units in the sidebar, for example like in this picture:

The code is quite simple
Code: [Select]
   
    public static void WriteSquadAndShipCounts( ArcenDoubleCharacterBuffer Buffer, SideRelationship relationship )
        {
            Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed();
            if ( planet == null )
                return;

            CombatSide localSide = planet.Combat.GetSideForWorldSide( World_AIW2.Instance.GetLocalSide() );

            int shipResult = 0;
            int squadResult = 0;
            int strength = 0;
            localSide.DoForRelatedSides( relationship, delegate ( CombatSide side )
            {
                if ( relationship == SideRelationship.SidesIAmFriendlyTowards && side == localSide )
                    return DelReturn.Continue;
                side.Entities.DoForEntities( GameEntityCategory.Ship, delegate ( GameEntity ship )
                {
                  /* I'm not positive about this calculation; I saw it in the AI code                                                             
                     so I'm copying it. I seem to remember Keith saying LongRangePlanning might sometimes be null                                 
                     */
                  if(ship.LongRangePlanningData != null)
                    strength += (int)(ship.TypeData.BalanceStats.StrengthPerSquad + ship.LongRangePlanningData.StrengthOfContents);
                  else
                    strength += (int)ship.TypeData.BalanceStats.StrengthPerSquad;

                    shipResult += 1 + ship.GetCurrentExtraShipsInSquad();
                    squadResult++;
                    return DelReturn.Continue;
                } );
                return DelReturn.Continue;
            } );

            if ( squadResult > 0 )
            {
                Buffer
                     .Add( squadResult )
                     .Add( " squads (" )
                     .Add( shipResult )
                     .Add( " ships " )
                     .Add( strength )
                     .Add( " strength)"
                           );
            }
        }


And then bumping the size of that element in KDL_UIWindows.xml, something like (I chose 30, the old value was 20)
Code: [Select]
    <element prefab_lookup_name="BasicText" width="30" height="3.5" type_name="tEnemySummary" />
    <element prefab_lookup_name="BasicText" width="30" height="3.5" type_name="tPlayerSummary" />
    <element prefab_lookup_name="BasicText" width="30" height="3.5" type_name="tAllySummary" />

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 578
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #2 on: August 08, 2017, 08:14:19 PM »
Got some improvement in metal readability for y'all. This is mostly "moving code around to make the existing stuff more readable"; not sure if Keith wants it as is, but I'm going to be playing this way until further notice. It's a large readability improvement. I print "Current amount of metal"  "Net metal income" by default. If you don't have enough metal to do the construction you desire, it also shows "time required to finish the construction you have queued", "total amount of metal requested" and "metalProducedLastFrame". Here are a couple pictures.

By the way, adding a "%" to an ArcenDoubleCharacterBuffer appears to actually print a /.

Here are the changes for this.

For Window_ResourceBar.cs
Code: [Select]
            public override void GetTextToShow( ArcenDoubleCharacterBuffer buffer )
            {
                WorldSide localSide = World_AIW2.Instance.GetLocalSide();
                if ( localSide == null )
                    return;
                buffer.Add( "<sprite name=\"Metal\">" );
                buffer.Add( localSide.StoredMetal.IntValue.ToString( "#,##0" ) );

                if ( localSide.LastFrame_TotalMetalFlowRequested > 0 )
                  {
                    buffer.Add( "   (" );
                    int amountSpentLastFrame = localSide.LastFrame_MetalSpent.IntValue;
                    int incomeLastFrame = localSide.LastFrame_MetalProduced.GetNearestIntPreferringHigher();
                    int netIncome = incomeLastFrame - amountSpentLastFrame;
                    if(netIncome > 0)
                      buffer.Add( "+" );
                    buffer.Add( netIncome);
                    buffer.Add( " net)" );
                    if ( localSide.LastFrame_MetalFlowRequestPortionMet < FInt.One &&
                        localSide.LastFrame_MetalProduced > FInt.Zero )
                    {
                        buffer.Add( " (" );
                        int framesLeft = ( localSide.LastFrame_TotalMetalFlowProjectedRequests / localSide.LastFrame_MetalProduced ).GetNearestIntPreferringHigher();
                        int secondsLeft = ( framesLeft * World_AIW2.Instance.SimulationProfile.SecondsPerFrameSim ).GetNearestIntPreferringHigher();
                        buffer.Add( Engine_Universal.ToHoursAndMinutesString( secondsLeft ) );
                        buffer.Add( " est)" ); //estimated time left                                                                                                                                                                             
                        buffer.Add( "\n required: " ).Add( localSide.LastFrame_TotalMetalFlowProjectedRequests.IntValue ).Add( "\nproduced: " ).Add( localSide.LastFrame_MetalProduced.GetNearestIntPreferringHigher() );
                    }
                }
            }

and in KDL_Window.xml
Code: [Select]
                <window name="Window_InGameOutlineSidebar"
              dll_name="AIWarExternalCode"
              type_name="Arcen.AIW2.External.Window_InGameOutlineSidebar"
              x="2.0"
              y="18.0" <!-- move this down a bit -->
              width="20"
              height="60"
....
<!-- move elements of the gui toggling window down a bit since we are lengthening the resource bar -->
    <element prefab_lookup_name="BasicText" y="4.0" width="10" height="2" type_name="tVersion" />
    <element prefab_lookup_name="ButtonBlueSmallerCenter" y="7.0" width="10" height="3" type_name="bToggleGUI" />
......
<!-- make the metal field 20 wide instead of 10, then move everything else over -->
       <element prefab_lookup_name="BlackBackgroundText" x="10.0" width="20" height="4" font_size="13" type_name="tMetal" />
       <element prefab_lookup_name="BlackBackgroundText" x="30.0" width="10" height="4" font_size="13" type_name="tFuel" />
       <element prefab_lookup_name="BlackBackgroundText" x="40.0" width="10" height="4" font_size="13" type_name="tPower" />
       <element prefab_lookup_name="BlackBackgroundText" x="50.0" width="10" height="4" font_size="13" type_name="tScience" />
       <element prefab_lookup_name="BlackBackgroundText" x="60.0" width="10" height="4" font_size="13" type_name="tHacking" />
       <element prefab_lookup_name="BlackBackgroundText" x="70.0" width="10" height="4" font_size="13" type_name="tAIProgress" />
       <element prefab_lookup_name="BlackBackgroundText" x="80.0" width="10" height="4" font_size="13" type_name="tThreat" />
       <element prefab_lookup_name="BlackBackgroundText" x="90.0" width="10" height="4" font_size="13" type_name="tAttack" />
<!-- move the wave prediction/CPA down a bit -->
<element prefab_lookup_name="BasicText" y="8.0" width="30" height="3" type_name="tWavePrediction" />
       <element prefab_lookup_name="BasicText" y="11.0" width="30" height="3" type_name="tCPAPrediction" />


 

Online keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,257
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #3 on: August 09, 2017, 07:55:27 AM »
Looks good, thanks :) On the metal-starved case that's a lot of text to show all at once in the display itself as opposed to a tooltip. I need to add tooltip support for those, and I've done part of what is necessary.

For the required and produced numbers, would it suffice for the surface display to replace those with an X%, where X is "amount you actually produce each frame" divided by "amount you need to produce each frame to do everything you're trying to do"?

And actually in the starvation case I wonder if maybe we can skip showing the stockpile and the net since they're going to both be either zero or close to it.

Seems to me that having the "you have enough metal" and the "you do not have enough metal" cases look fundamentally different on the UI is a good thing. Is it?
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 578
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #4 on: August 09, 2017, 09:29:10 AM »
Yeah, there definitely needs to be tooltip support for things like "Where is my money being spent?" What if the metal portion of the resource bar looked like text and had a tooltip, but was also a button you could click on to get to a more detailed breakdown of spending (like the old Resource Flows window in AIWC?)

I kinda like actually knowing the metal numbers rather than % myself, but that might be my AIWC background. For me I thought the AIWC data was fine.

For the starvation case, I think there needs to be clear visual feedback about it, and the player should then be given an idea of "How long is it going to take to un-starve myself". Also it would be good to let the player figure out what is starving them so they can prioritize things. Lets say I'm rebuilding my fleet/turrets/a bunch of planets after a devastating CPA. I need to be able to figure out where to allocate my scarce resources to A. get my income back and B. rebuild the most critical things first. Maybe I don't need my starships or flagships or golems immediately, but I need to get all my metal harvesters back online and get turrets on my border worlds ASAP. Can we control/represent this effectively?

I am open to a number of possible ways of doing this, and don't feel very passionately about what I've coded so far.

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 578
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #5 on: August 10, 2017, 01:16:59 PM »
How's .508 coming? Lots of thorny bugs?

Online keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,257
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #6 on: August 10, 2017, 01:24:00 PM »
How's .508 coming? Lots of thorny bugs?

Quote from: keith.lamothe
Getting text onto the image buttons may take another video-of-keith-slamming-his-head-repeatedly-into-a-brick-wall but needs to happen sometime.

Quote from: Unity
You attempted to add text in an intuitive way. System returned Cthulhu.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 578
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #7 on: August 10, 2017, 01:30:05 PM »
My condolences to your sanity

Online keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,257
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #8 on: August 10, 2017, 01:47:36 PM »
Text! I see text! It's not completely ignoring me!

(granted, this was by directly setting the field the hard way, but hey)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 578
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #9 on: August 10, 2017, 03:39:03 PM »
Hey, that's progress! Unrelated: is there an easy way to make the nanocaust reduce AI Progress whenever it captures a planet to compensate for the progress from destroying the planet controller? I think you were considering changing the AI Progress to only be incremented when the humans capture a planet (not a non-human-aligned minor faction), but in the meantime I'm interested in hacking it so I can do some balance work.

Online keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,257
Re: AI War 2 v0.507 Released! "When Menus Attack"
« Reply #10 on: August 10, 2017, 07:51:07 PM »
Hey, that's progress!
Yep :) A bunch more since then, just waiting until Chris is around to do a push.

Quote
Unrelated: is there an easy way to make the nanocaust reduce AI Progress whenever it captures a planet to compensate for the progress from destroying the planet controller?
You can call World_AIW2.Instance.ChangeAIP() from any code in the sim context (nanocaust's per-sim-step logic, for instance). You may have to make up some parameters but it'll work.

As far as detecting when to do that, you could keep a count of nanocausted planets and detect when that goes up.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!