stopping units shooting at cliffs

Discussion in 'Planetary Annihilation General Discussion' started by Sower85, April 29, 2013.

  1. Sower85

    Sower85 Member

    Messages:
    35
    Likes Received:
    0
    Hi,

    I dont think this has been covered, but forgive me if it has...

    One of the very annoying things I often come across in a game of SupCom, is land units shooting the floor/cliffs when there is a level difference between them and their target, and t3 bombers not dropping their bombs from high enough when a target is on top of a cliff and also close to the edge of the cliff.

    Ive wasted many units, sending them to attack something and them just shooting the floor (usually on 3rd party maps i admit) but the problem with bombers and height is seemingly on any map. Its especially annoying when you know all the bombers will get shot down by t3 fighters after the 1st run, and all the bombs they drop basically miss because the bomber calculated when it needed to drop its bomb based on it's height and distance to target, rather than the target's height.

    Hopefully these issues can be fixed in PA, as I see a lot of problems with this happening on small asteroids etc. i.e. you dont want two bots on opposite sides shooting at the ground because theyre technically in range, despite there being an obstacle in the way.

    Mike
  2. blacksun777

    blacksun777 New Member

    Messages:
    14
    Likes Received:
    0
    yes this a interesting thought.
    in a rts game like warcraft it would hit nomatter what.
    here it won't hit.
    for land units: the range of a unit could be its height/ the ability of how far away not to shoot in the ground. or how much it is able to use an artilery tactic.

    for air units it's a complex problem. even if the bomber knows he is not able to hit the way he is comming in. what should he do then? it all comes down to how much ai such a bomber should get.

    to be honest that is the reason i do not like air. canon boats are ok though
  3. bmb

    bmb Well-Known Member

    Messages:
    1,497
    Likes Received:
    219
    supcoms aircraft were extraordinarly terribly put together though. even a minimum of ai would have enabled them to perform far better

    other units were capable of targetting other units based on gravity, travel time, acceleration etc of the projectile and the movement speed of the target, they just didn't perform any checks for obstacles.
  4. veta

    veta Active Member

    Messages:
    1,256
    Likes Received:
    11
    +1 to op
  5. Sower85

    Sower85 Member

    Messages:
    35
    Likes Received:
    0
    Do you mean units in other games? Im a little confused here...

    The targeting AI might be quite a nice thing to give a better version of to more advanced units? i.e. t1 bombers might miss, but t2 bombers are much less likely to?
  6. bmb

    bmb Well-Known Member

    Messages:
    1,497
    Likes Received:
    219
    I meant units other than aircraft
  7. BulletMagnet

    BulletMagnet Post Master General

    Messages:
    3,263
    Likes Received:
    591
    FA's aircraft accounted for everything land units did.

    Nothing accounted for obstacles. That was the problem.
  8. Sower85

    Sower85 Member

    Messages:
    35
    Likes Received:
    0
    exactly. this seems like a little thing, but it really affects gameplay and basically induces micro.

    If a fail limit of a few shots was built in, and if met, the unit changed position based on the flow field's cost, where the higher the cost, the more difficult it makes it to hit (if flow fields can be used in a combat context, as well as a movement context).

    I know thats a big IF condition, but im sure the guys can work it out with their 1337 skills into something more elegant and I just put.

    But I really do think this would make little subtle differences to make your army more efficient.

    Also, another thing - isnt it very annoying when turrets shoot the floor too? could the normal fire range circle be filled in with red spots where it cant hit due to the turret not being tall enough? I think this would only be good for point defense. as it could get too complex for longer range stuff. But something like this would help out when building defensive towers, to avoid them shooting the floor too.
  9. pantsburgh

    pantsburgh Active Member

    Messages:
    151
    Likes Received:
    39
    I'm not super knowledgeable on AI stuff, but I believe a lot of this has to do with constant LoS (or Line of Arc?) checks on tons of units being pretty expensive to process. I also believe that as a game gets more expensive to process (tons of units) it switches to using algorithms that run faster but aren't as accurate*. This definitely used to be the case for pathfinding, but flowfields should basically totally fix that. There might also be some compromises made due to other things like each client doing 100% of the sim work.

    What this actually means in the context of PA I have no idea. Dedicated servers should help alleviate a lot of this, but if you're running a game that is pushing the limits of the server it's on I expect there will still be some compromises made to get it running faster.

    *Edit, "accurate" meaning units might take shots that will hit obstacles, or units will pathfind a route that isn't the fastest route.
  10. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    This exact behaviour was present in TA when units were set to manouver. They would shoot a few times, and then relocate if they were hitting terrain (I think they only did this once or twice before giving up, but it's better than nothing, and that was 15 years ago).
  11. Sower85

    Sower85 Member

    Messages:
    35
    Likes Received:
    0
    Ok, well I figure its not in supcom otherwise I would never have started this topic...

    Ta was a long time ago, so surely this feature must be included, and working better to boot!
  12. lollybomb

    lollybomb Member

    Messages:
    64
    Likes Received:
    8
    I've found that in SupCom it's picky about whether it thinks it's hitting or not. Doing come experimenting just now, and here's what I've come up with.

    If a unit comes into range of an enemy without an attack order it will attempt to hit that target. After about 10 failed shots it will give up.
    If a unit is given an order to attack an enemy unit the AI will move the attacker to a new position roughly every 10 failed shots.
    Only problem is that sometimes it thinks that it's hitting, but it's not. I've actually had two groups of units firing on each other for close to a full minute without either side landing a single hit, moving, or giving up.
    http://steamcommunity.com/sharedfiles/f ... d=78474693

    Admittedly both sides were the computer, so I can't vouch for what standing orders they had. All I know is that they just stood around shooting up the dirt until I came over and carpet bombed them.
  13. wintermist

    wintermist New Member

    Messages:
    37
    Likes Received:
    1
    I just imagine it can get quite cpu intensive if it's going to account for each and every shot hitting or not, and if not, move to another position and try again. Which position to move to, pathfinding.. and so on. It might just get too much what with all them units everywhere shooting, it's fine where there are just smaller skirmishes, but in larger battles, I think it might just get too much to calculate. Lord knows SupCom had enough problems with pathfinding slowdowns already.
  14. mistermaf

    mistermaf Active Member

    Messages:
    95
    Likes Received:
    0
    Or...you could just implement a line of sight system that would prevent the units in question from shooting at all if they cannot make direct sight on the target. Lots of games today do this. Wargame: European Escalation/AirLand Battle are great examples because they trace the unit's LoS with a line for you and show you exactly where it is that the view becomes obstructed.

    Here are some quick examples from an early tutorial mission:

    [​IMG]
    In this image, my unit is within range and line of sight and is preparing to fire on the target.

    [​IMG]
    In this image, my unit is out of range of the target.

    [​IMG]
    In this image, my unit is within range of the target but does not fire because its line of sight is blocked by the forest.

    Because of the line of sight system, if there is a building, hill, mountain, edge of a minor change of elevation, forest, or any other obstruction between a unit and an enemy, it will automatically not fire and the player is informed why. This to me seems a lot more natural than having the AI attempt to fire at an enemy and then move somewhere else if they hit the ground...

    And before you comment, a given game of Wargame has hundreds of units on the field at a time and doesn't struggle with processing LoS checks. Every individual tank in the above image is a unit that requires LoS and range to shoot, not just the group of four. You could have that group of tanks next to a building or coming over a hill and have half of them shooting and half of them not because of how some can see an enemy and some can't. That's done for every unit in hundreds of units in any given game. Processing isn't an issue.
  15. GoogleFrog

    GoogleFrog Active Member

    Messages:
    676
    Likes Received:
    235
    The units in Spring are quite good at avoiding obstacles, I'd expect the units in PA to do the same.
  16. Baleur

    Baleur Member

    Messages:
    122
    Likes Received:
    22
    Thats true about LoS.
    But that wont solve issues when you have a tracking center or have turrets/units shooting at radar targets out of sight, or when you order a manual attack at an area behind a hill.
    You still want them to shoot even if out of sight, but...... NOT at the hill :lol:

    I don't know how resource-intensive it is to add a raytracing check for units shooting, or perhaps some sort of (i don't know programming, bear with me)

    If = missed_shots > 5
    Then
    maneouver_random_direction 5

    Is this sort of thing possible? Some sort of check that if the unit shooting misses too many shots in a row, it'll try to move around a little?
    What if it's a turret or big bertha?
    Could something similar be implemented like

    If = shots_fired 5
    And
    If = shots_hit_cliff 5
    Then
    switch_target
  17. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Well the most obvious thing to do is to check if the if the Line of Fire is clear before firing. If the shot would hit the terrain the unit won't fire. If there are other targets in Line of Fire the unit would shoot at those instead.
    The not so obvious thing is what the unit should do if it is specifically ordered to attack a unit behind a hill or the ground behind a hill.
    Should it stay put without moving?
    Should the unit path towards the position of the enemy?
    Should the unit move to the closest position from where it has clear Line of Fire to the target?
    For example there might just be a little bump in the way so if the unit moved to the left or right it would have free Line of Fire to the enemy instead of moving all the way up to the bump before it can fire.
    Making a unit move to the closest position from where it can fire seems like it would be really resource-heavy.
  18. mistermaf

    mistermaf Active Member

    Messages:
    95
    Likes Received:
    0
    [​IMG]

    I still don't see the issue. The hill here blocks my scout's line of sight so it can't fire at the position I'm telling it to fire at. Thus, it doesn't even try. Just do a LoS check to the position you're trying to manual fire at.

    If this looks like there's no fog of war, btw, it's because sight in this game is more realistic. There's no "fog" but units can spot enemies for you. All the same, in this screenshot (again from the tutorial), the scout is my only unit. Since it can't see over the hill, there could be a small army sitting there and I wouldn't know it. The point in saying this is to validate the use of this game as an example. There are plenty of opportunities that I could want to fire at unseen enemies even though there is no fog of war.

    How every single strategy game handles this scenario: make a beeline at the target until it can fire. If there is an obstruction that cannot be traversed, make a beeline to the corner of the obstruction and fire when LoS is made.

    Anything more complex than that is supposed to be done by the player. I see nothing wrong with this system; it makes the unit's behavior predictable for the player so it never does things the player doesn't want to and reduces processing load. Nevermind the fact that it puts the tactical part of the fight onto the player, which is kind of the point of these games.
  19. Baleur

    Baleur Member

    Messages:
    122
    Likes Received:
    22
    Thats true, yeah. I don't know what i was thinking O_O
    I was thinking about like, arcs, like artillery. But obviously artillery does not follow line of sight rules anyway.

    Well... I guess my point still sort of makes sense.
    Big Berthas in TA for example, they are artillery but still fire like a turret. If there is a hill in the way, it could still presumably lob a shell over it to hit, if the distance is right.

    I guess the Line of Sight check would have to conform to the ballistic trajectory of the shell, rather than just a simple LOS line straight from the unit.
  20. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    I'd expect rudimentary Line of Fire checks to be in PA.
    Line of Fire checks is done on a large scale on the Spring engine. And that system can even check for obstacles like trees, rocks and friendly units and avoid firing if those block the units Line of Fire.

Share This Page