What's the best way to assign these faggots formations so they don't bump into each other?

What's the best way to assign these faggots formations so they don't bump into each other?
My algorithm works 80% of the time but when there's rotation there is a big chance of faggotry like in webm related.

Attached: 2018-07-07 18-41-40.webm (1280x720, 1.82M)

Other urls found in this thread:

howtorts.github.io/2014/01/03/steering-flocking.html
youtu.be/zmTgj4SKftc?t=56
gamasutra.com/view/feature/131721/implementing_coordinated_movement.php
twitter.com/AnonBabble

Useless fuckwits get the stomp.

Attached: 2018-07-07 18-42-04.webm (1280x720, 1.4M)

total war: shit edition?

Yeah, I should totally care about graphics before even implementing basic mechanics. What the fuck was I thinking?

Treat rotation as a part transformation to translation if the only problem is doing both at the same time.

Besides all the latest Total Wars have been shit editions.

Part should be post

why the huge hitbox, why do you allow friendly pushing? maybe make friends traversable

dont listen to him. It already looks better than 99.9% of shit greenlighted on steam

elefant stronk!!

nerf when??

reduce the hitbox

Every time one fills his gap you can refire the goto nearest slot to prevent them from fighting.

Might be pretty heavy on CPU if there's a lot of units.

Attached: 1525620369835.jpg (454x809, 42K)

just turn on noclip

Further more
Can you remix your formation translation or are they stuck with their assigned slot?

Btw those ugly lines are just in debug mode for various purposes.
I'll think about it. The way I do it now is that I slice up the units and the corresponding target positions in several horizontal groups and then within those groups I assign the units in vertical order (see pic related).
But obviously that doesn't work very well. And I'm only testing quadratic formations now. It get's more fucked up with different kinds of formations.
It's supposed to be more realistic physics-wise. I don't like how most RTS skim over collision and mass.
Collision between friendlies is already more lenient than between enemies. I can make it even more so but I still need to fix this formation problem.
That's probably why greenlight doesn't exist anymore.

Attached: 2018-07-07 19-57-12-34.jpg (1280x720, 290K)

That's a possibility but as you say probably CPU heavy.
There must be an algorithm that can do this in one go.
Not sure what you mean. The indiviual units are not stuck in the same slot.
If I'd do that there would be huge chaos when rotating.
I try to reassign the best possible positions every time they get a new move order.

Why don't they end up at the same troop position they started?
The one at 2|2 doesn't end up at the slightly angled 2|2 anymore.
If he would, it should have been fine.
Also, right now they all move at the same speed. Other games slow down individual units to restore troop formation. You could try calculating the max speed based on relative distance. So that the one who has to walk the furthest has max speed and one who only walks 70% as much as the furthest only goes at like 70% max speed.
I have no experience though so don't listen to me

You could map the optimum time required to arrive at position X with noclip on and fire a goto nearest just after the time expires.

You're gonna make a linux build, right?

Attached: 1525362584427.gif (480x320, 1.96M)

You want to look into flocking/steering. Example: howtorts.github.io/2014/01/03/steering-flocking.html

This is currently in Java cause that's the language I know best, so probably yes.
I first tried to do it in 3D and C++. The problem is that animating crowds of thousands of units takes some serious DirectX know-how which I don't have.
That's why I'll first try to do one with 2D units (maybe 3D map).

I thought pic related with adjusted walking speed would work fine without collossion.
It would collide if you have more than a 90 degree angle though.

Attached: ss (2018-07-07 at 20.56.28).png (603x785, 185K)

Go hang in a tree, /v/tard

Sorry, that pic was wrong. Pic related is what I meant.

Attached: 123.png (536x800, 140K)

how about rotation first, translation second?

The realistic thing would be first to walk to the target and then rotate with every soldier keeping the same slot.
That would be pretty game breaking gameplay-wise, though. You would need 10 seconds simply to turn your unit on the spot.

Flocking /steering
What this niggardly guy said

Thanks. I'll look into it.

i'm sorry, i meant the rotation/translation as group(/flock)

>What's the best way to assign these faggots formations so they don't bump into each other?
>My algorithm works 80%

it's called a rotation matrix

1) determine a center point (which you have)
2) calculate each entity's distance to the center point, multiply that with the rotation matrix to get your next position or waypoint for that entity.

Just a random idea:
In I said it would only work up to 90 degree angles.
Your example in is between 90 and 180 degrees and it seems it can be solved by mirroring everyone's target position along the horizontal and vertical axis.
So if (angle = 270) just go,
else do vertical and horizontal mirroring on the target position matrix/table.
Combined with adjusted walking speed, I think that would get rid of all collission, if you only use rectangle groups.

However, this would destroy the order of your troops, so if that is important, it won't work.

I don't understand why they can't all keep the same position. The top row does and it works fine.

Research "Reciprocal Collision Avoidance". It's the industry-standard RTS pathfinding implementation.

kek youtu.be/zmTgj4SKftc?t=56

If the units were always running around in a fixed formation then yes, one could probably implement all relevant cases to avoid collision.
However it could also be possible for the formation to be completely messed up due to a fight. In that case that approach would fail.
If the video is correct, it's not exactly what I would want.
That would still take longer than optimally assigning positions which is definitely possible. I just need the right algorithm. I'll look into first.

Attached: 123.png (536x800, 127K)

gamasutra.com/view/feature/131721/implementing_coordinated_movement.php

IRL turning formations was hard as fuck, it takes time to line up the meat puppets, that's why army's lined up across from each other on a battlefield, just go straight ahead and kill everything in front of you, but for that small scale stuff just use much looser formations.

Doing it the realistic way would be easier programmatically but I doubt it would be fun playing with armies that are that clunky.

Allow friendlies to walk through each other

Yeah the skill that leades up to a battle would be much harder to translate into a fun game, and that is not what OP is going for, maybe set up the meat grinder in the center to run more or less by it self and focus game play on the cavalry and skirmish at the edges, or somehow embrace the god like power to control units directly.

Allow each piece to move independently but not crash into others. Perform collision detection for each cycle. If collision is happening, ajust the angle 15 degrees and try again. If collision happens in 360 degrees, wait x number of cycles and try again. Or just monte carlo that shit..

I think I have figured it out now. At least I'm not encountering those hang ups anymore. I slightly changed my slicing algorithm (explanation in next post).
I also made friendly collision more lenient. The only thing missing is variable speeds to make it perfect.

Attached: 2018-07-07 23-11-33.webm (1280x720, 2.26M)

p cool

So, instead of grouping the slots horizontally I now group themeffectively in rows and in the size of the coloumn width. In pic related it would be 8 units per group.
Then I fill those rows with the units that are closest to them measured by the perpendicular distance to that row.

Attached: 123.png (805x900, 251K)

* them effectively

Question: what's stopping you from just rotating the matrix, instead of whatever autistic way you're doing it now?

Think about what will happen here if I just rotate the formation as it is.

There's no collision if you rotate the entire formation.

the problem now is that they do not move in formation.