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 30th, 2013, 2:03 am
I play only Single Player against the AI for FleetOps for the intensive lagging (not computer related, all evidence from running tests with other games and other computers) have proven that its only related to FleetOps so even though it still lags against the AI for FleetOps, I only play that way and mods such as mine (that I'm working in) and the STA2_Classic Mod, so I wouldn't mind trying out your created AI files for both FleetOps and stock A2 since that is really what the STA2_Classic Mod is.
posted on April 30th, 2013, 2:23 am
I agree that for mods, any insights into how the AI works would be great :)

Same goes for missions I suppose, if and when people start making them :P
posted on April 30th, 2013, 2:35 am
Making 'tactical' AIs for missions is a lot easier - provided you can get past learning how to use MMM and do lots of scripting. There's no guessing in MMM triggers. :)

Hopefully you document your results Rifraf. The number one problem with information aggregation in the A1/A2 community is that almost nobody describes what they've tested and what the results have been :sweatdrop:
posted on May 1st, 2013, 3:48 am
Rifraf, I would be willing to guinae pig your AI Mods. I could break out a spare drive and set up fleetops all to itself for testing. Let me know. I work alot so I can't guarantee overnight results but I can give it a shot.

The few things I notice is that AI won't retreat, it will just stay there and die. It also tends to spread out to quickly which leaves everything undefended. It also gets a good rush going if you let it, then if you get past that initial rush it dwindles out.

That said, Romulans on AI Merciless are just that, Merciless. You can't let up on them for a second.
posted on May 2nd, 2013, 4:27 am
I'll let you guys know when it's ready to test. I'm certainly no competent RTS player which is why it'd be nice to have others test it who play more seriously than me.

@01001: In order to get the AI to retreat in a more reasonable manner and repair/regroup instead of always fight to the death try raising the following values in each races specific odf files:
// When this race will retreat from battle
retreatStrength = 0.15f //shield percentage
crewRetreatRatio = 0.10f //crew percentage

If the crew is down to 10 percent as above then it's already too late as the ship is probably a couple seconds from death anyway. As far as the AI spreading its forces out to quickly, try changing the min/max attack force settings in each of the .aip files in the AI folder. I use a minimum of 7 and max of 128 in the -hard agressive and very-aggressive files. The changes I made in the AIP files are pretty extensive and all of them combinded should make the AI play a little better at least.

Your build lists are just as important as well because if you don't have the AI set to build the best ships as quickly as possible in a competent manner then the AI won't really matter. They go hand in hand. I'm hoping to improve in any way what Freyr built upon years ago over at A2 Files with the AI.

@ Dominus: I'm off to bed, but I'll post what I learned and my reasonings.
posted on May 3rd, 2013, 12:19 am
Thanks for the info. Just let me know when you are ready to test.
posted on May 3rd, 2013, 4:35 am
Last edited by rifraf on May 4th, 2013, 4:57 am, edited 1 time in total.
I thought I'd at least share my documentation of how I tested and what I've found. The values I'll list are from stock Armada 2, but I did my actual testing on my personal build and have since refined the values. By watching the minimap in the debugger and lining up freighters with grids and how they corresponded to the colored squares of the threat, goal, explore, and death maps I was able to determine what appears to be happening.

So, each gameplay map grid is 100x100 units or a 1x1 grid as evidenced by the grid overlay on screen (alt-G) and sensor/weapon ranges are bound to this.

Each strategic map grid is 400x400 units or a 4x4 grid as evidenced by AI-Grid-Size=400 in the RTS-CFG under the strategic AI section.

The strategic-ai-cfg.txt file in the AI folder contains all the strategic parameters:
// 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

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

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

Every ship/station with an "attackpower=XX" value in its odf (anything with a weapon should have it) projects an initial threat of 800x800 units or an 8x8 grid as specified by #define threat_map_resolution 800. This is 800x800 units total from its center point not in each direction from its center.

The "int relaxation-cycles=1" setting controls how many strategic map grids to spill the threat over into. So a setting of 1 would mean the threat gets spilled over into 1 strategic grid (400x400 units or 4x4 grid) in each direction from the edge of the initial 8x8 threat grid. 2 would be 2 strategic grids each direction and so on.

The "double relaxation_coefficient = 0.5;" is the percentage of the threat that gets spilled over into other strategic grids. So .5 is 50 percent and 1 is 100 percent. I feel this should be 1 so that all the threat gets spilled over into the next grid to help the AI better judge where the danger is.

Now the relaxation-cycles and the relaxation-coefficient parameters each appear in the all the AIP's in the AIPs folder so you can further fine tune each AIP separately, however I think they should match the strategic-ai-cfg setting myself.

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

There's no way to test that but I think it means that 100 percent of any threat is reduced each cycle which to me seems pointless. Why reduce the threat completely and so quickly. I've changed mine to .10 or 10 percent of the threat gets reduced each cycle to keep the threat around a little bit longer. May help the AI play better and not just rush into danger head on so quickly.

When the AI loses a unit it references the death-map-resolution and paints an area of danger from the grid it lost its unit in of 800x800 units. 800 is a bit large to me depending on weapon ranges.

The exploration-map-resolution is the size of the area it considers explored. 800 is too large in my opinion unless you have your sensor range at 800.

