Absolute control over units

Absolute control over units

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Absolute control over units

Post by casperjeff »

Question (I know I have a lot).....I intend to have a pretty tight reign on my units (right down to tracking which direction they are facing) and using minuscule movements to facilitate in-place rotations.

If another unit comes around (enemy or ally) and attempts to move 'through' the space of my unit, the internal engine AI won't take over and 'move' my unit out of the way, will it?

That would suck.


(It's not in any way based on the 'move state' is it?)
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Absolute control over units

Post by Kloot »

Yes, it will for allied units, regardless of the move state.
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Re: Absolute control over units

Post by casperjeff »

Hmmm...means I have to constantly check the position of my units to see if it has changed outside of my control?

That kinda stinks. I guess I better not support allies playing with my ai-bot. :)

I wish that the movement command of the unit that tried to move 'through' my unit would simply fail or time out.

*grumble*
User avatar
thesleepless
Posts: 417
Joined: 24 Oct 2007, 04:49

Re: Absolute control over units

Post by thesleepless »

maybe if there was a way to manually respond to a BuggerOff command, you can either do your own action and return true, or just return false to get default behaviour?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Absolute control over units

Post by AF »

hmmm I remember making a big deal over sub AI and being able to turn it off and was totally dismissed because no AI currently needed that level of control....
User avatar
Rafal99
Posts: 162
Joined: 14 Jan 2006, 04:09

Re: Absolute control over units

Post by Rafal99 »

Aren't Command AIs in the synced part of Spring code?
That means disabling them will cause desync in multiplayer games.

Imho units that are set to "Hold position" shouldn't move, no matter what, even if they block the only way to the other part of the map.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Absolute control over units

Post by yuritch »

casperjeff wrote:I intend to have a pretty tight reign on my units (right down to tracking which direction they are facing) and using minuscule movements to facilitate in-place rotations.
I see one problem there, and that is the new 'reverse' moving code (that was added in 0.80). AFAIK currently only S44 uses it (I'm very probably wrong considering I don't play any other Spring mod/game). That is, on very short move distances you can never be sure if the unit will turn and move with its front towards the goal OR it will reverse and backpedal there (resulting in exactly opposite facing to the one you expect), unless you recreate the same logic in your AI so it can predict which way the unit will take.

This only matters if the game in question makes use of the feature (S44 does and BA doesn't as far as I know for ex.), but I'd expect more and more games to start using features like that.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Absolute control over units

Post by SpliFF »

Not understanding your AI I could be talking shit but... don't you think locking the exact position and facing of every unit is kinda overkill? Aren't you likely to stress the CPU by trying to do things the engine is optimised to do better?

Anyway, on a practical note you may have some luck polling your units every 5 seconds or so and giving them a temporary move+rotate if they've strayed from your expected position. This allows the engine to do what it needs to do to allow units to move through blockages.

The only practical use of absolute control I can think of is the case where you want units to line up exactly along the perimeter of an enemy turrets range, without units at the back pushing them into range. Whether that happens enough to affect the outcome of the game is a bit questionable.

Maybe your case would be stronger if you provided an example of why such accurate unit placement is worth the time it would take to develop.
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Re: Absolute control over units

Post by casperjeff »

don't you think locking the exact position and facing of every unit is kinda overkill?
Probably. But....as an ex military guy (mechanized), I really want my 'squad' units to do the right thing when they stop movement...like forming up in a herringbone or a coil (crucial for proper security). Same thing with the concept of funneling the enemy and having units waiting in 'ambush'. Now in spring (more specifically BA or 1944), that is probably more an aesthetic issue than a strategic one as the LOS for each unit is probably 360 (unrelated to which way the unit is facing). The only real reason is speed to bring weapon to bear if they are limited in rotation angles.

To your point, it's probably not that big of a deal in the overall scheme of things....just wanted to know how the engine worked and what I had to account for.
you may have some luck polling your units every 5 seconds or so and giving them a temporary move+rotate if they've strayed from your expected position. This allows the engine to do what it needs to do to allow units to move through blockages.
I will probably end up doing something like this. The combination programmer/general in me just has a mental issue with telling a unit to do something or be somewhere and them NOT doing/being where I expected. :)
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Absolute control over units

Post by yuritch »

LoS is always circular in Spring, I don't know of any 'conventional' mods (so excluding things like Fibre) implementing custom LoS modes.

Factors other than LoS that depend on unit facing: restricted-arc weapons, directional armor (there is a system for that built into the engine even, plus some games have their own implementations), time needed to start moving in that direction. First two are important enough to use when they matter, but they don't matter all that much in *A mods. Last one matters in most any game/mod.
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Re: Absolute control over units

Post by casperjeff »

Factors other than LoS that depend on unit facing: restricted-arc weapons
Meaning like the Long Range Plasma Cannon or like mobile artillery units?
Not sure if you meant up and down arc or left-right arc.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Absolute control over units

Post by yuritch »

Spring weapons are in fact restricted to cones (WeaponMainDir and MaxAngleDif), so usually horizontal and vertical restrictions will be the same (not always, the cone can be directed at any angle incl. not parallel to the ground). Examples are all the turretless units in S44. I don't quite remember if BA mobile arty units have similar restrictions or not, LRPC's are 360 degree fire arc IIRC.
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Re: Absolute control over units

Post by casperjeff »

If another unit comes around (enemy or ally) and attempts to move 'through' the space of my unit, the internal engine AI won't take over and 'move' my unit out of the way, will it
Yes, it will for allied units, regardless of the move state.
This has effected my ability to create neat formations in that sometimes one unit will cross the path of others en route to his place in the formation and will move them out of position.

Do I get any kind of event notification on these engine based moves? (either when started or completed or anything?)
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Absolute control over units

Post by Kloot »

Nope; at best you will get a UnitIdle event when the unit stops moving again. Spring may be an RTS engine, but you won't find any military discipline inside of it. ;)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Absolute control over units

Post by hoijui »

casperjeff, i dont know.. i dont think that the stuff you want to do fits into an AI. it is more stuff for making a show, animation wiht spring, and would probably be better done with a Lua AI or genreal gadget, as you can have more fine controll there. I can not imagine you gonna get good performance with your AI, both CPU and game achievement wise. eg.. using many move commands just ot keep units in place .. is bound to be slow, if not in general, then at least when playing online with it. formations on the battlefield are not gonna work out (thinking on the regular army musqueteers in the patriot movie).
what is your goal in general?
casperjeff
Posts: 51
Joined: 14 Aug 2008, 21:54

Re: Absolute control over units

Post by casperjeff »

what is your goal in general?
My goal is to have disciplined units that follow orders of their commanders. My AI is based upon the chain of command concept (hence the COCAI name) including a robust implementation of a military TO&E and overall strategic plans managed by an S3 that can actually plan attacks, defenses and react to changing battlefield conditions.

Please note that I am not 'unhappy' with what is provided to the AI layer by the Spring engine...just want to make sure I understand all the capabilities that I have so I can steer around the potholes.

What I'll probably do is treat this not unlike any situation where a unit is 'forced' to do something outside the orders given to them from upline because of changing battlefield conditions. As long as this info passes upline, the commander can adjust. If a unit is out of position, the commander can just issue an order to bring him in line again.
Post Reply

Return to “AI”