Author Topic: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"  (Read 693 times)

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Release notes here!

The main player-facing changes here are the rebalancing of fuel and power.

Fuel costs have been halved so that your fleet size is not almost always capped by Fuel, but sometimes by Science.

Power costs themselves are unchanged, but spending science on power-consuming units now gives you a galaxy-wide +% boost to power production. So if you have Planet A which naturally produces 1000 power, and Planet B which naturally produces 1500 power, spending 1000 science on turret techs increases Planet A's power output by 100 and Planet B's by 150. This allows you to invest in "thicker" defense rather than only in more diverse defense.

More changes are needed in both areas, of course. Please let us know what you think.

On the non-player-facing side, there's the huge addition of letting modders attach custom data to the xml records that form the meat of the game definitions. So you can add custom external constants, or custom fields to map types or AI types or ship types or whatever. These use a namespace system similar to the External Data you can attach to in-game objects, so that different mods don't stomp on each other.

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: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #1 on: September 18, 2017, 11:47:51 PM »
Does the decrease in fuel cost allow the AI to respond much more strongly to hacking? See Mantis 0019232.

From a one-game sample, I feel like I'd bump the "power obtained per Science spent" up a bit and make things cost a bit more fuel. Other people may have different opinions (as may I after I play a few more games). The changes are welcome though!
« Last Edit: September 19, 2017, 12:18:36 AM by BadgerBadger »

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #2 on: September 19, 2017, 09:28:19 AM »
Does the decrease in fuel cost allow the AI to respond much more strongly to hacking? See Mantis 0019232.
Neither fuel nor power have any impact on the AI.

Crazy hack-response, there. Have you done other hacks at 300 AIP?

Quote
From a one-game sample, I feel like I'd bump the "power obtained per Science spent" up a bit and make things cost a bit more fuel. Other people may have different opinions (as may I after I play a few more games). The changes are welcome though!
Glad to make some progress on that front :) And I'm happy to adjust things further. You can test alternate values yourself, if you'd like:

Fuel - /GameData/Configuration/Balance_FuelCost/KDL_VanillaFuelCosts.xml
Change the fuel_multiplier attribute on the High, Normal, and Low nodes accordingly. They used to be 1.5, 1, and 0.5 respectively and are currently 0.75, 0.5, and 0.25.

Power - /GameData/Configuration/ExternalConstants/KDL_VanillaConstants.xml
Change the balance_power_consuming_unit_techs_power_boost_ratio attribute , it's currently 0.10, which means that spending balance_base_science_scale (1000) points on unlocking power-consuming units gives +10% power production.
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: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #3 on: September 19, 2017, 10:36:14 AM »
I'm not sure if I've tried hacking at 300+ AIP before.  I can run some experiments later though and see how the response feels at different levels. What sort of feedback would you like?

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #4 on: September 19, 2017, 11:42:23 AM »
I'm not sure if I've tried hacking at 300+ AIP before.  I can run some experiments later though and see how the response feels at different levels. What sort of feedback would you like?
Mainly I'd like to know at what point does the response become excessive from a balance perspective, and at what point does it become excessive from a technical perspective (UI stops handling it well, etc, though it is supposed to scale the number of units represented by each icon in the sidebar in such cases.).
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: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #5 on: September 19, 2017, 06:50:01 PM »
I hit a weird problem with custom XML data. I was trying to move some of the balance-related nanocaust settings to the external XML so it's easier to tune. I created a new xml file thusly:
Code: [Select]
(18:47:37) hostname:~/AIWar2/GameData/Configuration/ExternalConstants $ cat Nanocaust_Constants.xml
<?xml version="1.0" encoding="utf-8"?>
<root
    timeForMarkIIUpgrade="900"
    timeForMarkIIIUpgrade="7200"
    timeForFirstFrenzy="120"
    maxNanobotLifespan="500"
    minNanobotLifespan="120"
    minTimeBetweenWaves="180"
>
</root>

I haven't put anything in the C# to interact with it yet. Now when I start the game I get errors like the following in my ArcenDebugLog.txt
Code: [Select]
9/19/2017 6:43:22 PM    Errors in reading ExternalConstants
'ExternalConstants_1' has missing or empty comma-delimited list in attribute 'balance_planet_resource_multipliers'
'ExternalConstants_1' has missing or zero int in attribute 'waiting_before_wormhole_distance_gravwell_radius_ratio'
'ExternalConstants_1' has missing or zero int in attribute 'guard_goes_free_distance_to_grav_well_radius_ratio'
'ExternalConstants_1' has missing or zero int in attribute 'guard_releases_internal_ships_distance_to_grav_well_radius_ratio'

What am I doing wrong? I haven't changed the KDL_ExternalConstants.xml.

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #6 on: September 20, 2017, 09:56:27 AM »
Code: [Select]
(18:47:37) hostname:~/AIWar2/GameData/Configuration/ExternalConstants $ cat Nanocaust_Constants.xml
<?xml version="1.0" encoding="utf-8"?>
<root
    timeForMarkIIUpgrade="900"
    timeForMarkIIIUpgrade="7200"
    timeForFirstFrenzy="120"
    maxNanobotLifespan="500"
    minNanobotLifespan="120"
    minTimeBetweenWaves="180"
>
</root>
Try making that opening line:
<root is_partial_record="true"

Without that your file functions as a replacement for the default one (which can be useful), but with it it's just an amendment to it, which should avoid the errors you saw.

