Surround a Building/Mine/Tree… the RTS Style

  • July 7, 2016 at 22:24 #12550
    Mouad Louahi
    Participant

    Hello everyone! I’m using both Apex Path and Apex Steer, and I have a question regarding how to make a unit or a group of units surround a specific area(a set of grid cells within a certain radius). E.g: In age of empires (and most RTS games) you can order a group of villagers to gather resources from a mine or a tree… or a group of solider to demolish a building. How I can make such behavior using Apex tools? (Any hint is appreciated).
    Note: I have thought of asking for path to a certain location, then cutting from that path the radius of the building/mine, but.. I still need hints on how this can be made.

    July 7, 2016 at 22:35 #12552
    Geminior
    Keymaster

    What you are trying to achieve is a job for an AI and not something you would solve using path finding and steering alone.

    Rather have the AI assign position around the object you wish to be surrounded and then issue a move order to each unit giving each their own position.

    If you seek to do this in response to user input you can also access this logic from the input controller.

    Whether you want to issue an actual move order which includes path finding or whether you just want to activate a custom steering component to take up the assigned position (much like formations do) depends on your exact use case.
    Both options exist.

    July 15, 2017 at 10:48 #21384
    Adilson
    Participant

    I’m on the same situation. However, I’ve got Apex Path and I’ve downloaded the AI trial version and I’m having trouble to make my army/etc to surround a building to attack it, etc..
    It would be great if there was such example/tutorial in the examples folder. I’ve googled for something that does that out-of-box as I don’t want to re-invent the wheel, but I couldn’t find a single example/tutorial, just “it’s possible”..

    July 15, 2017 at 12:04 #21387
    Adilson
    Participant

    I just found your RTS demo and it’s great, mainly the last scene that combines everything.. I just need to learn how you guys did to be able to use it the MetalWorld001 scene has everything in terms of harvesting and combat. I played around and made the Red AI win changing the strategy to siege.. they build up so quickly that the Blue AI didn’t have a chance :-)

    July 21, 2017 at 17:34 #21475
    Velo222
    Participant

    I was going to ask the same question, as to how to do an “attack surround”, or to put it another way, where units know how to surround the enemy target using Apex Pathfinding. Currently, I read that Apex is fairly slow in dealing with paths that have to find the nearest walkable gridnode (is this true?).

    So, my original idea was to simply make each unit become a “dynamic obstacle” when they are in attack range of the enemy target. Is this a good idea? However, if the path (for whatever reason) is obstructed or is not possible, the Apex system simply stops the unit from pathing to the location, so I would have to know for certain what is the “closest walkable cell or location” to the enemy target.

    I need to retest (or do more tests), on how the Apex system responds to units calling paths in such close proximity to Apex dynamic obstacles surrounding another unit.

    It would be nice if the Apex system had a better way of dealing with “unwalkable” nodes (as Aron Granberg’s A* Pathfinding does easily using tags). And it’s fairly quick as well. The goal here, of course, is to have a quick, efficient, and reliable way for units to “know” that other units grid areas are temporarily unwalkable/unpathable, and then be able to make those grid-nodes easily walkable/pathable again after the unit is done attacking (or dies or whatever the case may be).

    I currently have a successful and well-behaved attack surrounding behavior using Aron Granberg’s A* Pathfinding, however I would love to be able to do this well using Apex Pathfinding — because then I could drop having to use two pathfinding systems, and simplify my game with only one (hopefully Apex Pathfinding). However, currently, I have to use Aron Granberg’s A* in order to surround enemy units, as Apex seems currently unable to do so effectively.

    • This reply was modified 2 months, 4 weeks ago by Velo222.
    July 21, 2017 at 21:14 #21480
    Velo222
    Participant

    Update: My “Dynamic Obstacle” solution seems to work quite well. Toggling on/off the “Dynamic Obstacle” area when units get into attack range of an enemy target is actually working, and units will path around the units that are currently attacking — which is great.

    The only problem seems to be that for some reason the “heap capacity” for the pathing engine tends to get quite large during big battles (and that’s about 30 vs. 30 units). I keep exceeding “800” heap capacity or larger during these battles — which causes the engine to stop for awhile. Which isn’t good.

    But the good news is that technically it works in theory — it just bogs down the system though :(

    July 31, 2017 at 16:36 #21562
    Geminior
    Keymaster

    Really the task of entering attack mode and surrounding units is not the job of a path finder, but rather of the AI. However if you are satisfied with the solution using the path finder, then by all means do so.

    With regards to the heap capacity, the warning indicates that a resize has been necessary and is a hint that you should configure the heap size to a larger value at design time to avoid these resizes.

You must be logged in to reply to this topic.