Micfild Posted December 8, 2021 Report Share Posted December 8, 2021 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! Quote Link to comment Share on other sites More sharing options...
wraitii Posted December 8, 2021 Report Share Posted December 8, 2021 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. 3 Quote Link to comment Share on other sites More sharing options...
Micfild Posted December 8, 2021 Author Report Share Posted December 8, 2021 (edited) Thank you @wraitii. Good to know! Edit1: I tested it out. It doesn't completely removes overlaping, but it does away with 90% of it. It does make unit movement more clunky though, so now i get it why it was added in the first place. Edited December 8, 2021 by Micfild Quote Link to comment Share on other sites More sharing options...
nani Posted December 8, 2021 Report Share Posted December 8, 2021 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 2 Quote Link to comment Share on other sites More sharing options...
Micfild Posted December 8, 2021 Author Report Share Posted December 8, 2021 Interesting. There is some good discussion on the matter hapenning at your post. Also, good point about the farm animals, i'll test that out as well. Thanks. Quote Link to comment Share on other sites More sharing options...
wraitii Posted December 8, 2021 Report Share Posted December 8, 2021 You mena the units overlap as if they had no collision at all? Have you tried using the template setting (DisablePushing) ? 1 Quote Link to comment Share on other sites More sharing options...
nani Posted December 8, 2021 Report Share Posted December 8, 2021 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. Quote Link to comment Share on other sites More sharing options...
Stan` Posted December 8, 2021 Report Share Posted December 8, 2021 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); Quote Link to comment Share on other sites More sharing options...
Stan` Posted December 8, 2021 Report Share Posted December 8, 2021 Actually <DisablePushing>true</DisablePushing> Seems to work for me, whether it's in template_unit or a specific template. And it make sense, I just misread the code. 1 Quote Link to comment Share on other sites More sharing options...
Micfild Posted December 8, 2021 Author Report Share Posted December 8, 2021 1 hour ago, Stan` said: Actually <DisablePushing>true</DisablePushing> Seems to work for me, whether it's in template_unit or a specific template. And it make sense, I just misread the code. Cool, I'll try this as well! Quote Link to comment Share on other sites More sharing options...
alre Posted December 8, 2021 Report Share Posted December 8, 2021 @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. 1 Quote Link to comment Share on other sites More sharing options...
Micfild Posted December 9, 2021 Author Report Share Posted December 9, 2021 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. 2 Quote Link to comment Share on other sites More sharing options...
alre Posted December 9, 2021 Report Share Posted December 9, 2021 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). 1 Quote Link to comment Share on other sites More sharing options...
Micfild Posted December 9, 2021 Author Report Share Posted December 9, 2021 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.