Author Topic: Save File Generation  (Read 14527 times)

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #30 on: November 07, 2011, 10:32:36 am »
Oh, is it against the EULA to attach a debugger to a full, live instance of AI War?

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Save File Generation
« Reply #31 on: November 07, 2011, 10:34:00 am »
No, debug away.
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 TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #32 on: November 07, 2011, 10:37:49 am »
No, debug away.

Cool. I won't know without trying, but I may be able to pull off all kinds of stupid stuff doing this.  :D

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #33 on: March 18, 2012, 05:04:27 pm »
Sorry for necroing topic, but now I am interested in the format used for AI players. I know large portions of it are similar to human players, but I'm guessing the the difficulty, AI type, and other stuff is in there somewhere. I'm just having trouble figuring out where.

EDIT: I managed figure out where the AIP progress is stored. The third field of the 09 section in the AI players section
« Last Edit: March 18, 2012, 05:31:11 pm by techsy730 »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Save File Generation
« Reply #34 on: March 18, 2012, 05:32:42 pm »
The format is identical, but it's just set to 0 or 1 for the human players.  I forget which number it is that specifically is for the AI, but it's not too far in and it's in FInt format: http://stackoverflow.com/questions/605124/fixed-point-math-in-c

So you'll have to convert back and forth between the integer representation of that and your idea of what you set would be.  Setting one AI to 1 and another to 10, then saving and looking at that save file would be an easy way to find 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!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Save File Generation
« Reply #35 on: March 18, 2012, 05:37:05 pm »
All players use the same class, but there are some AI-specific fields.  Specifically you're probably interested in the output of this part of Player serialization:
Code: [Select]
        if ( this.Type == PlayerType.AI )
            this.AddStateStringValues( Builder, startingLength, "06", this.AIDifficulty.RawValue,
                (int)AIType, this.NextWaveSize.RawValue );

AIDifficulty is an FInt, which is just an Int64 (stored in the RawValue field) which has >> 12  ( / 4096) applied before any math is done with it.  So diff 10 = 40960.

AIType is an enum, and it serializes the ordinal.  The actual enums are listed in the disabledaitypes file (at least, those in existence at that time when it was created), but here's the full list :
Code: [Select]
public enum AIType
{
    None=0,
    Entrenched_Homeworlder, //planets all heavily defended, does moderate attacks on players
    Vicious_Raider, //planets all moderately defended, does heavy attacks on players
    Fortress_Baron, //planets mostly moderately defended, but the core planets are incredibly highly defended
    Sledge_Hammer, //all guys are routed to one planet, then the next
    Assassin, //planets all moderately defended, harasses the strongest player with prejudice
    Bully, //planets all moderately defended, harasses the weakest player with prejudice
    Turtle, //planets all very-to-incredibly heavily defended, but no attacks on players
    Technologist_Homeworlder, //planets all heavily defended, does moderate attacks on players with higher technology
    Technologist_Raider, //planets all moderately defended, does heavy attacks on players with higher technology
    Mad_Bomber=10, //planets all lightly defended except core, does extremely heavy attacks on players
    Feeding_Parasite, //uses parasite raids almost exclusively
    Stealth_Master, //uses stealth raids almost exclusively
    Special_Forces_Captain, //uses special forces in place of regular guard posts
    Train_Master, //uses many, many astro trains
    Teleporter_Turtle, //like the turtle, but specializing in teleporting ships
    Counter_Spy, //uses the counterspy superweapon on every planet, making the player fight blind
    Scorched_Earth, //destroys any planet it is knocked off of
    Shadow_Master, //like the stealth master, but also has the Planetary Cloaker
    Attritioner, //planets moderately defended except for Attrition Emitters, does heavy attacks on players
    Backdoor_Hacker=20, //planets moderately defended, has a backdoor wormhole to each player's planet
    Random_Easier,
    Random_Moderate,
    Random_Harder,
    Random_All,
    Mine_Enthusiast, //lots of mines around wormholes
    The_Tank, //tanks, plus harder attacks
    Random_Moderate_And_Easier,
    Technologist_Parasite, //like feeding parasite, but higher tech
    Technologist_Turtle, //like turtle, but higher tech
    Technologist_Sledge_Hammer=30, //like sledge hammer, but higher tech
    The_Core, //only uses core ships
    Raid_Engine, //uses many raid engines (expansion 1)
    Alarmist, //use many alarm posts (expansion 1)
    Random_Harder_Non_Technologist,
    Random_All_Non_Technologist,
    Camouflager, //all mobile ships have camouflage (expansion 1)
    Experimentalist, //uses all experimental ships (expansion 1)
    StarfleetCommander, //uses only starships (expansion 1)
    ZenithDescendant, //uses only zenith ships (expansion 1)
    Golemite=40, //uses many golems (expansion 1)
    SpeedRacer, //uses speed-enhancing ships all over (expansion 1)
    Peacemaker, //uses anti-golem/starship/wearhead etc weapons (expansion 1)
    RadarJammer, //uses radar jammers on all its planets (expansion 1)
    OneWayDoormaster, //uses black hole machines on all its planets (expansion 1)
    TagTeamer, //defensive AI whose guards don't use stay near their posts (expansion 1)
    ShieldNinny, //planets all heavily defended, with planetary shield boosts or inhibits but no attacks on players (expansion 1)
    GravDriller, //aggressive AI with many gravity drill stations (expansion 1)
    NeinzulClusterBomber, // builds Neinzul Clusters on all of its planets (expansion 2)
    NeinzulViralEnthusiast, // builds Neinzul Viral Clusters on all of its wormholes (expansion 2)
    NeinzulNester, // builds Neinzul Nests on most of its planets (expansion 2)
    NeinzulYoungster, // waves are all Neinzul Younglings, waves warning time / 2, planets lightly defended (expansion 2)
    SupportCorps, // no waves, adds supporting units to ally waves, adds supporting units to own planets and ally planets (expansion 2)
    WarpJumper, // no warp gates, can launch waves against any non-warp-jammed planet (expansion 2)
    Vanilla, // expansion 3
    Everything, // expansion 3
    Retaliatory, // counter attack posts seeded lots (expansion 3)
    Spireling, // starts will all spire bonus types unlocked (expansion 3)
    CraftySpire, // seeds lots of various spirecraft (expansion 3)
    Thief, // starts with and uses lots of etherjet tractors, spire tractor platforms, parasites (expansion 3)
    ExtremeRaider, // Vicious Raider ++ (expansion 3)
    SpireHammer, // Includes a Spire Capital Ship in every wave (expansion 3)
    Length
}

