rts behavior

This forum is currently in read-only mode.
From the Asset Store
10 isometric and animated Strategy Game Buildings in two Colors.
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • Distance(x1,y1,x2,y2) might be useful here, provided you can get the picking right.

  • 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?

  • You mean making global variable?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)