RTS game pathfinding

You plan to implement them however?
How long do you think it will take you to implement them?

Hi

I do plan to implement it, however I will not have time in the near future. I’ll be away for a little more than a month from Friday.


Having the AI selected in playmode throws NotImplementedException.

also how to avoid this

Hey, currently there is no formation system in the RTS demo.
You can either use RVO to have the agents avoid one another.

Or write some custom code for all the agents to find their own destination,
linking a response from Aron here from a similar question:

2 Likes

Hi

Sorry for the late answer. I am currently traveling and I lost my laptop on a flight, so I haven’t been able to work for a while.

Oops. Indeed it does. You can safely ignore it though. I think the inspector should still be usable and the exception should not cause any problems other than being annoying.

Do you have the “Automatically Stop When Destination is Crowded” option enabled on the AIPath script?

Something else that is very helpful is to pick individual destinations for every agent. You can do this with: https://arongranberg.com/astar/documentation/dev_4_3_5_58efaa48/pathutilities.html#GetPointsAroundPointWorld (I really should add an example for it though).

Strangest thing is that I had this working a whole lot better when I was using RTS beta version 4.2.8.
I did not write any code for this kind behaviour and was just following your examples.
This is a clip of when I was still using the 4.2.8, and you can see its working a lot better

My only real issue with the 4.2.8 were some performance issues (which do seem fixed now). To be honest, I really didn’t expect the upgrade to 4.3.4 to be so drastic. Like with deleted components and all.

I tried tinkering with the RVO to see if it has any effect, but I think it just made it more crazier.

Looking at your RTS example closer, I think you’re doing your self a bit of a disfavor by using circles, because you cannot see their rotations very well. After adding some models details to the RTSUnit prefab, I think it’s pretty clear that their rotations are pretty frantic, even in the example.

Yes.
Here’s the configuration I’m using

Strange thing occurs when you hotreload scripts in playmode. The pathfinding starts to be super expensive. This is particularly annoying because our game supports hotreloading.
This bug appeared after upgrading to the 4.3.4, which uses burst. Maybe you’re now somehow storing data staticly, which doesn’t get cleared up on OnDisable.
I find this to be bit troubling, because it might also happening when reloading scenes?

I actually get this error when reloading scenes after hot reload.

Hi

Yeah, there might still be some bugs in the Burst version of RVO that causes different behavior. I will take a look to see if I can replicate what you are seeing.

Also, yes, I should implement some filtering for the rotations. When using RVO they very easily become very jittery.

The pathfinding system does in general not support hot reloading since so much state is in classes that unity cannot serialize at all. I’m not sure how you managed to support hot reloading in the first place :stuck_out_tongue:. I don’t think I am storing any data statically. I should definitely fix the “not disposed” errors though. They really look like bugs.

I am away on a holiday now, but I will have a look at it when I get back.

1 Like

Yeah by hot reloading,I mean OnDisable I create save with json of meaningful game progress. Like unit commands, positioning, whatnot. Then I unload all the scenes (including the pathfinding), reload them and then apply the save.
This worked with old RTS pathfinding version, not the new one.

Yeah you did mention it. I’m pleasantly suprised if you have a chance of look at these things in a month.

1 Like

Aah. I see.
That definitely sounds like a bug. I will try to replicate it when I get back.

Are you back in action? :sweat_smile:

Sort of. I’m currently at Unite in Copenhagen :slight_smile:

Just saw this thread! I was asking about just this previously. I’ll see if I can get the RTS Demo to work.

UPDATE: Sadly that requires a pro license, So I will check it out after I complete my project. I’m pretty sure I’m not allowed to use paid assets for a course project. If I’m wrong about that, expect to see lots of questions about how to get it to work. :slight_smile:

fix the rts branch pls

I will when I get back to my main computer. Unite has been pretty hectic so I haven’t been able to get a lot of work done.

1 Like

@sepnax

I have tried to replicate the native collection has not been disposed errors, but I have not been able to.
What I have tried to do is to just use the RTS scene and use a script to reload the scene several times, but it doesn’t seem to trigger it. Do you have some steps I could follow to be able to reproduce it?

@sepnax

I’ve been debugging the difference in behavior when the agents are stopping and it seems like it’s due to some bad constants I had in my code. From the point where the agents noticed that the destination was crowded they would wait for more than a second before actually starting to slow down.