ai modding

I want my 15 rapid-fire quantum torpedo launchers Uber-Defiant now! - Get help from modders. Share your work. Discuss modifications.
1, 2, 3
posted on April 4th, 2013, 2:12 am
I continue to try and improve on my AI for my personal mod in A2 and also for Fleet Ops and was wondering if I could get an explanation of the following from the guide on this site:
Step 1, the Strategic Map

Parameters are specified in the strategic_AI_config.txt file.

Parameters that are important to the strategic AI are:

// number of map units per grid sell (i.e. 400x400 units per grid cell)
#define goal_map_resolution 400

// Fraction of bleedover during threat relax
double relaxation_coefficient = 0.8;

// Number of threat relax cycles. This becomes how far away a threat is felt.
int relaxation_cycles = 2;

I'm interested in the 400x400 units per grid cell - #define goal_map_resolution 400. If you play the game with the grid overlay in place on screen is this saying that every individual grid shown is 400x400 units (of something, meters, kilometers, clicks?) So the the goal_map_resolution = 400 is one actual grid on screen? Stock A2 and FO both have that as 800 (every setting in the strategic_ai_cfg.txt is 800) so does that mean each grid shown on screen is 800x800 units (of something) instead of 400?

Because the 6 player map in stock A2 called "wide open" is 240 x 240 grids, it's a 24000x24000 map size. So I'm not understanding how the 400 and 800 is being represented on any map?

The following is in the RTS_CFG file under strategic AI parameters:
AI_GRID_SIZE *

Float, A2 Default: 400.0

A2 Hardcoded Default: 400.0

Original comments: STRATEGIC AI PARAMETERS. Untested: likely affects the AIP Goal Parameters.

So is the 400x400 map unit I referenced earlier above where this comes from as it's hardcoded so it doesn't matter what you make it? So the stock game defining a goal_map_resolution of 800 is actually hardcoded to 400?

Regards, rifraf
posted on April 4th, 2013, 4:36 am
At this point it's pretty much divining an answer. There's no direct way to test almost any of the AI goal parameter variables, and the only documentation that's available is relatively incomplete, at best. What's on the guide for AI is pretty much the best I can do - and that "best" is pretty crappy.

goal map resolution is in all likelihood a separate variable from the actual intrinsic grid cell unit counts. Grid cells that pertain to construction are set differently, not affected by the AI settings. AI grid size is not for construction.

Documentation for relaxation cycles is undoubtedly wrong (it's contradicted later on - written by the same AI coder btw): likely some value to determine how often to reduce threat levels of a grid.

Not sure what bleedover means here.

At the end of the day I'd never recommend to anybody to screw around with these AI settings unless I'm first tied up by my toes and force fed for a week. Considering many of the variables say 'do not change' next to them in the original comments, do not have a visible effect, or cause out of syncs in multiplayer games...
posted on April 4th, 2013, 4:18 pm
Thanks Dominus. I didn't change the 3 entries that say do not change. I left those alone:

// Iteration for relaxing grid borders
// NOTE: DO NOT CHANGE
int relaxation_cycles = 1;

// Relaxation bleedover
// NOTE: DO NOT CHANGE
double relaxation_coefficient = 0.5;

// How much to reduce danger recorded in grid cell each cycle
// NOTE: DO NOT CHANGE
double danger_diminishment = 1;

I'm only messing with the strategic_ai_cfg.txt file:

From the strategic-ai-cfg:
// Threat Map.................Where are the enemy units?
// Empire Map.................How far are we from home?
// Enemy Empire Map...........How far are we from the bad guys?
//
//
// By the Mad Dr. I
//
//

// How many tiles per threat mapgrid?
#define threat_map_resolution 800

// How many tiles per death mapgrid?
#define death_map_resolution 800

// How many tiles per our empire mapgrid?
#define empire_map_resolution 800

// How many tiles per enemy empire mapgrid?
#define enemy_empire_map_resolution 800

// How many tiles per exploration cell?
#define exploration_map_resolution 800

// How many tiles per goal cell?
#define goal_map_resolution 800

The guide lists: // number of map units per grid sell (i.e. 400x400 units per grid cell)
#define goal_map_resolution 400. So, I interpreted that to mean each grid is 400x400 units. If all the xxxx_map_resolutions listed above are 800 I interpreted that to mean 2 grids each which seems really small? I'm just trying to see if there is any improvement in the AI to be made. I'm experimenting with these values.

As for the grid sizes, I didn't think they were used for construction as that's what the foot print thing is for. I had always assumed it was used for the strategic AI. Just trying to figure out how. :)

