Atrik Posted September 21 Author Share Posted September 21 (edited) 1 hour ago, nifa said: The ship's movement looks really natural. My favorite too Hopefully it can be a good starting point to make naval battles very different then land battles. 1 hour ago, nifa said: (on the elephant attack too late, on the catapult impact too early?). I think it's nice and I wanna encourage anyone who is able to test it Right. Edited September 22 by Atrik 2 Link to comment Share on other sites More sharing options...
guerringuerrin Posted September 21 Share Posted September 21 10 minutes ago, nifa said: Too bad it's not possible to make a mod, unfortunately I don't have it compiled. Having people who can compile is important for testing many things. I can help you with that if you want to do it some day 1 Link to comment Share on other sites More sharing options...
Atrik Posted September 22 Author Share Posted September 22 2 hours ago, nifa said: The timing in the other two videos might be not 100 percent on point (on the elephant attack too late, on the catapult impact too early?) Screencast+from+2026-09-22+02-47-35.webm Screencast+from+2026-09-22+02-49-43(1).webm Better? Also another demo about cavalry movement now : Screencast+from+2026-09-22+02-53-38.webm 4 Link to comment Share on other sites More sharing options...
Thalatta Posted September 22 Share Posted September 22 11 hours ago, Atrik said: Screencast+from+2026-09-21+22-14-52.webm 8.7 MB · 0 downloads Already ships not going through each other is an astronomical improvement (although realistically, for the more direct impacts the ram would perforate the other ship and reversing would be needed to separate them). I hope the same could be implemented for land units, making their movements more natural and their tactics more relevant. Link to comment Share on other sites More sharing options...
Atrik Posted September 22 Author Share Posted September 22 4 hours ago, Thalatta said: although realistically, for the more direct impacts the ram would perforate the other ship and reversing would be needed to separate them). I hope the same could be implemented for land units, making their movements more natural and their tactics more relevant. You are such a gigantic troll But I'll bump on it still, and give some nerdy details. The collisions between units are not indeed like solid bodies that are impossible to overlap, even with this PR, this will remain true for most units. It's more a spring-like push that tries to make units keep distance to each others. This pushing just use a distance-to-center repulsion force. What's introduced here for boats and elephants is a different stronger pushing and that actually take the unit's shape into account. This is why on the video you see that the hulls act like actual solid bodies. However simulating this, is ~x1.5 time costlier then the simple radial spring pushing. So because that, for small units, the difference in visible behavior would be minor, better go with the simple pushing, and use the better one only for big units that get the most benefits from it. A fun fact is that before this PR, all units were treated the same, so you did had still this radial-pushing for boats (the collisions were spring-like and only a small circle at the center of the boat was even acting as the hitbox) but it was still much bigger then for, say infantry. To detect if units were colliding, the map had a grid that allowed each unit to search a limited area where it might be actually colliding with other units. This grid size had to be proportional to the largest pushing unit of the game : boats - who's pushing effects where questionable anyway. Even if you played on mainland map with no ships whatsoever, the grid was sized to work for boats too. And your unit had to check their distance with much more other units they needed to. So you can say that the lag you experience on mainland, was partially due to ships. This along a few other optimizations with the pushing and more resilient obstruction handling, make the PR a performance improvement for common scenarios (yey!). 2 Link to comment Share on other sites More sharing options...
Thalatta Posted September 22 Share Posted September 22 49 minutes ago, Atrik said: You are such a gigantic troll Hardly , just pointing out history, realism, and possible improvements, more so considering many have stated a preference for tactics and formations becoming more relevant, which units not going through each other would automatically provide, in good part 49 minutes ago, Atrik said: The collisions between units are not indeed like solid bodies that are impossible to overlap, even with this PR, this will remain true for most units. It's more a spring-like push that tries to make units keep distance to each others. This pushing just use a distance-to-center repulsion force. What's introduced here for boats and elephants is a different stronger pushing and that actually take the unit's shape into account. This is why on the video you see that the hulls act like actual solid bodies. However simulating this, is ~x1.5 time costlier then the simple radial spring pushing. So because that, for small units, the difference in visible behavior would be minor, better go with the simple pushing, and use the better one only for big units that get the most benefits from it. Sure, but it's a theory/practise issue. Shouldn't increasing the radial repulsion force at a given distance (in physical terms, the elastic constant k, or stiffness) of land units achieve a more "solid" effect? Would this be costlier to simulate? I wonder how your cavalry turning would look in that case, for example. Link to comment Share on other sites More sharing options...
Atrik Posted September 22 Author Share Posted September 22 (edited) 1 hour ago, Thalatta said: Shouldn't increasing the radial repulsion force at a given distance (in physical terms, the elastic constant k, or stiffness) of land units achieve a more "solid" effect? You can see how "solid effect" of "stiffness" impact the boats in the video. You get super cool effects when there are a few ones, but a lot of them result in them taking a lot of time to settle. It's fine for boats as you rarely think of crowds of boats, and I just made a scene for this in the video to show that it works, and still look good for them. But if you have a crowd of infantry constantly wiggling and taking forever to settle, this would look very bad. Hence the spring. 1 hour ago, Thalatta said: I wonder how your cavalry turning would look in that case, for example. Inertia and pushing aren't the same thing. But for navigating on open terrain, this wouldn't change much. However if you try to funnel "solid" physical bodies into a choke-point, they obviously take a while more to achieve the same movement. So if ever we wanted to make cavalry "solid bodies", with this PR it's only just one tweak in their template. But because big crowds of them cost more to simulate and that moving them around take longer if they are in high number, it should be accompanied by an increase of cost/population for example. The pros are that they will have much more realistic charge effects, like you see with elephants, but cavalry have less contact area and are moving much faster, the physic outcome would be different too (like a cavalry can trow fewer infantry units away but at higher velocity). So this is just a balancing change, out of scope. Even without proper "charge", -so just using the old pushing pretty much as it was, the inertia improves physics for cavalry fighting at no additional cost. The cavalry can push away other spread units thanks to it's superior weight, and also push its target by a little - even if ideally it would be more, and the cavalry would be smart enough to take more advantage of it instead of stopping once in front of it's target. Screencast from 2026-09-22 18-44-41.webm Edited September 22 by Atrik 3 Link to comment Share on other sites More sharing options...
Thalatta Posted September 22 Share Posted September 22 24 minutes ago, Atrik said: Inertia and pushing aren't the same thing. But for navigating on open terrain, this wouldn't change much. Of course they aren't the same thing, those would somewhat correspond to independent Newton's laws after all. I was referring to the effects of their combination. What I noticed is that when cavalry change direction they go a bit into each other, and I wondered how their movement would change without doing so. But you say both "it wouldn't much" and "cost more to simulate", along with representing a "balancing change", the latter I think should be considered since far too many sword infantry seemed to be having a go at that poor elephant (avoidance and ranged attacks, mainly javelins if I remember correctly, is how the Romans dealt with them), although of course that's another discussion, but good if "with this PR it's only just one tweak". Link to comment Share on other sites More sharing options...
guerringuerrin Posted September 23 Share Posted September 23 (edited) @Atrik! I’ve been testing the PR. I haven’t noticed any functional bugs. Everything I’m noticing is related to tweaks for the units values. So I’ll share my impressions of their current behavior. In general, the units feel more “heavy” to me. I find it somewhat appealing, but I think it will all depend on the fine-tuning that’s done. I think some degree of overlapping could also be fine to make unit bumping feel less noticeable. I don’t think civilians and infantry should have such a gradual rotation, at least not when they’re moving individually. I hope I can explain what I mean. I don’t know anything about crowd movement, but I have the feeling that their turns should become wider as the size of the group increases, with this being more of a consequence of them bumping into each other. Maybe civilians could also be allowed to overlap with each other a little more. I’m sharing a few videos showing different situations. Unfortunately, we still can’t test multiplayer, so I did my best to simulate a battle. Woodcutting. Notice the woman on the left who gets stuck and can’t reach her destination, around the end of the video. I’ve never tested this with the vanilla version, so I can’t really compare whether this happens there as well.. Spoiler Chopping Wood.mp4 Mining brothers: Spoiler Mining Brothers.mp4 Here I get the feeling that the elephants are trampling the horses. Some horses appear to be standing still while being pushed around, or simply remain stationary, as if they can’t find a path to their targets. The trampling looks interesting, but the horses remain stuck for too long. Spoiler Trample Horses2.mp4 And the elephants seem to have this infinite pushing loop. I assume you’ve already noticed it. Spoiler Bouncing eles.mp4 Chopping Wood.mp4 Edited September 23 by guerringuerrin 1 2 Link to comment Share on other sites More sharing options...
nifa Posted September 23 Share Posted September 23 On 22/09/2026 at 3:07 AM, Atrik said: Screencast+from+2026-09-22+02-47-35.webm 1.58 MB · 2 downloads Screencast+from+2026-09-22+02-49-43(1).webm 2.24 MB · 2 downloads Better? Also another demo about cavalry movement now : Screencast+from+2026-09-22+02-53-38.webm 2.56 MB · 2 downloads Thanks, yes it's better. Calvary movement looks smooth too. In the catapult video those 2 guys walking in circles looks strange, but I guess it has nothing to do with the question here. On 22/09/2026 at 12:36 AM, guerringuerrin said: Having people who can compile is important for testing many things. I can help you with that if you want to do it some day Yes I want to do that some day when I have more time, thanks for the offer, I will get back to you 2 Link to comment Share on other sites More sharing options...
Atrik Posted September 23 Author Share Posted September 23 2 hours ago, guerringuerrin said: I don’t think civilians and infantry should have such a gradual rotation, at least not when they’re moving individually. 9 minutes ago, nifa said: In the catapult video those 2 guys walking in circles looks strange, Noted, yes after some playtesting also with @Effervescent it was clear that we should make infantry have more agile movements, which is mainly suppressing restrictions on turning. We also had interesting talks about using the new parameter "MaxAngle" to have ranged units in general start the attack prepareTime/animation while turning (they start drawing an arrow while they turn, so it makes micro interesting). 3 hours ago, guerringuerrin said: Maybe civilians could also be allowed to overlap with each other a little more. I think i did increase the value of pushing a tiny bit, but maybe before reverting I would try to see if you think it's better with the lowered Inertia effects (they are more agile so maybe it would fix it for you). 3 hours ago, guerringuerrin said: Here I get the feeling that the elephants are trampling the horses. Some horses appear to be standing still while being pushed around, or simply remain stationary, as if they can’t find a path to their targets. The trampling looks interesting, but the horses remain stuck for too long. I guess I did set a "stagger recovery rate" very low in the templates So you are right. 3 hours ago, guerringuerrin said: And the elephants seem to have this infinite pushing loop. I assume you’ve already noticed it. I didn't, but I should have saw it come. Yes this is one bug that is from this PR obviously, I can address that. The other ones I'm not too sure, the woodcutters getting stuck happens a lot to me in MP. Thank you so much for the feedbacks! I have a much clearer idea of what this PR needs now. Mostly tweaking the templates and fixing the big boys club dances. 3 Link to comment Share on other sites More sharing options...
Thalatta Posted September 23 Share Posted September 23 (edited) On 22/09/2026 at 6:55 PM, Atrik said: constantly wiggling and taking forever to settle 5 hours ago, guerringuerrin said: seem to have this infinite pushing loop 2 hours ago, nifa said: guys walking in circles looks strange I wonder if this could be solved, instead of removing how "solid" units are, by changing something else, like not reacting to repositioning so fast and simultaneously when close by (maybe hard to require), or being more permissive on supposed destinations if an obstacle is there (one can always reform after obstacles are removed if a specific formation is wanted, for which showing and shaping it by dragging the mouse at the destination like Rise of Nations and Total War would be useful, and has been asked). Edited September 24 by Thalatta Link to comment Share on other sites More sharing options...
nifa Posted September 23 Share Posted September 23 14 minutes ago, Atrik said: We also had interesting talks about using the new parameter "MaxAngle" to have ranged units in general start the attack prepareTime/animation while turning (they start drawing an arrow while they turn, so it makes micro interesting). This seems interesting! Another thought I had when watching the elephant videos (probably unrelated): All soldiers going back to idle at the same time when the elephant dies looks so abruptly, maybe there could be some randomness (like some cheering, some idle) or random delay. 2 Link to comment Share on other sites More sharing options...
parizaad Posted September 24 Share Posted September 24 The ship movement is really nice, and the inertia makes the collisions feel much more natural. It’s a shame it can’t be tested as a mod, but the demo videos still give a good idea of the changes. Hope more people can compile it and give feedback on the PR. 2 Link to comment Share on other sites More sharing options...
Effervescent Posted Sunday at 17:23 Share Posted Sunday at 17:23 Hi, Let me start by expressing how much I love the unit motions. The inertia aspect bring more depth to the units, and with the newly tweaked values, it's a good balance between realism and unit control ability (also micro). I especially love the turns cavalry make. that really gives the vibes of medieval cavalry going for raids. The unit animation sync needs to be handled though, so that the stop-animation syncs with units stopping, by that's a minor thing. As for the elephants. O.M.G. That thing is so fun to play. Elephants pushing and trampling units is so fun, and I wouldn't be surprised if this changes births a few elephant lovers in-game. The infantry units having different values from cavs and eles makes the most sense to me, tbh. It gives infantry agility, and tighter controls which their qudra-pedal brothers can only dream of. I'll try to recruit more testers for this and see how people feel about this in general, but I for one really love this and hope this gets pushed in the next alpha. Cheers. 2 1 Link to comment Share on other sites More sharing options...
guerringuerrin Posted Monday at 10:54 Share Posted Monday at 10:54 (edited) New tests on the latest iteration. The bouncing elephants bug is now much harder to reproduce. When trying to gather them at the same point, the issue is much less pronounced than before: Spoiler eles with space.mp4 However, I was able to reproduce it in the following situations: Walking around corners: I think the bouncing effect is triggered when two or more units become blocked by objects or other units of similar strength. You can see in one part of the video that a single elephant gets blocked, but nothing happens because it has enough space to bounce. Later in the video, however, more than one elephant gets blocked from all sides, and that's when the bouncing starts. Yesterday we talked a bit about adding some kind of diminishing return calculation to reduce the bouncing effect as it keeps repeating. This could be a relatively low-cost solution in terms of performance that might address the issue. Spoiler walking around corners.mp4 Moving through narrow paths: This is perhaps the most important issue to address. At some point, they should be able to "agree" on who gets through first. Common sense tells the user to destroy the house first before trying to pass, and it's perfectly valid for a successful attack to depend on the player's ability to move their units through narrow paths or turtle bases. However, it is still noticeable that more than half of the elephants get stuck in a space they should be able to pass through relatively easily: Spoiler attack target behind narrow path.mp4 It makes sense that they don't turn as quickly as they do in vanilla and that, as a consequence, their attacks and movement take longer to execute. After all, we're talking about a huge animal. Somewhat slower and, in a way, "clumsy" movement is to be expected. Beyond continuing to tune the elephants' physical values, I think it would be worth considering some degree of overlapping. Not as much as what currently exists in vanilla, but enough to help reduce some of the clumsiness and to emulate a slight "compression" of their bodies when they are packed together. After all, they are organic bodies with some degree of flexibility, not rigid objects like tanks. Could we also try making their hitbox oval rather than square? This might help reduce collisions between them even further. This last comment is outside the scope of this PR, but I think it's worth mentioning: This testing also made me wonder whether it's desirable for elephants to prioritize attacking nearby units over buildings. In the video example, I send the elephants to attack the fortress directly. Then I press H to make them attack freely. The elephants prioritize attacking the units, but the ones in the back can't reach them and end up bouncing around without dealing any damage. Elephants are perhaps the only "hybrid" unit in the game, in the sense that, although they are not classified as siege units, they can still destroy buildings quite effectively. Perhaps we should consider giving them a smaller target acquisition range, so that in situations like this, they choose to attack buildings instead. Edited Monday at 10:58 by guerringuerrin 2 Link to comment Share on other sites More sharing options...
Atrik Posted Monday at 21:33 Author Share Posted Monday at 21:33 10 hours ago, guerringuerrin said: However, it is still noticeable that more than half of the elephants get stuck in a space they should be able to pass through relatively easily Yes a herd of elephants getting stuck on a narrow path is somewhat acceptable but in the video the bouncing was way too awful. The reason why I would give this new "solid" propriety to only melee elephants amongst all land units, is that it's one of the costliest units. And "solids" having inelastic strong pushs, it will always make a large group of such "solids" always a bit tricky. But it doesn't mean that it should look as sh!t as in your video neither. I found a few bugs, improved some of the physics, and made couple tweaks that try to address that. Ideally we can still have "solids" do the minimum of overlapping. Tell me if you manage to test and still reproduce the weird bouncing! 1 Link to comment Share on other sites More sharing options...
Thalatta Posted 13 hours ago Share Posted 13 hours ago (edited) @Atrik, bouncing is expected since you are using linear pushing, and that's how springs work. A simple "fix" (or at least to show where I think the problem comes from) I just tried is not to keep pushing when the object is already moving away. In these test videos, I split all elephants in two groups and make them move against each other, press abort, make them go through a narrow path to attack a structure, and when they are concentrating on top of where that was, press abort. Notice the lack of bouncing in the second video (the one with my change) after pressing abort: Recording 2026-09-30 104423.mp4 Recording 2026-09-30 104650.mp4 The code I added to UnitCollision.cpp before the last line shown: const CFixedVector2D relativeVelocity = a.velocity - b.velocity; const fixed separatingVelocity = relativeVelocity.Dot(offset); if (separatingVelocity >= fixed::Zero()) distanceFactor = entity_pos_t::Zero(); CFixedVector2D pushingDir = offset.Multiply(distanceFactor); The fix doesn't have to be exactly like this, it could be a function depending on the relative velocity vector for example (to better handle any unwanted increased overlapping), but I think that's a simple way to add non-linearity, besides being realistic: a push is a force applied in a certain time interval (impulse), and this process is usually more inefficient if during this time the object moves away, because what's pushing falls behind of what's pushed. This is related to mechanical impedance, and that's why springs react more when pushed at their resonance frequency, since that timing doesn't fall behind, nor gets past, the points of most efficient energy transfer. I didn't notice a big difference when they went through the narrow path, but the unit's rotation when pushed seems to be quite a problem. I'd make torque effects more inefficient by, quite obviously, either making them more spherical or changing their moment of inertia, if that's how things are implemented (I haven't checked that). Edited 11 hours ago by Thalatta Actually, after a second look, I think there's an improvement when they went through the narrow path, less elephants seem to turn around, and their passage after the structure's destruction seems more natural and fluid, but more testing would be needed. 1 Link to comment Share on other sites More sharing options...
Atrik Posted 8 hours ago Author Share Posted 8 hours ago (edited) @Thalatta, I'm glad you built, tested, even more so dug a bit into the code. For your proposed change, I'm pretty sure I can make yourself disagree with it. You might have noticed collisions already take into account relative speed, by scaling the magnitude by it. The part you changed is the soft push, which only depends on how much the units overlap. That's on purpose: it's what gets overlapping units apart. With your check it's set to 0 whenever the units move apart, or stand still since you used >=. That doesn't make physical sense, and would now allow overlapping: two idle units on top of each other, or two units walking side by side at the same speed, would never be separated. Yes, some small wiggles are expected in any case. But they shouldn't look like units are bouncing. And they should settle very fast. Is your tests using the updated code (after i replying to @guerringuerrin)? I cannot reproduce such sever bouncing with it. 5 hours ago, Thalatta said: I'd make torque effects more inefficient Part of my last tweaks, for "solids" the soft push that extend beyond the actual unit footprint (used to try to have them spacing out more naturally) have very dimmed effect on spin. This help individuals in herds keep their facing direction under control. Edited 8 hours ago by Atrik Link to comment Share on other sites More sharing options...
Thalatta Posted 6 hours ago Share Posted 6 hours ago (edited) 3 hours ago, Atrik said: The part you changed is the soft push, which only depends on how much the units overlap. That's on purpose: it's what gets overlapping units apart. With your check it's set to 0 whenever the units move apart, or stand still since you used >=. That doesn't make physical sense, and would now allow overlapping: two idle units on top of each other, or two units walking side by side at the same speed, would never be separated. Yes, some small wiggles are expected in any case. Yes, I've seen lots of forces involved, but my change removing the bouncing shows "where I think the problem comes from". Thus, all other forces don't seem to have a noticeable role in that. I know it's more permissive to overlapping, that's why I said maybe it should be further modified to "better handle any unwanted increased overlapping", it was just a first approximation. I think an intermediate solution where in this situation there's some force but no bouncing might be possible. 3 hours ago, Atrik said: Is your tests using the updated code (after i replying to @guerringuerrin)? I cannot reproduce such sever bouncing with it. Probably not, I still don't have much experience with any of this since I built it yesterday (had some x32/x64 incompatibility issues) and tested it this morning. I used: On 19/09/2026 at 9:45 PM, Atrik said: PR link 3 hours ago, Atrik said: Part of my last tweaks, for "solids" the soft push that extend beyond the actual unit footprint (used to try to have them spacing out more naturally) have very dimmed effect on spin. I see. If it's still too much (as mentioned for ships at the beginning), consider that friction against the ground (or water) wouldn't allow such turns. I guess you already somehow emulate static and kinetic friction (weight dependent threshold and damping, respectively), which should moderate spinning and bouncing. Edited 5 hours ago by Thalatta Link to comment Share on other sites More sharing options...
guerringuerrin Posted 1 hour ago Share Posted 1 hour ago (edited) @Atrik, I tested the latest changes you pushed in commit aec6e57f96 The elephant blob looks really good to me. There are still some small bouncing effects, but it seems to be improving in the right direction. As for movement around corners and through narrow paths, the behavior is still failing too often. I've included some videos of the tests I ran: Ele blob test Spoiler Ele Blob.mp4 Walking around corners and through narrow path: First test, no micro at all: Spoiler Eles Stucked At Corners.mp4 In this second example, I helped them with some micro to get them to their destination. The results are better, but I still see it failing quite often. And paradoxically, the group without any micro performed better than the group I microed. Spoiler Eles Stucked At Corners Better Micro.mp4 As for moving through narrow paths, I got similar results to the previous test. The elephants get stuck at the entrance to the narrow path, and after a few attempts, some of them stop moving completely, permanently blocking the other elephants from getting through. It can also be seen that some of them get stuck on each other in an open area, significantly slowing down a group of them well before they reach the narrow area with the houses. Spoiler At Narrow Path.mp4 In this second attempt, I helped them spread out a bit and enter through different spots, but the result was more or less the same. Something strange also happened with the group at the top. I assume this is a pathfinder issue. For some reason, the elephants at the back of the group decide that the best path is to go around the forest. As a result, one of them runs into another elephant that is heading in the right direction, and the "elephanting" begins ( aka "elefant traffic jam" ) Spoiler Narrow Path Better Micro 2.mp4 In this last test, I send them back from the base. Look at what happens with the group at the top. One elephant tries to join the "path line", so to speak, and after a couple of bounces, it rebels and decides to stop moving altogether. As a good emperor, I ended up executing it. Spoiler Walking Narrow Path 1.mp4 I'm a bit short on time, so I wrote this rather quickly and haven't been able to go into much more detail. I hope this is still useful for continuing to improve the PR. Edited 1 hour ago by guerringuerrin 1 Link to comment Share on other sites More sharing options...
guerringuerrin Posted 1 hour ago Share Posted 1 hour ago (edited) A question came to mind while watching this freezing behavior: do elephants also receive that small "stun" when they are pushed? I wonder if that could be what causes some of the elephants to get stuck. An elephant gets pushed constantly and therefore never manages to leave the stunned state, making it look like it has stopped moving altogether. Edited 1 hour ago by guerringuerrin Link to comment Share on other sites More sharing options...
Atrik Posted 49 minutes ago Author Share Posted 49 minutes ago 2 minutes ago, guerringuerrin said: A question came to mind while watching this freez behavior: do elephants also receive that small "stun" when they are pushed Yes but it might not be the reason they freeze here, I think in your video it's mostly elephants pushing on each other's butts so they have a hard time facing the right direction and continue walking. Or maybe trying to reach a waypoint - a intermediate path goal, given by pathfinder -, but since a bunch of elephants are in the way, they wait trying to reach it. I think I can try to make these better. However I'll disclaim once again that this new "solid" propriety was designed for rare units, to have a very visible superiority when they collide with normal smaller units. So a large herd of elephants that get this "solid", will always be less agile then other units : they are not made to be in large groups. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now