Return to “Technical”

Post

Hi and Low Level AI

#1
In today's development log, Josh made a convincing reason to not separate the hi level AI ( strategic) from the low level (execution).
While I understand the metaphor with the mind and body, I am still wondering...

You do have levels of planning. A faction will have abstract strategies, and its "body" is an arbitrarily complicated collection of stars, ships, NPC, stocks.... Probably too much to feel all the details. So in a sense, you will need to abstract the low level to manage high level decisions.

Therefore I still have the feeling that, while they may share many elements, a low level AI (level of a ship) and a high level AI (level of fleet/complex NPC/faction) will need to be different due to the abstraction layer required, and also the different speed and data base.
A strategic decision (high level) needs to abstract the situation, consider the overall situation but needs to take decision infrequently.
A tactical decision (low level) needs an accurate data, only local information and very frequent decision during action.

Care to explain?
Image
Post

Re: Hi and Low Level AI

#2
A faction consists of some planets, stations, and fleets and uses them to reach it's goals.
A fleet consists of capital ships, escorts, and maybe some fighter wings and uses them to reach it's goals.
A carrier consists of the main ship, scout, fighter, and bomber wings and uses them to reach it's goals.
A fighter wing consists of several fighters and uses them to reach it's goals.
A fighter has guns, missiles, and tactical maneuvers like evasion or attack run and uses them to reach it's goals.

Where exactly is the big red line that separates HLAI and LLAI?
There is no "I" in Tea. That would be gross.
Post

Re: Hi and Low Level AI

#3
Gazz wrote:Where exactly is the big red line that separates HLAI and LLAI?
Perhaps I should say:
"Low level" = auto pilot. Needs to be accurate and react @30 fps, but "reacting" to the environment mostly. But needs to have the exact mesh description of an object to avoid it, and to have a mathematically accurate model of the ship he is driving ("his body").
"High level" = mostly all the rest. Take decision based on abstraction of the situation, with ambiguous data. Needs to be able to abstract things, would be overwhelmed if having to manage a fleet knowing the exact shape of all ships. So has no "body" but concepts that may belong to him (his ships in a fleet) or not (enemy's ships. Same nature as his own, however).
Image
Post

Re: Hi and Low Level AI

#4
Yes, there are still different "levels" of implementation! Perhaps I didn't explain it clearly enough. What I meant was that these levels should not be treated as highly-disjoint processes, but rather, as parts of a whole.

So yes, there is still a "high-level" action that does not consider details like meshes, and then an implementation of that action that does consider the details, but the point is that the two are working together, not separately. They are really two ways of looking at the same action. One way is considering high-level details about the world, the other way is considering details like the mesh, thruster impulses, etc. What I was getting at in the dev log is that these two are tightly connected, and there should not be a wall of separation between them. And indeed, that they should not be viewed as two distinct systems, since they are so tightly connected.

In a concrete way, this translates to them actually being in the same .cpp file, such that they can communicate in full detail.

Hope that makes more sense :)
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Hi and Low Level AI

#5
I work in neuroscience and have a particular interest in programming, so this topic is especially interesting. Afraid that I can't write a wall of text right now, but here are the points:

Your example that the high and low level AIs need to "connect" is similar to the role of the corpus callosum (that big band of stuff that separates your left brain from your right). You could think of it as a (however many thousand)-GB fiber-optic connection right in the middle of two giant servers. It's the reason that you're able to see both your left and your right sides with both hemispheres of your brain, for instance. Without that connection (similar to separating the low and high level AIs into different .cpp files), you in essence create a patient with two halves of the brain unable to communicate with each other -- the classic "split-brain" patient, which leads to all sorts of odd dysynchronies -- only eating the contents on one half of a dinner plate, unable to identify, but able to copy a figure shown to the left eye ... that sort of stuff. In that case, the patient is less a single person than two people that happen to share the same body.

However, the nervous system also has separations that makes sense (a counter-argument to your presented case). Take the reflex arc for instance (the classic patellar reflex). Procedures that can be handled locally (only the muscles of the leg are needed in this case) can be handled quickly by local agents (the afferents, efferents, and interneurons all relatively close to the knee and spinal cord) without requiring involvement of the cerebral cortex. This has obvious advantages in latency, for example -- how fast you want the affected limb to stop touching that hot stove, versus how fast you want your brain to actually notice touching that hot stove. I imagine an analogy in LT would be evasive maneuvers to avoid colliding with an incoming asteroid -- that's a simple, low latency operation that could certainly be a separate method from the "main" short-term AI loop.

On a more broader scale, these connections also explain, for instance, how bacterial colonies can synchronize with changes in food availability and predation, how biofilms form on surfaces, how birds in a flock behave more like a unified organism rather than individual units ... in fact, a lot of nature is so tightly connected that we can get lost in the distinction between cell, tissue, organism, group. In every case, close synchronization is crucial.
Post

Re: Hi and Low Level AI

#6
jimhsu wrote:However, the nervous system also has separations that makes sense (a counter-argument to your presented case).
I may not be into neuroscience but I've been an X3 scripter for years which pretty much is the same thing. Actually, quite a few times I was wondering what the hell the trigger / motivator for a particular action might be so maybe it's more psychology after all. =P

Anyway, in that game there is a clear distinction between low and high level functions - the evasion you mentioned being one of them.
You can supply the parameters for that action but you cannot create new parameters. It's a black box.
All the 3D / number crunching issues are done "in the hardcore" to reduce latency.
The problem is that once you want to do anything "smart" about these things, you can only do it in a very (CPU) inefficient scripting language. That seriously cramps your style and X3 scripters have created workarounds on a scale that is just... unreal.