Thanks, rifraf
posted on April 4th, 2013, 10:08 pm
You might try contacting Freyr over at A2 Files. I thought he had written some ducumentation on A2 AI. Not sure if he checks in there much these days or not as that community has all but dried up.
posted on April 5th, 2013, 12:37 am
Thanks pepperman. I'm already conversing with Freyr on this as well but wanted to ask a question about what was posted in the guide here. I'm just looking to continue everyone's work on the AI and see if there is any more to be rung out of it.
posted on April 5th, 2013, 4:28 am
The best way to check how the AI is incorporating changes to its strategic map is to bring up the AI debugger. However, not knowing whether the debugger actually fully represents what's going on game is a problem (a lot of the times the debugger doesn't fully match what's happening). I try very hard in the guide to never document stuff that's not known through testing: for the strategic AI parameters I made an exception, since Ian seemed to remember that his comments should mostly be accurate, and since it's very tedious to even see effects. However, that's proven to also be not exactly on the money on many occasions.
posted on April 5th, 2013, 10:54 pm
Without question, the AI aspects of Armada modding has to be one, if not the hardest elements to understand. It seems to have a personality of its own and is mysterious as the Breen. I suspect many of us would love to be able to get our hands on Dr. Ian Davis' notes on the subject but then again if I had them before me I doubt I could make sense of them. lol The man had a PHD in robots and artificial intelligence after all.

I wonder if he published papers on the topic. The only thing I readily saw was his paper titled: Warp Speed: Path Planning for Star Trek®: Armada

http://www.rockstarwatch.net/maddocsoft ... vis_00.pdf

BTW, I found the stuff Freyr had wrote ....

https://sites.google.com/a/starbase34.n ... telligence

Anyways, I wish you luck in trying to improve the AI for your mod.
posted on April 6th, 2013, 12:23 am
Thanks D_N and pepperman. I started an AI thread over at A2 Files last year and Freyr and D_N were very helpful in me learning all about how the AI works. I also have the SB34 page saved in my favorite links and refer to it often, but thank you again.

Since then I've been continuing my work on the AI. I am currently conversing with Freyr and testing, testing, testing different values and using the debugger to see what's going on in game. :) I am certainly no competent RTS player, but am enjoying tinkering with the AI to see what it does.

In stock A2 there is an overlay on screen of the grids (alt-g if not present.) I assumed this is what the AI was using to divide up the map (and not just to line up your construction) and that it was an accurate representation. In the RTS_CFG.H file there is this: AI_Grid_Size=400 so I took that to mean each grid on screen was 400 units or whatever. In the AI folder is the strategic_AI_config.txt file with all the xxxxxx_map_resolutions (which are all set at 800.) I can't understand (yet or maybe never :)) why all values would be a one size fits all 800 so I'm focusing here on experimenting with the values? I have and still am working on changes to the values in the 4 .AIP files that control how that AI thinks/plays: hard_aggressive, hard_exploration, very_aggressive, and hard_defensive. Changes there have made better improvements already as Freyr found out years ago.

I have found so far with the strategic_AI_config.txt file that changing those xxxxx_map_resolution values to anything less than 400 causes the game to crash with an "out of memory: increase swap file size" error. So the map resolution of each has to at least 400 or the size of each grid. To me 800 means 2 grids or 400*2? But, that is a tiny amount of space on screen and would render the AI virtually blind so I don't know if that is really what it means? I did try making those values quite larger one time so far and the game played, but needs further testing to see if it is a meaningful change or not.

That paper you posted by the Doc is really intersting though. If each grid gets divided into 4 smaller grids and that's currently the design for A2 then throws everything off that I knew.
posted on April 6th, 2013, 4:32 am
Alright, just checked - the strategic values correspond 1 to 1 with the map units. So a goal_map_resolution of 800 corresponds to 800 map units. Since each area the AI takes into account is 800 by 800 units, that means that it lumps everything that occurs within those areas as one event. Ergo, the following:

Let's say the AI has explored 3200 units by 3200 units.

The AI will split those into a 4 by 4 matrix, of 800 units by 800 for each cell.

If the AI loses 10 ships, and 7 of them are lost in matrix A1, a high threat level is computed for the entire cell.

Now, if you increase the map resolution scale, that means that there are now more cells per area. Let's say you have cells of 400 by 400. Now you have a 8 by 8 matrix. Those 7 ships that were destroyed now might not have occured within just a single cell. Since less ships were lost in a given cell, threat levels are reduced overall. The AI thus treats the area as less dangerous and matches with less force.

I assume you are doing your testing in stock A2? In Fleet Ops setting small strategic values doesn't appear to cause a crash. I assume that the smaller the value the more calculations the AI has to do, which might overtax the stock engine.

Quadtree pathing is used for craft AI - it doesn't set the scaling of strategic goals, but of normal unit movement.
posted on April 6th, 2013, 11:40 am
Crazy as this might sound, I find the easiest way to see what something does with an area as subtle as AI is to back everything up, and then change one variable wildly. Test it, if it doesn't cause a crash, what does that huge change do? If it's good, keep it, if not, revert :)

It's long, somewhat tedious and time consuming, but I wish you luck on your adventures into Armadas AI. I've only dabbled, but you can actually get it to be quite clever with the right tweaks :)
posted on April 7th, 2013, 12:00 pm
Don't want to hijack your thread but does anyone know whether the AI debugger works in Armada1. I have never seen it and wouldn't mind taking a peak.
posted on April 7th, 2013, 3:05 pm
I don't believe so Pepperman. I never found any references to it when I used to mod Armada I. It makes testing AI in that game an even longer and more tedious process sadly.
posted on April 7th, 2013, 3:53 pm
I have been kicking myself the last couple of years as about 10 years ago I gave away my copy of A1 because I never liked it after playing it maybe 5 times total.

@ Dominus: Thank you for the explanation. I still don't see the correlation between the AI-Grid-Size=400 in the RTS.CFG and the goal-map-resolution 800 (or all the 800 values) in the strategic-ai-config.txt? If each grid is 400 units as specified in RTS.CFG are they using the goal-map resolution to actually change it to 800? I know for fact I can change that 800 value to any number 400 or higher. Just nothing less than 400. I haven't yet tried changing the figure in the RTS.CFG to something less than 400 though.

Am I reading your math wrong? You said:
Let's say the AI has explored 3200 units by 3200 units.

The AI will split those into a 4 by 4 matrix, of 800 units by 800 for each cell.

Wouldn't a 4 by 4 grid of 800 units be way more than 3200 at 12800? 4 by 4 so 16 grids * 800 or am I reading it wrong?
posted on April 7th, 2013, 4:52 pm
Yes, as far as I know the AI debugger and other debuggers were added with Armada II - but the AI itself should work very similarly to A2.

Since I don't know what the AI grid size command actually does, and it doesn't appear to have an effect on the AI debugger's visual overlays, I couldn't tell you :).

4x4 is

800_800_800_800
| |
800 800
| |
800 800
| |
800_800_800_800
posted on April 30th, 2013, 1:21 am
After several weeks of testing and with Freyr's assistance over at A2Files I feel we've come up with an improved AI that has the potential to be a little bit better than what's been available up till now. At this point these are my opinions alone and maybe I'm deluded :) however I feel it plays a little better than anything before.

I've asked Freyr for his review and input on the changes I've made to my AIP and strategic-ai-cfg files and then see if anyone wants to test it. This has only been tested on stock A2 but should be PNP on Fleet Ops. I'm starting my testing on my FO now as well.

By studying the debugger/minimap in-game and altering the strategic-ai-cfg values and AIP's (furthering Freyr's AIP work previously released) I now see how the strategic map and threat maps work and how to alter the sizes of them and how the AI determines what/where the threats are based on grid sizes.

I just wanted to see if there was any interest left these days as I think most people here play online with others as opposed to single play.
1, 2, 3
Reply

Who is online

Users browsing this forum: No registered users and 1 guest

cron