Announcement

Collapse
No announcement yet.

2 quick questions about macro based combat in an RTS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    2 quick questions about macro based combat in an RTS

    Hello!
    My friend and I are currently making a top down multi-player (over LAN network) RTS game. In this game you have cities, which can have units in (variable numbers), and you send those units to attack enemy cities (which have units in).
    I've added an image to give you a better idea of it at the bottom of this message.


    So the first question is: How would you move these armies across the map?

    I am thinking of passing the amount of units you send into an "army" actor and spawning that on the map, and moving it along a vector to its destination.
    It will have a trigger box so it can fight enemy armies it comes across on the map.



    The second question is: Where would you do the combat macro between an army and another army/city?

    The way we are thinking about combat working is like this:
    Each unit has damage and HP. Every round of combat (delay of X seconds in between round calculations) the total damage of each army is subtracted from the total HP of the other army to calculate losses. Then the next round starts, and so on until one army is defeated.
    We would like to have the army details update as each round passes, perhaps in a popup (widget??) above the fighting armies. Something like this: http://www.wasder.net/wp-content/upl...s-2-battle.jpg
    Somehow in here, if other armies turn up belonging to the players fighting, we would like to add them into the combat as reinforcements.
    Also, outside variables from the Player State (research technologies) need to be passed in to influence unit stats. We would also like to send variables into the Player State from combat to change scores like "units killed," etc.

    ALL of this is done in blueprints btw.
    Thanks for reading!

    The game map:
    Click image for larger version

Name:	themap.png
Views:	1
Size:	690.9 KB
ID:	1167566
    Last edited by StormaLorda; 11-26-2015, 10:51 PM.

    #2
    Since your map is tile based each tile can act as a node that will be part of the path the AI should take to arrive at its destination. A simple path finding algorithm wouldnt be difficult to put together and implement. You would need to add a list of Nodes that an Unit will consider as its final path on each turn that its required to move. Using SimpleMoveToLocation on each Node within the Units final path would suffice for something easy. The node locations would just be the center of each tile.

    If having the tiles seperated causes issues with generating a Navmesh, try adding a StaticMesh that is invisible. This will allow the Navmesh to generate over the entire map but you will still retain the tile base look.

    If combat is automatic or not, i would just implement it on the Actor itself, when the player requests that a Unit attack another, call a function that queries the defending opponents status and calculate the difference accordingly, each round applying this same function until victory is satisfied either by destroying the enemy or they flee.

    As for a Combat Summary, after each Unit has attacked, update a master list of attack orders and their corresponding details which you can then just display per round and possibly even provide as a final game overview at the end as well.

    Any stat changes that occur as a result of Technology Research or other means can be pushed to each Unit when applicable so that when the Unit attacks it will already have up to date stat information and wont need to go looking for it to make a final calculation.
    Im an Moderator on UnrealSlackers Discord! Which is a Community driven group of likeminded people here to discuss UE4! Join UnrealSlackers on Discord!

    Comment


      #3
      This may have everything you need: https://www.unrealengine.com/marketp...d-tile-toolkit

      Comment

      Working...
      X