The empire and enemy-empire-map-resolution is the size of your and your enemies empire. I feel you would want this to be a little bit bigger than your total threat area to emphasize your region of control and then beyond that is open space or the perimeter.

The goal-map-resolution corresponds to the strategic goals. This you can watch in the minimap in the debugger as it's the first mode to choose. You can see the areas the AI chooses to explore and what it assigns to protect and where it marks resources it finds.

I can change the strategic-ai-grid size to any number (I went as low as 100) and the game still played. However, the threat-map-resolution has to be a minimum of 400 or the maps start to crash. And the threat-map-res and goal-map-res values must be linked somehow because even if they are different values the strategic grids for those are always the same size and it's the threat-map-res setting that determines that size.

Also, the empire-map-res and enemy-empire-map-res values don't seem to be affected by the relaxation-cycles setting or threat spill over. The value set for each (and I think they should both be the same size) as represented in the strategic map view is the size that it appears on screen.

Well, I think that covers the strategic side of things. The other half of the equation is the changes made in the AIP files themselves. Once I hear back from Freyr I'll see about getting them out to test. Let me know if I missed anything.

Regards, rifraf
posted on May 3rd, 2013, 8:05 am
Nice work Rifraf! That's quite enlighting and a good documentation! Keep the tests coming. Perhaps you'd like to sit down with Dominus and extend the guide? :thumbsup:
posted on May 4th, 2013, 5:08 am
Thanks Optec, I'd be happy to assist in any way I'm able. I do continue to test and will add notes as I discover. A couple of other points:

For your starbase no matter what the threat map is set at the threat map grid is never centered on your base like one would think it'd be which kind of sucks. So one or two sides of your base might project a threat 4-10 grids out but the other two sides would be left with the remainder of 10-18 grids out which kind of skews the threat locations slightly depending on your threat-map-resolution value.

Also, Dominus is correct in that the minimap display in the debugger is not always correct in what it's displaying. From what I've seen so far the strategic view, threat view and exploration views are pretty much accurate. It's the death map view that is sometimes pretty wonky painting a colored square halfway across the map from where it's units were actually killed.

I also haven't tested this in multiplayer so perhaps others can do that to see if it presents any issues?

One of the most important things that needs mentioning (if you're modding stock A2) is that your attackpower = XX value in each ship/station odf (that have weapons) should have a minimum value of 1.0. I see FO as of 3.2.6 has this, but not sure of earlier versions. The reasoning is that it's used to calculate how the AI determines attack parameters and anything less than 1 is actually dividing its outcome which is less than optimal. Most people probably already know this, but thought it was worth mentioning.
posted on July 31st, 2013, 4:49 am
Last edited by rifraf on August 1st, 2013, 1:08 am, edited 1 time in total.
I thought I'd release the AI that I've been working on and hopefully some of you would let me know what you think? Hopefully it plays a little better that stock in the AI bash games.

Maybe you have some ideas for improvement? This is for the hard setting with the AI as well.
posted on July 31st, 2013, 10:55 pm
What improvement this file get us? How to install this while keeping compatibility with multiplayer?

I personally appreciate someone that take the time to work with the AI, because to me Online games are not a possibility so my only way to play Fleet Ops is against the dumb AI or the merciless nightmare of spam :lol:

So thanks :thumbsup:
posted on August 1st, 2013, 1:15 am
Last edited by rifraf on August 25th, 2013, 8:17 pm, edited 2 times in total.
I do apologize for not including backups for the Fleet Ops AI in my above post. A careless mistake. I only included AI backups for Stock Armada 2. This is a new file with both Stock A2 and Fleet Ops AI Backups for you just in case.

@ JeanLucPicard: I'm not sure how this will affect online compatibility? I've made the modifications foremost to be played in Instant Action against the computer on hardest difficulty. As a precaution unless someone knows otherwise it would be best if all parties had the same file when playing online.

***As a last instruction, in your RTS_CFG.h file in the main directory you should scroll down to the AI section and change the value for float AI_GRID_SIZE = 400.0; and make that = 550.0 to line up with the change in the strategic_AI_config.txt I made. I've uploaded an updated file as well***

Attachments

AI.rar
(40.53 KiB) Downloaded 351 times
posted on August 1st, 2013, 10:31 pm
As far as I know multiplayer still uses the AI files but I'm not sure. Again thanks for this I will try it and we'll see :thumbsup:
posted on September 5th, 2013, 4:59 pm
If I use your AI files the AI does not use their scouts anymore on some maps. They also just stay in their base and do nothing even if I attack them. They tech up, build massive amounts of units and wait for me.
Sometimes the game crashes with the following error:
ai_crash.png
Crash
ai_crash.png (109.99 KiB) Viewed 593 times
posted on September 21st, 2013, 4:40 am
That is odd. I've tried 2, 3 and 4 player maps in FO with my AI and all the other races/AI players seem to do fine and build up/attack me and each other? Perhaps someone could assist with the crash report as I have no idea how to interpret it?

Just thinking, did you replace your RTS_CFG.h file with the one I included? The one I included is from stock Armada 2 with the exception of only 1 line being changed for the AI parameter so if you replaced yours with mine that may cause issues because the FO RTS_CFG file would be heavily modded by them.

I would recommend using their RTS_CFG file and only changing the one line as stated in my readme and see if that does anything.
1, 2, 3
Reply

Who is online

Users browsing this forum: Bing [Bot] and 13 guests

cron