rts behavior

For questions about using Classic.

Post » Sat Jul 24, 2010 12:19 pm

I have several question about rts pathfinding.

Anyway im currently making trucks that go around building stuff by themselves, but the point is if i set to avoid themselves they pretty much get stuck in each other, if they are solid obstacles they pound into each other and it looks ridicoulus. Also when i change the pathfinding cell size, with smaller size they are prone to get stuck more often, anyway whatever i have tried ends up pretty not good. With lots of units it also causes sometimes to crash. If the truck are not obstacles to themselves then its okay, but i would rather have them not going over each other, also my tile map and most unit sizes is 32x32 and i cannot adjust the cell size of pathfining to 32x32... which is annyoning, cause it would probably be better. I have tried a lot of combinations of code and settings, but nothing good so far.

So if anyone knows what would be the best type of simple pathfinding code and setting for a normal go around stuff without being silly looking, to use please respond.
B
3
G
4
Posts: 54
Reputation: 1,183

Post » Mon Jul 26, 2010 3:11 am

Set up custom pathfinding for the truck objects, and give them both the Add Pathfinding Obstacle Truck and the Avoid Moving Over Truck. Then regenerate each one's obstacle map periodically, since they're moving objects. I think that should solve a majority of your issue.

Alternately, have an invisible Sprite (use bounding box collision) with a larger radius than each truck follow them around (and probably match their angle), and use that for their pathfinding instead of the trucks themselves. It would give you a little less of that "trucks crashing into each other" effect. This gets trickier, though, since you'll need to account for each truck's own invisible sprite so that it will actually move at all.

Beyond that, there's something to be said for checking if the trucks are within a certain radius of each other, then if so, using the LinearAim System expression to find out where they're headed and then veering away from that point. It's going to take a little more number-crunching and finessing for you to do to get it the way you like it, but it might be the most satisfactory option when you're done.
B
2
S
1
G
2
Posts: 48
Reputation: 896

Post » Mon Jul 26, 2010 4:50 am

Distance(x1,y1,x2,y2) might be useful here, provided you can get the picking right.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Jul 26, 2010 5:00 pm

thanks for the replies, although i am going to try and make a custom pathfinding, but since im not that good of a programer, it may take a while, anyway does anybody knows how do i spread value in construct?
B
3
G
4
Posts: 54
Reputation: 1,183

Post » Wed Jul 28, 2010 6:18 pm

You mean making global variable?
B
5
S
1
G
2
Posts: 70
Reputation: 1,140


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests