Forged Alliance Forever Forged Alliance Forever Forums 2018-04-26T03:18:48+02:00 /feed.php?f=2&t=16011 2018-04-26T03:18:48+02:00 2018-04-26T03:18:48+02:00 /viewtopic.php?t=16011&p=162922#p162922 <![CDATA[Re: Dilli AI]]>
As for markers, they are placed by hand, by the map author. He places them on the map, and then links them together, so that you have a mesh of markers for each movement type - land, air, amphibious and naval. So your assumption is correct. In addition to the movement markers, other markers denote where the starting locations are, and various other markers for areas where the AI should consider building defensive positions, naval bases, secondary land bases and several other 'helper' type markers.

There is no definitive 'fallback' mechanism for the AI that I am aware of. Engineers, and unit platoons have a very limited amount of latitude in moving around, so generally they won't travel very far without markers. For small maps, this sometimes is enough, but beyond the simplest of maps, forget it.

Technically, markers can be created by code, but as of yet, I haven't seen anyone try to do that in any meaningful way.

Statistics: Posted by Sprouto — 26 Apr 2018, 03:18


]]>
2018-04-26T01:39:00+02:00 2018-04-26T01:39:00+02:00 /viewtopic.php?t=16011&p=162921#p162921 <![CDATA[Re: Dilli AI]]>
Some questions left:
- What can I NOT change? Which parts of all of this are hardcoded in the engine and cannot be modified with Lua? I guess the IMAP structure cannot be changed, otherwise it would be simple to adjust it on bigger maps to a bigger grid, right?

What markers are is unclear to me, too:
- Are map markers fixed or can they be computed dynamically while the game is running? Do i need to use those markers or can i calculate coordinates myself and tell units to move there? How are markers created by a mapper? Placed by hand or generated from Terrain? As far as I know, not every map has markers, so there must be a fallback system for the AI in case there are no markers. So what are markers exactly and how does the AI interact with them? Right now i imagine markers being a bunch of points connected by edges (so basically a graph) that is used for movement orders, so that the AI does not have to deal with "raw" coordinates.

Statistics: Posted by Katharsas — 26 Apr 2018, 01:39


]]>
2018-04-23T02:36:45+02:00 2018-04-23T02:36:45+02:00 /viewtopic.php?t=16011&p=162864#p162864 <![CDATA[Re: Dilli AI]]>
Katharsas wrote:
the game provides a framework with a certain API to create basic AIs.


That's true, but have in mind you can always add your own lua functions to the AI.
Special target functions for nuke launchers, eco management, strategy manager.. whatever you are able to code.

This can go to the point that you change functions from the game itself to fit your needs.

Statistics: Posted by Uveso — 23 Apr 2018, 02:36


]]>
2018-04-23T01:01:26+02:00 2018-04-23T01:01:26+02:00 /viewtopic.php?t=16011&p=162861#p162861 <![CDATA[Re: Dilli AI]]>
Sequence of build conditions is important, since some conditions require instant checks every time they are called, and others are only validated once per cycle (very efficient but not necessarily accurate). For example, anything that involves counting the number of units, or checking an economic value, is an instant condition requiring immediate computation. All other conditions are tested once per cycle, no many how many builders they might appear in.

For target evaluation, some AI behaviors may use threat values to determine suitable areas to attack or move thru. This is typically recorded on what is known as the IMAP or Intelligence Map. The IMAP is simply a 16 x 16 checkerboard applied to every map. When a unit is detected in any given square, that square will then report that units threat (whatever it might be - Air, Surface, Sub, Economic) whenever you use a function that asks for the threat in that square. If you lose contact with that unit, the threat value will decrease over time.

Some platoons make extensive use of this map to determine where to attack, and how to get there safely. Some do not. This information usually comes into play when a platoon wishes to move from Point A to Point B. By utilizing the waypoints that map makers place on a map, the AI can use the IMAP to decide if it is safe for a given platoon of units to move to or thru any given point along the way.

Overall, the IMAP is a fairly crude mechanism, and it's very reliant on threat values from units blueprints having some relevance to each other (which is another issue). Also, on small maps (5k), the square is very small (about 300+m wide) and on large maps (40 and 80k) it's far too big (5km wide) to be useful - this impacts the AI since in some circumstances the code will be looking at an area of threat vastly larger than is reasonable, and at the other end, far too small.

The ACU has his own set of jobs to do - for construction and self enhancement - and others for combat.

Statistics: Posted by Sprouto — 23 Apr 2018, 01:01


]]>
2018-04-22T23:55:21+02:00 2018-04-22T23:55:21+02:00 /viewtopic.php?t=16011&p=162858#p162858 <![CDATA[Re: Dilli AI]]>
Unit movement/behaviour is defined for groups of units in platoon.lua (you use builders to define how the groups are made, and platoon.lua controls those groups).
For unit specific behaviours (experimentals, ACU), the code is in AIBehaviors.lua.

You can switch between AI archetypes at the start of the game (I am not sure about during the game...); an AI archetype is just something that lists all the builders the AI can use. Different AI archetypes will list different combinations of builders, and this can result in different strategies overall.

Currently the AI needs to be loaded in using a special init file, so can't be just "switched on" in game. This will be possible in the future though, which is what I meant when I said it would be a regular sim mod, the same framework (builders, platoons etc) will still apply.

Another thing you can do is add some custom stuff to the "AI brain" class, which can act as a flag to say what strategy you are on. You can then write your own build conditions to check for these flags, and add these to the relevant builders. Since you're only checking the state of the flag, checking those conditions should be really fast.

