Simple rts question->waypoints

This forum is currently in read-only mode.
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • So what exactly is a waypoint, besides the obvious x,y position?

    I mean does it do anything else besides offer a container for a position variable?

    From what I can tell, it looks like it has some pathfinding involved. Example I had a group of tanks set to move to the waypoint when I clicked a position, most of them instead of moving directly to that position, chose a path up, and around another "solid" object, that wasn't any way near either. Notice I said most of them, a few just ran into each other and stopped. I gather they couldn't figure a decent path is probably why they stopped.

    Then I have another question somewhat related.

    When you add the rts behavior, with the avoid other object event, is there any way to keep them from "fighting" for position?

    Now I realize this is always going to happen in a confined area along a path, but what about when they get to point x,y? They can't all occupy the same space.

    Basically whats needed is a way to give each object its own private variable, even if they are the same object. Then assign them that private variable= destination x,y + (random*n+ whatever the sprite size is), n being how many of the same objects there are, then roll the dice again if the x,y is the same.

    I don't know if that would solve the waypoint problem, but it should for the second question.

  • A waypoint is just a location to move to. If you say 'Move to X, Y' and enter a coordinate the other side of the map, obviously the unit tries to reach that coordinate. If you say 'Add waypoint at <position other side of map>, Add waypoint at <original position>' then the unit goes to both waypoints, in order. It'll go to the other side of the map, then come back to its original position.

    As for units moving over each other - use 'Avoid moving over object' action on start of layout. The RTS basics template has an example of this. Units will negotiate in to a queue and not overlap too much.

    It's not perfect though and I've been planning on improving it, especially since it's annoyingly easy to set up parameters that make them spin around in a dumb way, and you have to tweak the parameters at the moment to get it to work right. Hopefully I can come up with a better engine. It's really tricky stuff though.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:1wq07n7q]annoyingly easy

    Yeah it is. heh I spent a few hours on it and finally got some decent results by un-checking "solid", setting the "blocked speed" to 0, and setting the cell size to approximately 2x the sprites size.

    That's using the bounding box for collisions. You still get the occasional overlapping, but if you add an action like "if object is overlapping" move to some somewhere else. That's still a little spurious as they are all the same object.

    I was thinking it might be possible to use the family attribute to set up some kind of loop that gets the unique id for each member of the family, and then when a group is told to go to x,y points, instead of all going to one spot, they are each given a different coordinate that does not over lap.

    Sort of like go to waypoint, but go to area instead. Thing is the loop would have to be done at start up, and then again if a object in the family is spawned, or destroyed. Im just not sure how to set up a variable like that.

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