Jump to content

Why can units overlap?


Recommended Posts

Some context:

I've been messing around with the pathfinder.xml file in an attempt to stop units clumping too much when in battle or marching or gathering resources. But it didn't matter which variable i changed, the best result i could get was that units would overlap and then be pushed (rather slowly) away. If i make pushing zones too big, then those units can't hold formations properly.

Then it occured to me that i might be going in the wrong way, and a question was formed: Why can units overlap in the first place? They don't overlap with buildings (as far as i know) or with terrain features, so why can they do it to themselves?

Is this a feature? An unintended consequense of some obscure code?A bug that has yet to be fixed? Or something else entirely?

 

Thanks and have a nice day!

Link to comment
Share on other sites

23 minutes ago, Micfild said:

Is this a feature? An unintended consequense of some obscure code?A bug that has yet to be fixed? Or something else entirely?

it is a feature, introduced in the latest alpha, referred to as "unit pushing". It makes movement of groups of units much smoother overall.

You can turn it off in the pathfinder XML by setting 'Radius' to 0, or on individual unit templates by setting <DisablePushing>true</DisablePushing> in the UnitMotion component parameters.

  • Thanks 2
Link to comment
Share on other sites

24 minutes ago, wraitii said:

it is a feature, introduced in the latest alpha, referred to as "unit pushing". It makes movement of groups of units much smoother overall.

You can turn it off in the pathfinder XML by setting 'Radius' to 0, or on individual unit templates by setting <DisablePushing>true</DisablePushing> in the UnitMotion component parameters.

I tried these same settings but I instead got multiple units overlapping.

See for more context

 

  • Like 2
Link to comment
Share on other sites

16 minutes ago, wraitii said:

You mena the units overlap as if they had no collision at all? Have you tried using the template setting (DisablePushing) ?

Yes, added that parameter to the base template template_units.xml but the overlapping still happened.

Link to comment
Share on other sites

15 minutes ago, nani said:

Yes, added that parameter to the base template template_units.xml but the overlapping still happened.

Can you try the counterproductive 

<DisablePushing>false</DisablePushing>

Thoughts behind it

// Original code for disabling pushing

SetParticipateInPushing(!paramNode.GetChild("DisablePushing").IsOk() || !paramNode.GetChild("DisablePushing").ToBool());

// No tag

auto tagOk = !paramNode.GetChild("DisablePushing").IsOk() // true
auto tagValue = !paramNode.GetChild("DisablePushing").ToBool() // true
SetParticipateInPushing(true);

// Tag present <DisablePushing>true</DisablePushing>

auto tagOk = !paramNode.GetChild("DisablePushing").IsOk() // false
auto tagValue = !paramNode.GetChild("DisablePushing").ToBool() // false
SetParticipateInPushing(false);

// Tag present <DisablePushing>false</DisablePushing>

auto tagOk = !paramNode.GetChild("DisablePushing").IsOk() // false
auto tagValue = !paramNode.GetChild("DisablePushing").ToBool() // true
SetParticipateInPushing(true);

 

Link to comment
Share on other sites

@Micfild computers don't simulate physics too seamlessly, in order to avoid units pass trough each other like gosts, you must have collision detection. Since A25 however, 0AD gave up collision detection in favour of unit pushing.

How it would work in previous alphas is this: if some units is going to move in top of another, the engine stops it, and queues a new, equal, move order to it. As a result, units would stop for a brief moment, and then start moving again, this was described as "unit bumping on each other", all the bumps slowed down mobs nex to chockepoints or when manouvring, and all the move orders were heavy on the pathfinder.

With unit pushing, units can actually be pushed forward when moving, by other units in the back, and go faster than they would when alone - the process is symmetrical, so the units on the back are slowed down, but by average, the mob goes at the same speed of a unit on its own, disregarding any chockepoint. The way parameters in pathfinder.xml affect pushing is a bit counterintuitive, and in fact, in my mod for reducing unit overlapping, I actually reduced pushing radius. You can find it here.

also check Res Gestae mod, wich has another take still on reducing overlapping.

  • Like 1
Link to comment
Share on other sites

7 hours ago, alre said:

How it would work in previous alphas is this: if some units is going to move in top of another, the engine stops it, and queues a new, equal, move order to it. As a result, units would stop for a brief moment, and then start moving again, this was described as "unit bumping on each other", all the bumps slowed down mobs nex to chockepoints or when manouvring, and all the move orders were heavy on the pathfinder.

I remember that part of A24. A25 pushing mechanics really smoothed things quite a bit, which was great. Unfortualy it came with a cost, which is not so great. But at least it can be fixed (eventualy).

 

7 hours ago, alre said:

The way parameters in pathfinder.xml affect pushing is a bit counterintuitive, and in fact, in my mod for reducing unit overlapping, I actually reduced pushing radius. You can find it here.

I checked you mod and your pathfinder values are indeed smaller than the base game. But what it seems to make the most difference, for me, is the Friction aura. It seems that slower units have a more difficult time overlaping. If i'm not mistaken, in another post by @nani, there was a discussion about how farm animals seem to overlap much less than other units, even with the push mechanics. Since they have the same "Default" parameters most other units in the game, it might be because of their speed (which is very slow).

 

7 hours ago, alre said:

also check Res Gestae mod, wich has another take still on reducing overlapping.

Yeah, that mod also has a great AI, Catilina. It does 3-4 minute cav rushes and booms to full pop in 13 minutes. I went as far as extracting just the AI (and the pathfinder file + friction aura) just to play against it in the base game.

  • Like 2
Link to comment
Share on other sites

2 hours ago, Micfild said:

I checked you mod and your pathfinder values are indeed smaller than the base game. But what it seems to make the most difference, for me, is the Friction aura. It seems that slower units have a more difficult time overlaping. If i'm not mistaken, in another post by @nani, there was a discussion about how farm animals seem to overlap much less than other units, even with the push mechanics. Since they have the same "Default" parameters most other units in the game, it might be because of their speed (which is very slow).

you are right, it is because they are slow, but that has little to do with the friction aura in fact. How friction work is this: units that are overlapping are slowed down, so that are left befind by the rest of the mob, and thus can stop overlapping. Instead, I'm convinced that the thing with livestock having a harder time overlapping is caused by the fact that a maximum value for unit pushing is hardcoded in the unit motion system, and that value is measured in meters per game turn, minimal pushing in pathfinder.xml also uses the same unit. Now of course, if a unit moves very fast, for hard that you can push it, you will only deviate its path so much, because of how many meters they cover in little time, but if a unit is very slow, pushing it will truly move it away from where it stands. I think maximum pushing should depend on unit speed. Also, in the engine there is still a form of "unit bumping", and you can tell sheeps and cattle bump on each other quite easily. That feature is coded at line 242 of the already linked file, but that control is less sensible to faster units, to the point that I don't believe it ever works on cavalry at all (it sometimes does on infantry, but only on extreme cases).

  • Like 1
Link to comment
Share on other sites

7 hours ago, Micfild said:

But what it seems to make the most difference, for me, is the Friction aura

@alre, Further testing revealed that the impact of the Friction aura in avoiding overlaping isn't as significant as i thought. I ran you mod without them and it felt almost the same (units were a bit faster though, as expected).

It kind of reached a level of clumping that i'm ok with. It wasn't as eye catching as the base game (I still have to test it with siege though).

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...