That said, if you want to be able to reference those in-game you'll need to follow the custom xml data naming pattern, like:
Code: [Select]
custom_int_nanocaust_timeForMarkIIUpgrade="900"
"custom_" is just a literal, tells it to process it as a custom field.
"int_" is the type; other valid values are bool, FInt, float, and string
"nanocaust_" is the namespace, can be whatever you want, to differentiate it from an int field some other mod names "timeForMarkIIUpgrade".

In game you could reference that as:
Code: [Select]
int timeForMarkIIUpgrade = ExternalConstants.Instance.GetCustomData( "nanocaust" ).GetInt( "timeForMarkIIUpgrade" );
Though a better pattern is:
Code: [Select]
CustomDataSet nanocaustConstants = ExternalConstants.Instance.GetCustomData( "nanocaust" );
int timeForMarkIIUpgrade = nanocaustConstants.GetInt( "timeForMarkIIUpgrade" );

I may change the getter pattern so that you're passing in int indices (or the equivalent) most of the time, for performance reasons, but for now this is fine.
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: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #7 on: September 20, 2017, 10:48:26 AM »
Man, usually I do a better job of reading your initial comments than I seem to have done here... Thanks for recapitulating things for me! It makes much more sense now.

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #8 on: September 20, 2017, 12:04:21 PM »
Man, usually I do a better job of reading your initial comments than I seem to have done here... Thanks for recapitulating things for me! It makes much more sense now.
No problem :) All this is under-documented, to put it mildly.
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: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #9 on: September 20, 2017, 01:04:09 PM »
Performance-related question then. Lets say in some PerSimStep code I need access to some of the ExternalConstants data. I'd like to load all such data once at game start time. This is easy for when I am first beginning a game, but what about when someone reloads a game. In fact, lets assume that someone saved a game, fiddled with some numbers in the XML, then reloaded the game. Is there any way for my PerSimStep code to tell whether a game has just been loaded?

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #10 on: September 20, 2017, 02:15:00 PM »
Performance-related question then. Lets say in some PerSimStep code I need access to some of the ExternalConstants data. I'd like to load all such data once at game start time. This is easy for when I am first beginning a game, but what about when someone reloads a game. In fact, lets assume that someone saved a game, fiddled with some numbers in the XML, then reloaded the game. Is there any way for my PerSimStep code to tell whether a game has just been loaded?
ExternalConstants, and all the /GameData/Configuration/ xml, is loaded when the application starts, before you see the main menu. This is partly evident in that the main menu is defined in that xml :)

It's not re-loaded when you start or load a game.

There is a development-purposes-only key combo for reloading the data mid-stream but it's been busted for months, iirc.

So you're welcome to cache it.

That said, if you're only referencing the data once per step, or a few times per step, it's not going to make a difference.

That said, good practices now help later. Normally I avoid caching things if there's any chance the cache may become incorrect later (if there's ever more than one way to answer a question, they're both wrong), but that's basically not the case here. Also, if you load the data into your own structures you can lay them out for type-safety and intellisense, etc.
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: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #11 on: September 21, 2017, 01:22:08 PM »
Okay, here's my new nanocaust external data xml file
Code: [Select]
(13:20:36) hostname:~/AIWar2/GameData/Configuration/ExternalConstants $ cat Nanocaust_Constants.xml
<?xml version="1.0" encoding="utf-8"?>
<root
    is_partial_record="true"
    custom_int_nanocaust_timeForMarkIIUpgrade="900"
    custom_int_nanocaust_timeForMarkIIIUpgrade="7200"
    custom_int_nanocaust_timeForFirstFrenzy="120"
    custom_int_nanocaust_maxNanobotLifespan="500"
    custom_int_nanocaust_minNanobotLifespan="120"
    custom_int_nanocaust_minTimeBetweenWaves="180"
>
</root>

And now I see
Code: [Select]
9/21/2017 1:20:16 PM    Finished calling RunInitialSetup for Arcen.AIW2.External.InitialSetupForDLL from AIWarExternalCode
9/21/2017 1:20:18 PM    Errors in reading ExternalConstants
'ExternalConstants_1' has missing or empty comma-delimited list in attribute 'balance_planet_resource_multipliers'
9/21/2017 1:20:18 PM    Harmless Info: dll AIWarExternalVisualizationCode does not contain a IInitialSetupForDLL type. This is fine, but if you're the author of that dll and want it to run init-code, it ain't happening right now.

in my ArcenDebugLog.txt. Suggestions?

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #12 on: September 21, 2017, 03:39:48 PM »
Code: [Select]
'ExternalConstants_1' has missing or empty comma-delimited list in attribute 'balance_planet_resource_multipliers'
Sorry, bug on my part that it still requires that even in a partial record. Fixed for next version.

As a workaround until that version is out, you can copy the balance_planet_resource_multipliers line from the main file into your nanocaust one.
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: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #13 on: September 21, 2017, 07:02:55 PM »
For Keith.

I've been wishing we had actual tooltips for the resource bar at the top. This patch will provide really cursory tooltips to explain what the different resources are. You will need to redo this eventually, since the descriptions are very brief. But someone on the discord was complaining about the lack of this, so I figured having something is better than nothing. Just look for the HandleMouseover overrides (I have some other local modifications in the file that you probably want to ignore).
« Last Edit: September 21, 2017, 11:23:17 PM by BadgerBadger »

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 573
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #14 on: September 22, 2017, 04:00:34 PM »
Also, how's .522 coming?