All you are doing is making them go to the center of the node that the their target position is in.
Old one on the left, new one on the right
All you are doing is making them go to the center of the node that the their target position is in.
Old one on the left, new one on the right
I am going nuts. The right one is my goal. How to call it when âai.destination = (Vector3)AstarPath.active.GetNearest(target.position);â is wrong?
The right one should be precisely what you get. Note that this will in no way prevent multiple units from selecting the same target point.
hmm, so it only works if the target is already blocked before? or is it a gamble if units select the same target point or chose getnearest?
what would you do if you just wanted a good old 90âs grid based movement:
Hi
That depends. Those games very likely included a ton of hacks to make things work just right for their game.
For example by just blocking nodes it is very hard to make units avoid each other that are moving in the opposite direction in a narrow corridor.
To do it from scratch you can use the ITraversalProvider (see docs about turn based games). However as I said above, it will involve tons of special cases.
I have also uploaded a beta of cooperative pathfinding which is similar to what you want. You can check that out and take a look at the example scene called âCooperativeâ. You can find it here: https://arongranberg.com/astar/download, click on âShow older versionsâ and then download 4.1.9 on the branch called âcooperativeâ.
I saw -cooperative- yesterday but it has to many restrictions, like all units have to have the same speed etc. Everything from scratch is no option neither, cause I am not into pathfinding.
We talked about opendune, dune-legacy and openra before. Do you think they are all hacking nowadays although itâs opensource and somebody will say: that can be done nicer!? ^^
on the other hand, I am asking myself the whole day: who would have a need for pushing and jostling units/characters which never stop fighting for their position?
hi aron,
great new update!! just implemented and itâs working.
my project has the rvo 2d example project as prototype. I had to add the RVOExampleAgent.cs to the AI gameobject cause RVOController doesnt have a SetTarget function? Then I had to deactivate RVOExampleAgent cause it seems to conflict with RVOController. but now I can finally move the AI by calling agent.SetTarget(new Vector3(2, 0, 0));
Thatâs an ugly workaround. How would you handle that?
Thatâs how it looks like. Target fighting ftw
Hi
I could share my RTS test project with you if you want.
It loooks like this at the moment: https://www.youtube.com/watch?v=wBUdMXeeej0
It has some solutions for reducing the target fighting like you can see in that video (all units are ordered to move to the same position when the player clicks on the ground). That solution is not super performant right now, but it scales OK to a few hundred units.
Ouya, looks great. Please share and make it a part of A*PP in future updates
Does this help you?
If thatâs not a huge problem, I would love to see the code of your RTS Demo as well!
When can we expect this? Looks great.
Btw: The whole morning was your site down, again, with an ubuntu error message. Are you hosting that at home?
Hi
Iâm literally just uploading it
I had been running some heavy background jobs on my server and unfortunately that caused the serverâs disk space to run out.
Iâve uploaded a demo now.
You can find it on this page: https://www.arongranberg.com/astar/download if you click on âShow Older Versionsâ. You will then see an upload in the ârtsâ branch. It has an example scene called âRTSâ that you can try.
Note that this example scene is very much unfinished.
thank you for that! short feedback:
1 - everything is fine to be used in a 2D environment, right?
2 - units fighting for the target, though arrived (use get neighbor and stop moving?)
3 - would be awesome if youâd include your logic here too: http://arongranberg.com/wp-content/uploads/sc2avoidance.mp4
Not so important:
4 - takes ages to load the scene
5 - invisible turret under those crystals?
6 - waves get attacked by this turret but are selectable and can be moved by me
keep up the good work!
1 Not that setup exactly because it uses the RichAI movement script. I think everything else should be fine in 2D though.
3 Thatâs the logic that is included.
3 - How about seeing other units as obstacles too (not pushing through) and if there is no way around using your sc2avoidance script?
About 3. Could you show a video of it?
sure.
btw: there are several missing scripts on the camera, units etc.
Oops. Looks like I messed up the SC2Avoidance .meta file when uploading it. Iâm uploading a new version right now.
New version is uploaded now.