That has nothing and everything to do with what Josh is doing here.
While there can be "reflex" actions (for ships) that are not governed by "intelligent" strategic or tactical decision, the classification into LO and HI AI is still arbitrary.
There is no "I" in Tea. That would be gross.
Post

Re: Hi and Low Level AI

#7
I may not be into neuroscience but I've been an X3 scripter for years which pretty much is the same thing.
Oh, tell me about it. I remembered the last time I pulled out the scripting engine for X3 was to try to debug some random ship causing MASSIVE performance slowdowns by doing a binary search (killing off half of the ships in the universe, then killing half of that, etc etc). In the end it was some TS with a screwed up something (debug tools in X are not good enough to tell exactly what).
Post

Re: Hi and Low Level AI

#9
Hence one of my requests is for at least a somewhat decent debugging/profiling interface. It can be hidden or ugly, but leave it in there. Oh, and a somewhat useful logging feature in case of crashes would be nice (w/ stack trace, etc). Not a "module.exe has exception at 0x0a78abcc" without any further info. (You can guess how X handles this).
Post

Re: Hi and Low Level AI

#10
jimhsu wrote:Hence one of my requests is for at least a somewhat decent debugging/profiling interface. It can be hidden or ugly, but leave it in there. Oh, and a somewhat useful logging feature in case of crashes would be nice (w/ stack trace, etc). Not a "module.exe has exception at 0x0a78abcc" without any further info. (You can guess how X handles this).
Sure, I'll provide at least a minimal crash report tool. Already have backtraces and preventative asserts and such.
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: Hi and Low Level AI

#11
Back to what CSE said; I think the problem he had was with how we 'define' what consists of LLAI vs. HLAI.

To put it simply, originally the idea was that HLAI was what allowed commands like "Attack" and "Follow" to be, while the LLAI is the how to carry those out (move at velocity x in heading y, fire guns at point z, etc).

I can see both side of the argument of separating vs. combined HLAI and LLAI. In the end, it really just depends on the type of game you're creating. For turn-based strategy games, it's almost better to split the two as it allows for much more in-depth thinking on the end of your opponents, but for something real-time, it just becomes a waste.

I'm guessing that X3 had it separated which lead to some of the slowdowns in the scripting engine parser.
Image
Early Spring - 1055: Well, I made it to Boatmurdered, and my initial impressions can be set forth in three words: What. The. F*ck.
Post

Re: Hi and Low Level AI

#12
I love the analogy with reflex and reflection...
These functions are quite different and as mentioned for performance/speed reason (getting that hand away from the stove, avoiding those laser shots while not crushing in the carrier vs analyze your next move at chess or plan an invasion).
That's certainly a logical way to make a separation.... But of course you do not need a china wall between them, these functions need to communicate, possibly the higher level may want to use the lower level to simulate situations, for example.

So as DWMagnus said: where is the limit? I would suggest the speed - if decision are required about once per frame, than it's LLAI, else (once per second or usually even much less), HLAI.
Why split? Because the algorithms are fundamentally different: a not-so-good but quick solution is better than none in LLAI, why the HLAI can wait for an acceptable solution....
Image
Post

Re: Hi and Low Level AI

#13
CSE wrote:So as DWMagnus said: where is the limit? I would suggest the speed - if decision are required about once per frame, than it's LLAI, else (once per second or usually even much less), HLAI.
Why split? Because the algorithms are fundamentally different: a not-so-good but quick solution is better than none in LLAI, why the HLAI can wait for an acceptable solution....
That was actually the point I was trying (but failed) to make. The algorithms aren't functionally different, it's just interpretation. If there is a scripting engine, then those scripts will be considered HLAI, otherwise it is pretty much LLAI everywhere else.
Image
Early Spring - 1055: Well, I made it to Boatmurdered, and my initial impressions can be set forth in three words: What. The. F*ck.
Post

Re: Hi and Low Level AI

#14
DWMagus wrote:That was actually the point I was trying (but failed) to make. The algorithms aren't functionally different, it's just interpretation. If there is a scripting engine, then those scripts will be considered HLAI, otherwise it is pretty much LLAI everywhere else.
Well I guess I failed to explain, because I mean the functions are different.

The quick one has emphasis on time, not optimalty, so it considers only the most pressing stuff.
Assume an auto-pilot: an example is to take the existing vector, and to add a component in the inverse direction of obstacles, with a size proportional to the "danger/size" and inversely proportional to the distance. First deal with the closest obstacle, and then iteratively to the next one. Interrupt when result required to draw next frame. This is effective for time-constrained algorithm, but by definition short-sighted.

The slow one emphasis on quality. Check all things you see on the detectors, deciding to keep considering them or not as a conscious action. Draw conclusion about the possible effects of actions and then choose what should be done. Slow, but not short-sighted.

These are completely different things that may require totally different "representations" of the universe. Of course one could make a continuum by making a time constrains tighter and tighter on the high level, but this may change the "cleverness" (how far consequences are evaluated"), while still not being blind to part of the universe like the auto-pilot above does not see objects distant enough when time's up.

Hope this clarifies. Of course it may be that those behaviors can share a common ancestor thus making them instances of the same master object, but this can be the case of anything....
Image
Post

Re: Hi and Low Level AI

#15
I get what you're saying now.

You're equating LLAI to something like speed and position (needs to be calculated and/or adjusted quite frequently), whereas HLAI would be like whether or not we've reached our waypoint (which doesn't need to be checked multiple times a second).
Image
Early Spring - 1055: Well, I made it to Boatmurdered, and my initial impressions can be set forth in three words: What. The. F*ck.

Online Now

Users browsing this forum: No registered users and 5 guests

cron