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

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #15 on: September 23, 2017, 02:39:55 pm »
Also, how's .522 coming?
Bogged down right now but the main target is finding and fixing issues that are preventing the AI's reactive-defense from working. Specifically it's not supposed to bumrush you the moment you show up on one of its planets, but instead only do that if it can easily stomp you. Otherwise it should either defend the controller (tends to have lots of shields there) while waiting for reinforcements or simply abandon the planet and retreat the defenders to function as threat against you later. That's how it's coded, anyhow, but it rarely does either of those things, which contributes to the lack of strategy/tactics in attacking AI planets.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #16 on: September 23, 2017, 03:40:44 pm »
Are you considering having the AI try to defend multiple points on a planet like in AIWC? That was a useful mechanism to allow players to slowly grind down a very strong planet piece by piece. That would be a lot harder if the AI concentrated their forces to begin with.

I look forward to seeing how the AI behaves once you've ironed out all the bugs! I'm working on allowing the Nanocaust to fully use ExternalData and ExternalConstants which will be a really nice improvement. Hopefully I'll have that done for .522 as well.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #17 on: September 24, 2017, 06:39:51 pm »
Are you considering having the AI try to defend multiple points on a planet like in AIWC? That was a useful mechanism to allow players to slowly grind down a very strong planet piece by piece.
Yep. I had moved away from it because I thought it would be more interesting, but clearly variety is needed. So I think having some planets be monolithic is good, and some planets with a more diverse placement.

Similar with wormholes, I think, though maintaining the "angle from center equals the real angle to the target planet" thing is important. So have some planets as they are now, some planets with the wormholes near the center, some with each wormhole at a different distance.

Quote
That would be a lot harder if the AI concentrated their forces to begin with.
Yea, the idea is that they don't do that unless you bring so much force that you can stomp the whole planet.

There's room for different regional AI personalities, though. An "AHHH! I saw a fly! Send Everything!" personality would be amusing.

Quote
I look forward to seeing how the AI behaves once you've ironed out all the bugs! I'm working on allowing the Nanocaust to fully use ExternalData and ExternalConstants which will be a really nice improvement.
I look forward to seeing how that works out too.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #18 on: September 24, 2017, 08:18:30 pm »
I am a fan of "Variations on a Theme" for games like this, so I think these sound like good ideas.

I think after about 1200 lines of code I have External XML code and Serialize/Deserialize working for the Nanocaust. Ugh. That really wasn't fun.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #19 on: September 24, 2017, 08:28:33 pm »
I think after about 1200 lines of code I have External XML code and Serialize/Deserialize working for the Nanocaust. Ugh. That really wasn't fun.

Serialization is never fun

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #20 on: September 24, 2017, 09:31:16 pm »
I think after about 1200 lines of code I have External XML code and Serialize/Deserialize working for the Nanocaust. Ugh. That really wasn't fun.
I don't know why it should have been so much. I can take a look when I integrate stuff.

Serialization is never fun
I actually enjoy the way we do it, it's just two mechanical steps after adding a new field (because we don't use reflection/attributes to scan the fields automatically). But it wouldn't be the first time my tastes differed from, well, everyone else ;)

Now, when it doesn't work, and you're trying to debug why deserialization barfs halfway through a huge save file, that can be very unpleasant. But even there it's much easier to debug than it used to be.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #21 on: September 24, 2017, 09:42:24 pm »
I actually enjoy the way we do it, it's just two mechanical steps after adding a new field (because we don't use reflection/attributes to scan the fields automatically). But it wouldn't be the first time my tastes differed from, well, everyone else ;)

Now, when it doesn't work, and you're trying to debug why deserialization barfs halfway through a huge save file, that can be very unpleasant. But even there it's much easier to debug than it used to be.

Lets just say that I'm glad I don't have to actually write much in the way of serialization in Minecraft. The NBT dataobject handles it all and I can treat it like a Map.  1.12 and the JSON stuff is actually a little more hands-on with serialization and even then I don't have to get very hands-on (the few times I have had to, 99% of what I need has already been written and I can copy-paste).

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #22 on: September 24, 2017, 09:55:42 pm »
The reason it was so much was that I had a bunch of fields I wanted to save from two different classes, and I decided the best way to do it would be to write distinct "Export All Data" and "Import All Data" functions. So my actual Serialize/Deserialize functions are all trivial and the work is done elsewhere. Also I wanted a number of "many element Enum to/from string" functions as well as a bunch of code to allow me to readily handle Lists of planets (the best way I could figure out to do that was to translate planets to PlanetIndex, then export/import the planet indices).

Overall I think your code is fine, I just made some perhaps imperfect architecture choices on my end. I suspect if I'd written my code from the beginning to account for the Serialization code paradigm you use then it would have been pretty straightforward. Also I think those numbers included some miscellaneous code cleanup, as well as a mechanism for showing me the state of the nanocaust while in game (I added a new bunch of code to print nanocaust status stuff in game).

I'd be happy to take some feedback once I'm sufficiently convinced the code works.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #23 on: September 24, 2017, 11:09:52 pm »
Also I wanted a number of "many element Enum to/from string"
I just cast the enum to an int (or whatever base type, almost always int) and serialize that.