Statistics: Posted by Softly — 22 Apr 2018, 23:55


]]>
2018-04-22T23:21:23+02:00 2018-04-22T23:21:23+02:00 /viewtopic.php?t=16011&p=162856#p162856 <![CDATA[Re: Dilli AI]]>
So it seems you create a basic AI by defining a bunch of unit build behaviours (called "Builders"), each defining the unit to build, a priority, and a bunch of conditions that must be met before this behaviour can get executed. Based on this, the AI then can decide what to build in the factories.
Similarly, you define a bunch of engineer activity behaviours, each defining a building an engineer should be able to build, a priority, the max number of engineers assigned to this behaviour, and a bunch of conditions that must be met for this behaviour to activate, causing engineers to actually build this in game.

So questions that are left open:
- How does the actual unit movement get calculated and is it possible to change this? I guess you can specify targets for combat units in a similar way with behaviours, as it is done with build and factory behaviours?
- How does the AI estimate enemy unit count/movements if it has imperfect intel? Is it capable of remembering where it has seen units that move out of radar range?
- Is there anything dedicated to commander usage / protection / upgrades (are upgrades handled with the existing build behaviours as i would guess they are)?
- Can behaviours be activated based on bigger "strategies" without needing to go crazy with behaviour conditions? For example say i create some build behaviours that work well for nuke rush, and some behaviours that work well for air strat build. Under certain conditions i then want the AI to switch from nuke rush to air start build without the need to put these "strategy conditions" into ALL of mu behaviours?
- You mention regular sim mods. Does this mean i can define AIs without the need to use this AI framework that is used by Dilli, which you descibed in in the wiki? Basically make the AI from scratch?

Maybe i just need to see some more code, maybe for a bit more complex AI.

Statistics: Posted by Katharsas — 22 Apr 2018, 23:21


]]>
2018-04-22T21:45:04+02:00 2018-04-22T21:45:04+02:00 /viewtopic.php?t=16011&p=162854#p162854 <![CDATA[Re: Dilli AI]]>
Katharsas wrote:
Some place were one can start to learn how these are implemented and understand the differences in approach?
I am so glad you asked ;)

I started a wiki page here: https://wiki.faforever.com/index.php?title=AI_Modding

It needs updating, since a new way to load the AI mod is coming (in the future, it will be possible to write AI as a regular sim mod), just waiting for that to get deployed first.

I also started up an AI tournament (here: viewtopic.php?f=26&t=16088 ), the whole idea of that is to get more people interested in doing AI dev for FA. It will run every couple of months with different categories each time.

If you are interested you can pm me via forums or FAF, or you can come onto slack (pm a mod on FAF to ask about that); there's a few people who chat about AI there.

Statistics: Posted by Softly — 22 Apr 2018, 21:45


]]>
2018-04-22T21:24:43+02:00 2018-04-22T21:24:43+02:00 /viewtopic.php?t=16011&p=162853#p162853 <![CDATA[Re: Dilli AI]]> Statistics: Posted by Katharsas — 22 Apr 2018, 21:24


]]>
2018-04-22T20:09:38+02:00 2018-04-22T20:09:38+02:00 /viewtopic.php?t=16011&p=162846#p162846 <![CDATA[Re: Dilli AI]]>
To be honest, the best kind of tester is the "average joe" right now, since that's the kind of player I need to be challenging next...

Thanks for volunteering :)

Statistics: Posted by Softly — 22 Apr 2018, 20:09


]]>
2018-04-22T18:50:55+02:00 2018-04-22T18:50:55+02:00 /viewtopic.php?t=16011&p=162841#p162841 <![CDATA[Re: Dilli AI]]>
I really like the AI I've seen so far. I'd love to play PvP but get too anxious and my gameplay suffers. However this leads to me beating up AI which isn't that difficult. That's no fun either.

A new more difficult AI would be very welcome :)

Statistics: Posted by Aerocore — 22 Apr 2018, 18:50


]]>
2018-04-22T12:59:49+02:00 2018-04-22T12:59:49+02:00 /viewtopic.php?t=16011&p=162834#p162834 <![CDATA[Re: Dilli AI]]> Statistics: Posted by Yakmann — 22 Apr 2018, 12:59


]]>
2018-04-22T07:09:17+02:00 2018-04-22T07:09:17+02:00 /viewtopic.php?t=16011&p=162829#p162829 <![CDATA[Re: Dilli AI]]> where can i find the current version of the mod?

Statistics: Posted by PhilipJFry — 22 Apr 2018, 07:09


]]>
2018-04-21T22:39:55+02:00 2018-04-21T22:39:55+02:00 /viewtopic.php?t=16011&p=162819#p162819 <![CDATA[Re: Dilli AI]]> Statistics: Posted by Softly — 21 Apr 2018, 22:39


]]>
2018-03-26T00:53:48+02:00 2018-03-26T00:53:48+02:00 /viewtopic.php?t=16011&p=162087#p162087 <![CDATA[Re: Dilli AI]]> Palms 1v1 again: https://www.youtube.com/watch?v=cabnKFGbOZY
4 way FFA with Sorian: https://www.youtube.com/watch?v=lGm-YNGxrBQ
1v1 on Badlands: https://www.youtube.com/watch?v=20xqTvJznjo

Statistics: Posted by Softly — 26 Mar 2018, 00:53


]]>
2018-03-26T00:48:33+02:00 2018-03-26T00:48:33+02:00 /viewtopic.php?t=16011&p=162085#p162085 <![CDATA[Re: Dilli AI]]> https://github.com/HardlySoftly/Dilli-AI

Statistics: Posted by Softly — 26 Mar 2018, 00:48


]]>