Freyr and AI/AIP's -1 reply

Please wait...

Freyr Advanced Member

A2Files Staff

46,876 XP

6th February 2005

11 Uploads

4,275 Posts

0 Threads

#31 7 years ago

The figures I use are not the ultimate end all of AI programming; they simply do what I want the AI in my install to do most of the time. If your AI is not being aggressive enough then you need to change the values until your happy.

Both the force matching (double min_matching_force_ratio = 0.8; ) and the minimum attack force (int min_attack_force = 6; ) are taken into account; remember that and play around with the values so you can see the effect.

Setting a minimum of 6 ships can limit the AI until waiting until it has 6 scouts or 6 battleships; it's a very blunt tool and depends completely on the build list. Guess one of the reasons that build list is building destroyers that have a combat effectiveness of virtually zero?

The reason I posted the build list is that it's the other side of the AI; A great personality is of no use if the meatbag builds faster than the AI since the AI will know it's outgunned and never actually attack. If that happens, you know you have a build list problem.

There are as always two ways of dealing with that. First is the way I aim for, which is to write an AIP to follow the rules and outplay the human. Secondly is to cheat horribly by using the build time/build cost as seen in almost any strategy game. Making an AI follow the rules is too much work for most people! Still, even if we can't completely eliminate the AI cheating we can make it play far better without cheating so the amount of cheating required to get the AI to play decently is much smaller.

I can beat my AI's 1v1. Even 2v1. However, I can take 7 Hard stock AI's out without feeling significantly threatened in the stock game. I tried a 5v1 once against my AI's and the battle was short, decisive and very one sided. It left me with no desire to try a rematch. If you can close the gap beyond a certain point it makes the game a lot more interesting to play even if you'll still win a 1v1. You probably can't make an AI that can win a 1v1 against a competent player without cheating to be honest. Still, the closer you get...

One thing I'm not sure about is the tech levels. What constitutes tech 1, tech 2 and so on? Do you start at tech 1 or tech 0? Is the first research building tech 1, the second research building tech 2 and the upgrade station tech 3 and then the ship system upgrades are 4, 5 and 6? The stock game only has 4 tech levels but I see in your build list you posted you have 6?

Tech levels are completely artificial and only exist in the build list, they don't refer to buildings.

The forth column of numbers is the tech level. You start at tech0, and you can say that you want something to be built until tech level 1 by setting -1 as the tech level. When you use a positive number that sets that number as the current tech level.

My tech levels are pretty obvious; every time I declare a new one there is comment separating it from the previous ones. You don't need to do that, I just do it to separate out the build list and make it more readable. It also helps with detecting crashes, since you can just remove entire sections so it works again, and then add them back in until it starts crashing again, at which point you know you have discovered the problem in that section. Like the headers with version numbers and revision dates, it's not really required. However, it makes it easier to maintain. (and less importantly, your code looks pretty!)




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#32 7 years ago

I realized that last nite about the tech levels after looking around. We determine when a tech level begins and what not to build after that tech level or you don't even need tech levels if you use the quantity to build line properly.

I've almost completed my Card build list which I'll alter to varying degrees for the defensive, offensive, instant action, and endgame lists. Then I just have to do the other races. I'll see how it performs before moving on to the next race. Now comes the long writing and experimenting part. :)

As I understand it the build_list is more of a template of what to build in a perfect world and the other 4 lists are what the game actually uses depending on the AI perameters?

Thanks for all the help and advice from everyone. It's been a lot of work trying to make my game into the image of what I want. :)




Freyr Advanced Member

A2Files Staff

46,876 XP

6th February 2005

11 Uploads

4,275 Posts

0 Threads

#33 7 years ago

rifraf;5631717I realized that last nite about the tech levels after looking around. We determine when a tech level begins and what not to build after that tech level or you don't even need tech levels if you use the quantity to build line properly.[/QUOTE]

Yeah. I think I did say in one of my somewhat rambling texts on AI's words to the effect of that while they could in theory be used to write incredibly complex AI's to great effect I can't see many things worse than complexity; simplicity is probably better to avoid looping. When you start writing your build lists if your using infinite rebuilds you'll see how badly the AI can get stuck in loops.

rifraf;5631717 I've almost completed my Card build list which I'll alter to varying degrees for the defensive, offensive, instant action, and endgame lists. Then I just have to do the other races. I'll see how it performs before moving on to the next race. Now comes the long writing and experimenting part. :)

The experimenting is fun, but it can also get boring. If you watch the AI play a few games through the AI debugging tool then you should know about as much as me. =p

[QUOTE=rifraf;5631717] As I understand it the build_list is more of a template of what to build in a perfect world and the other 4 lists are what the game actually uses depending on the AI perameters?