Bear in mind that you won't see the random types in the serialization, but the actual type picked.

By the way, have you actually managed to attach a debugger to the unity version of AIW?  With the .NET/SlimDX versions it was trivial, but there's only one way I know of to debug the current version and it involves the Unity Editor and is quite crash-prone.
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 TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #36 on: March 18, 2012, 05:45:40 pm »
Thanks.

Just for fun, I also set Player 7 to be an AI player. (I just copied Player 8's line). Strangely, the AI player, despite being controlled like an AI, was allied to the player. This caused all kinds of silliness when the reinforcement cycle came. (The "allied AI" used the "real AI's" guard posts, immediately aggravating them, and causing them to be freed like if a human did.)

I'll see what happens when the waves come around. :P

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Save File Generation
« Reply #37 on: March 18, 2012, 05:54:41 pm »
Just for fun, I also set Player 7 to be an AI player. (I just copied Player 8's line).
AHHHH! Good grief how did the game still run? ;)

Indexes 8 and 9 are always treated as AI for most purposes, and Indexes 0-7 as human.  But I suppose if you copied it straight over that would happen...  The consequences be upon your own head ;)
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 TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #38 on: March 18, 2012, 06:03:11 pm »
After I see what happens when the "allied AI" sends a wave.

And then finally, because I love torturing game engines, I'm going to see what happens when I set my own player type to AI type.  ;D

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #39 on: March 18, 2012, 08:46:08 pm »
Well, when I made myself an "AI", it
a) Seeing that there were no human players left, it declared the human player team as lost. As I was an AI player, I won. :P
b) Seeing that I never had my home planet seeded like an AI home planet (due to it not being an AI home planet previously), it went ahead and added a bunch of stuff to the planet. So I got a bunch of core guard posts, special forces guard posts, wormhole guard posts, Mk. V guardians, a fortress, a Core forcefield, an AI eye, and a Spire archive.
c) Knowledge, energy, resources, and other stuff did not appear in my top info bar. Makes sense, as the AI does not use these things.
d) I had infinite energy and resources. Strangely, my knowledge acted as normal.
e) My science labs did not gather knowledge
f) Clicking on the "stats" button crashed the game
g) Got a large number of unhandled errors and command errors.
h) The screen flickered often
i) Inexplicably, I got some Mk. III tractor turrets and Stealth tachyon turrets around my wormholes.
j) I seemed to have a slightly higher ship cap than normal. (100 Mk. I basic turrets instead of 98, 6 Mk. I fortresses instead of 5)
k) Renamed my player name to the "proper" name (AI type (difficulty))
l) My Home command station recieved external invincibility from my core guard posts

So yea, interesting experience.

EDIT: For the curious, here are the logs of the errors I was getting

It seems that it was freaking out because my "hacking antagonism" was not initialized properly, so it was trying to divide by zero.
The AI loop stuff seemed to be freaking out as well.
« Last Edit: March 18, 2012, 09:29:27 pm by techsy730 »

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #40 on: March 19, 2012, 09:50:38 am »
Hmm, any other ideas for torturing this poor engine?
Maybe something like a "null" map, no players, no planets, no ships, no anything. (If it crashes with no planets, I'll give it one planet). Silly, but also sounds boring.

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #41 on: March 26, 2012, 07:52:46 pm »
Hmm, for AI difficulty, (Player.AIDifficulty) is an FInt
FInt is backed by a long (FInt.RawValue)
Long is a typedef'ed alias to Int64
Int64.MaxValue = 9,223,372,036,854,775,807


That >> 12 is 2,251,799,813,685,247.

Well, there is my new AI difficulty to try. :D


Also, Player.IsOmnipotent
If only I knew how to set that to true...

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Save File Generation
« Reply #42 on: March 26, 2012, 07:56:46 pm »
Arithmetic Overflow (V) To Murdoch in 0:03
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 TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Save File Generation
« Reply #43 on: March 26, 2012, 08:08:01 pm »
Actually, I'm not getting any waves at all.

What was the math for "time between waves" again?

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Save File Generation
« Reply #44 on: March 26, 2012, 08:21:54 pm »
Arithmetic Overflow (V) To Murdoch in 0:03

Actually, I'm not getting any waves at all.

What was the math for "time between waves" again?

Arithmetic Overflow (V) To Murdoch in -0:03
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!