Quote
(the best way I could figure out to do that was to translate planets to PlanetIndex, then export/import the planet indices)
Oh, goodness, sorry that wasn't obvious. Yea, we always serialize those by index. And if something has a PrimaryKeyID (GameEntity, PlayerAccount, ControlGroup), we use that.

In short, all serialization is primitive types, no binary/blackbox serialization of complex types.

One caveat is that some of the primary-key-id fields are Int64, and serialize without a specific type named in the code (the CLR automatically knows to use the Int64 overload) but in the deserialization you have to do ReadInt64(), not ReadInt32(). On the bright side when you try to actually deserialize in-game it will immediately cause an error if you try to use the wrong one because the type is encoded in the stream, but you won't know until that actual moment of testing because you won't get a compile error assigning "Int64 someLong = buffer.ReadInt32();"

That could be solved by converting from the "Int64 someLong = buffer.ReadInt32();" pattern to the "Int64 someLong; buffer.Fill(out someLong);" pattern, but the latter is less intuitive (I do use it in the XML stuff).

Quote
I suspect if I'd written my code from the beginning to account for the Serialization code paradigm you use then it would have been pretty straightforward.
That was my thought as well.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #24 on: September 25, 2017, 05:02:21 pm »
Hey Keith, unrelated, is there a mechanism to tell me How Many (or What Strength) of Cloaked Ships on a planet?

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #25 on: September 25, 2017, 05:28:55 pm »
Hey Keith, unrelated, is there a mechanism to tell me How Many (or What Strength) of Cloaked Ships on a planet?
There's no convenience function to do the work for you, but you can do the work yourself by checking otherEntity.GetIsVisibleTo(myWorldSide);

In other words:
Code: [Select]
FInt cloakedNonFriendlyStrength = FInt.Zero;
myCombatSide.DoForRelatedSides( SideRelationship.SidesThatAreHostileTowardsMe.Add( SideRelationship.SidesThatAreNeutralTowardsMe ), delegate ( CombatSide nonFriendlySide )
{
    nonFriendlySide.Entities.DoForEntities( GameEntityCategory.Ship, delegate ( GameEntity entity )
    {
        if ( entity.GetIsVisibleTo( myCombatSide.WorldSide ) )
            return DelReturn.Continue;
        cloakedNonFriendlyStrength += entity.TypeData.BalanceStats.StrengthPerSquad;
        return DelReturn.Continue;
    } );
    return DelReturn.Continue;
} );

Does that handle it? That's not cheap computationally, so it's a matter of how often you're doing this and whether it's in long range planning, 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!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #26 on: September 25, 2017, 05:37:16 pm »
The place this would go is in PerSimStep, so I don't think I want something that expensive.

 Here's what I'm trying to do. When the nanocaust has attacked a planet to conquer it (it can attack without wanting to conquer too), it checks whether the enemy forces on the planet is "Defeated" before it declares the planet conquered and builds a Nanocaust Construction Center. At the moment, my isPlanetConquered() function just checks the Strength of the human and AI forces on the planet and makes sure it's no greater than the Strength of the Warp Gate/Controller. This can cause the nanocaust forces on the planet sitting around for 5-10 minutes while wearing down the cloaking on a high-tier Guardian.

One option to improve this would be to check whether there are any cloaked ships and ignore them for the strength calculation. It wouldn't be the worst thing in the world to use the code you have, since the isPlanetConquered function only runs when a Nanocaust Conquest Fleet is fighting on a planet. But I'd like a better option. If I could get the construction center to build itself over the course of a few minutes (and I'd try to make sure that a building construction center would look tasty to the targeting algorithm) that might be preferable, but I haven't tried that yet.

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #27 on: September 26, 2017, 09:58:54 am »
Unrelated to anything. There was some discussion a while ago about getting voice alerts for things, and there was actually a video for Keith creating hooks for audio queues. Did the spoken-word audio stuff ever actually make it into the game? I don't think I've ever heard it.

Offline CodeMichael

  • Jr. Member
  • **
  • Posts: 65
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #28 on: September 30, 2017, 09:16:16 am »
Hey guys, I finally got around to testing the latest build (haven't booted up in a little bit).  I'm experiencing
 the issue as detailed in the previous release's notes: https://forums.arcengames.com/ai-war-ii/ai-war-2-v0-518-released!-'active-selections-and-capturing-the-uncapturable'/msg216188/#msg216188

I'm running on linux and am still having the issue (see attached screenshot).  I've switch to the crazy_test build, same thing.  I'd be happy to help troubleshoot.  Just let me know what you'd like me to do.

Thanks

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: AI War 2 v0.521 Released! "Fuel/Power Rebalance and Custom XML Data"
« Reply #29 on: September 30, 2017, 09:26:11 am »
Two things. Are you experiencing this on .521? If not, update things with Steam and try again.

Failing that I propose two attempts. First, you can try Keith's suggestion here: https://forums.arcengames.com/ai-war-ii/ai-war-2-v0-518-released!-'active-selections-and-capturing-the-uncapturable'/msg216165/#msg216165, see if that clears things up.

Second, try deleting your current install and checking out a fresh copy (from the main Steam branch, not crazy_test).