Thanks for all the help and advice from everyone. It's been a lot of work trying to make my game into the image of what I want. :)

Your welcome. :)

As far as I can tell, the build_list is completely unused, yeah. I guess that it's probably the template that the other 4 lists were modified from. I did consider the possibility that they were unused code left over from A1 but if that was the case then we wouldn't have them for the species and cardassians. :uhm:




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#34 7 years ago

I decided to shy away from the infinite build lists this time. I'm using your Klingon build list you just posted and the Cadassian build list you made for Dan in his AI Help thread from the past as examples. I want the AI sending stuff in waves of increasing difficulty so I'm increasing ship types/strengths/build quantities with each tech level to different degrees with limited rebuilds until the endgame list.

I finally completed my Cardassian build list and am already catching myself wanting to change this and change that and do this differently. I have to temper the second guesses and just go with it and see how it does. :)




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#35 7 years ago

I have a question about the AIP's, specifically the max_eval and max_exec. The max_exec_attack would be how many goals to consider in the attack say 100 and is the max_eval how many it will evaluate and decide on? In my hard_defensive.aip I have it set at 100 so it'll consider 100 targets to attack. But following your Gen IV AI, you have 25. Wouldn't you want to consider a lot more?

Also, in the very_aggressive.aip would you still want to consider and attack a high amount of do you want to lower it to say 50 or even 25? I know more is smarter but does lowering it in the very aggressive end game make it better? I just wanted to understand that.




Freyr Advanced Member

A2Files Staff

46,876 XP

6th February 2005

11 Uploads

4,275 Posts

0 Threads

#36 7 years ago

That's another one of those "we don't really know" things. That having been said, a goal is actually a goal grid to the best of my knowledge. A standard grid is 800 wide IIRC, although there is a reference in RTS_CFG.H that suggests it might be 400. If 800 then 25 grids is a total of 20000, which is actually the entire area of some maps, if 400 then it's half that. Unless every square on the map is actually going to be occupied, this should be sufficient for most things, though you are quite correct that calculating more should get the AI to play more efficiently.

I was moving up from a starting point of 3 though, so my increase was quite a big improvement in itself. I'm not sure what (if any) performance implications increasing this further might have.

Play with it and find out. =p




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#37 7 years ago

After some experimenting, I changed all research pods to be metal/dilithium based, no latinum, and made the 2 research stations and the upgrade station require only 100 latinum each but more metal/dilithium, so the AI only needs 300 latinum and I left the stock setting of giving them 500 latinum from the start. However, about 1/3 through their build lists they divert up to 6 freighters from dilithium to gather latinum? Nothing else requires latinum so could they be doing this after the trade station is built to be used to buy more metal/dilithium? Strange.

On to the AI. The definitions state for attack_troop_priority:

// This priority is multiplied by each enemy craft in a grid cell for // ATTACK and DEFEND goals; for ATTACK_BASE goals this number is multiplied // by -1 * the number of enemy craft.

So any value you input multiplied by negative 1, then multiplied by the # of enemy craft. It'll always be a negative # so how is the game figuring this correctly?

Also, is "MAX_EXEC_ATTACK_BASE" only being considered each races single main base structure and "MAX_EXEC_ATTACK" means it'll attack all the other ship/structures that are not the main base in an area? Maybe I'm over analyzing this. :)




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#38 7 years ago

Well, things are coming along. The AI "mostly", consistently skirts around my base and attacks my valuable research and such but will still oddly sometimes attack my base with an odd ship or two to no avail.

I think I need to adjust my build values to use more dilithium vs metal since I don't think they can field the proper amount of ships.

Something I've noticed with an AI getting beat, I'm assuming they enter the defensive list and say all their freighters/constructors get destroyed, they have a trade station but not sure they are using it? They seem to enter a period of statis and not build anything at all. They stop building ships to defend themselves and just sit there like they are waiting it out if they don't get killed outright? Not sure what I could change to turn this around?




Freyr Advanced Member

A2Files Staff

46,876 XP

6th February 2005

11 Uploads

4,275 Posts

0 Threads

#39 7 years ago

It sounds like there is an error with that build list. Have you checked it?




rifraf

Avid Gamer, Novice Modder

50 XP

24th July 2003

0 Uploads

180 Posts

0 Threads

#40 7 years ago

I couldn't find any errors. I had just copied the Romulan build_list to the defensive_list and added a couple of turrets to the build.

Something else I've noticed is that after changing some values in the hard_aggressive, hard_defensive and hard_exploration AIP's oddities appear. Like the Klingon AI as about 4-5 freighters sitting around a dilithium moon and only one is mining. Should I restart my computer after altering files in depth?

I had another instance where the Romulans wouldn't build their yard2 on a certain map. Could that be due to there not being enoug room or something?