Weapon Ranges as Hard Limits (currently) vs probabilistic limits

Discussion in 'Planetary Annihilation General Discussion' started by mostuniqueusername, January 12, 2014.

  1. Reianor

    Reianor New Member

    Messages:
    20
    Likes Received:
    13
    I find it hard to believe because I, more or less, have an idea about how much extra load the physics can add to the game, both on the side of coding and on the side of actually executing that code. More often then not the games "fake" it. Well, the ones that aren't trying to make physics their bread an butter anyway...

    Keep in mind though, that it's all speculation, I neither coded PA, nor had the chance to examine it's projectiles close enough.

    Anyway, I'll try to explain what I meant.

    In a "square" map a "direct shot" or rather, it's trajectory is defined by 4 values. 2 for the coordinates of the starting point, and 2 for the coords of the ending point. IE if unit A is shooting unit B with a "gun" the "bullet" goes from (AX, AY) to (BX, BY). That's uses the math that people get comfortable with back at early school. There's no need to fake or emulate anything here, the question of continuing the shot and hitting something behind is an easy one here.

    Right... I'll go buy a game for the sake of one argument...

    My experience with TA is limited to seeing it once shortly, back in the day when it was a relatively new game. I don't remember much about it. But my memories of TA-Kingdoms (which I played long enough) are telling me that it was effectively "flat with quirks". As in "I don't remember any fireballs being shot from the hill in the direction of unit below the hill and stopping it's flight in the ground as it should have in 3D space" flat. So if memory serves, TA-K was using a simple flat geometry for it's "collateral". Maybe I'm forgetting something, or Maybe TA was also ahead of TA-K in it's physics, I dunno, but to be honest, I'd be surprised if they coded actual 3D physics in there, because that'd be a colossal waste of resources back in those days.

    SC wasn't entirely flat, I even remember that good old vid, where a plane collides with a start-up nuke, and the resulting explosion hurts the base of the nuker. SC was lagging as hell though. Still I doubt that they did complex flight path simulation for the standard "direct shots" of ground to ground weapons. It was still a square world though, in which gravity is just a fancy thing that pulls your cannonball "downwards".

    PA would have to consider the question "What the heck IS downwards anyway?". In case of 3D math they would have to calculate the direction of gravitational vector. For "warped 2D+height" method they'd have to use more complex math, because in warped 2d the good old "there's only one line that connects two dots" that we are all used to, no longer holds true. You can't simply get a pair of coords in there and send a bullet from point A to point B, because there are numerous paths that it could travel from A to B.

    We're using this "flat math" in real life as a suitable approximation, because it gives laughable deviation due to our distances-in-question being incomparable to the size of the earth. In a game where you could see half of the planet on one screen it's no longer such a simple matter.

    I seriously doubt that PA is calculating the shooting trajectories of each and every ground to ground direct ("riffle") shot , and maybe even for indirect ("cannon") ones with full respect of planet's curvature.

    But then again, I'm just speculating. I didn't get my chance to mount a small moon to shoot bullets and cannons all over it, and, chances are, I'll not get one until release.

    Yeah, right, are you sure that those are REAL physics trajectories, not fakes? I'm asking this becasue if they are fakes (which is a reasonable thing for them to be), than the game's engine is probably using the coords of the shooter and coords of the point he was "aiming" at to draw the trajectories.

    This, in turn, would mean that either the collateral damage would look unbelievable and silly , or that they would have to introduce complex enough algorithm to each and every shot that'd make the whole point of faking trajectories moot.

    Representation of WHAT?
    Are they adjusting distance based on friction (which is based on atmosphere, and should differ from planet to planet)?
    Are they adjusting distance based on gravity (also differs from planet to planet, even of the planets with the same size and biome)?
    Are they adjusting accuracy based on curvature? (you know, where otherwise unobstructed shot with the same distance will look like a clear shot on one planet, and be an "indirect shot" on another)

    You know, we shouldn't really dwell on "realism" in such a game because no matter how much effort they'd waste, there's no end to the unreality of all this.

    Besides, what about this particular "representation of a PART of realism" is so different that it should be considered more useful than a gimmick?

    Riiight... Enlighten me, state those two missing formulas. I believe you are "under thinking" this.

    Maybe one of the devs would care to enlighten us? How exactly is the game handling the projectile flight paths/physics?
  2. ledarsi

    ledarsi Post Master General

    Messages:
    1,381
    Likes Received:
    935
    reianor, if you've never actually seen or played TA, and you don't actually know how it works, why would you assert it isn't fully physics simulated in 3D? Because..... it was. It is not a good idea to speculate about its physics system when you haven't even played. TA was fully 3D, with full physics simulation. That's all there is to it.

    Regardless, the real issue here is the gameplay implications of having an accuracy drop with increasing distance. It's a good idea. For many kinds of weapons it is actually a very good idea, but not for everything.

    As I said earlier, it is not a good idea to allow weapons to hit at significantly beyond their 'maximum' range. If there is random variation in a projectile's trajectory which can cause it to exceed its maximum range a bit, that is acceptable, but it should not be a big factor.

    Instead of having inaccuracy for weapons firing beyond their listed range, weapons could be inaccurate at their listed range, and have their accuracy increase as the target gets closer.
    godde likes this.
  3. mostuniqueusername

    mostuniqueusername Member

    Messages:
    79
    Likes Received:
    54
    I don't think I explained myself very well initially. The bottom line question I was trying to put to the community is:

    Should weapons fire be perfectly accurate as it is now, or should accuracy be based on distance?


    If accuracy should be based on distance, then I think accuracy should gradually decrease as distance increases up to a certain range, and then beyond that range the weapon will not fire. That range should be far enough that accuracy has degraded significantly and the chance of getting an accurate shot is fairly low (10%, for example). For defensive planning, the most useful range measure would be the range at which the chance of an accurate shot is still 90%. My suggestion is that this range should be approximately equal to the current 'max range' for each weapon and it could be called the "Maximum effective range."

    As far as damage degradation, I have no opinion really. I suggested it only as an afterthought. Other posters here made great points that a bomb is still the same bomb no matter how far it travels. Lasers degrade but very little and only if there is atmosphere, which I suppose there is on PA planets, but I am less concerned about damage degradation as accuracy degradation.

    Also, a clarification on how TA/Supcom/PA simulate weapons fire: As far as I have ever read about this 'family' of games, or experienced, rounds are "flown out" in simulation. The round's flight path is simulated until it collides with something (the ground, a unit, the top of a wall, or the side of a structure) or travels too far. You can tell this is being done because direct fire weapons can miss a moving target and vehicles can move out of the way of an artillery shot - even from a move order given AFTER the shot was already in flight. Another example is that your own factories and structures can block low-arcing or direct-fire weapons from reaching your enemy.

    As for the level of effort to add this feature, I'm going to take a crack at determining that. I'm taking some guesses here as to how the game works, but here goes.

    Currently, the logic for choosing if a weapon should fire and where it should fly to for a non-homing weapon is something like this:
    Code:
    if distance_to_target < weapon_max_range
      then fire(target_location)
    
    I am suggesting changing it to this:
    Code:
    if distance_to_target < weapon_abs_max_range
      then fire(target_location + random_variance_based_on_distance())
    
    weapon_abs_max_range is the range where the probability of an accurate shot is 10%.
    One very simple example of a formula for random_variance_based_on_distance is:
    Code:
    = (distance_to_target / weapon_abs_max_range)^2
        * max_miss 
        * random_magnitude * random_unit_vector
    
    max_miss is a constant for the weapon, it specifies the maximum distance that this weapon can miss by. max_miss of 0 means the weapon has perfect accuracy.
    random_magnitude (pop POP!) is a random floating point number between 0 and 1 using a uniform distribution.
    random_unit_vector is a "unit vector" (math term) in a random direction.

    Accuracy, on average, decreases quadratically with range in this formula, and the randomness still allows for perfect shots at long range once in a while. Again, this is a simple formula, there certainly are better ones that would taper off more slowly at low range and more quickly at high range.

    Once the 'modified' end point of the round is chosen, the path flown and objects hit are calculated exactly as they currently are, there would be no changes at all to that part of the game engine unless my assumptions are very wrong (and if they are I would love to know about it).

    It is very unlikely that this increase in complexity will have any significant impact on the server workload because:
    1. This calculation is only done when a round is fired, not for every 'tick' of the flight path.
    2. If a game had 1 million weaponized units in play, and each could fire 1 round per second on average, then this calculation would have to be done 1 million times per second by the simulating CPU.
    3. Even a low end modern CPU can do Billions of floating point calculations per second, so even for very large games the overhead added by distance based accuracy variance would be a few milliseconds per second.
    4. TA did this 16 years ago on hundreds of units, when CPUs could only do tens of millions of floating point operations per second, and at the same time it was performing software-based real-time 3D rendering of the battlefield.
    beer4blood likes this.
  4. mostuniqueusername

    mostuniqueusername Member

    Messages:
    79
    Likes Received:
    54
    Well said. I've 'refined' my idea a bit and just made a very long post about it. I believe it is right in line with what you are thinking. Zero degradation / perfect accuracy is still possible via a constant assigned to each unit. I also define two ranges - one is your 'listed range' at which the weapon is inaccurate, and I do agree that if only ONE range is shown then THAT should be the range that is shown to the user. But I also think seeing two circles would be nice, where the inner circle is showing what I call the "maximum effective range" which is where the weapon's accuracy is still above something high like 80-90%. (Similarly, TA showed two circles for weapons which had a minimum firing distance.) But I would also be OK if knowing where the 'sweet spot' for a weapon is is just something you have to learn with experience playing the game.
  5. Reianor

    Reianor New Member

    Messages:
    20
    Likes Received:
    13
    Because I've seen TA-Kingdoms and it's shooting physics was fake, because it was a massive strategy game of the times when physics was mostly simple and fake even in less resource demanding and more physics depending games, and because from common sense standpoint it's the right thing to do in order to save PC resources.

    Also... because it's THAT hard to believe, even with so many people claiming otherwise. I've just seen to much fakes being mistaken for the real thing to believe that a game of such age could have had the real thing.

    From "realism perspective" - no. Humans "miss" for two reasons - inaccurate aiming, and inaccurate holding.

    Both are not a concern for a machine. They may, theoretically, have flawed aiming code, or problems visual recognition, but I find it hard to believe that, "ultimate machines of destruction" that are destroying the whole space by ACCURATELY moving planets don't have adequate gyro-tech or zoom-tech or are otherwise flawed in their combat routines.

    There are also physical reasons, but those are nearly moot. Wind isn't much of a problem for a bullet. And then again, don't get me started over on physics of the PA's multitude of planets with different atmosphere, gravity and whatnot...

    PA has better places to allocate resources to.

    From realism stand point we'd better let the issue rest.

    From gameplay perspective - no. Honestly, that's a balance headache, UI headache, and AI nightmare three-in-one-for-no-apparent-gain package. Where'd be the fun with dealing with variable-based-on-range shooting prowess of whole ARMIES in a large scale strategy game?

    Balance, headache because different ranges and weapons mean different "fall-off". It may be beneficial to fight some battles beyond optimal, some at optimal, and some at some point between. Go balance that.

    UI headache because to "make things right" they'd also have to introduce ways for the player to see max ranges and optimal ranges, and to define at what ranges exactly does the player want his units to keep from their targets without overseeing them manually.

    AI nightmare, because they'd have to teach AI to understand and use all that, to let it chose the distance properly considering a mixture of different units at different ranges present on the battle field, and also teach the unit-based AI to choose their targets properly.

    Well, all that, or they can turn the whole matter into, "Whoever has more micro, and knows the ranges, gets more out of this feature! And screw AI! Who uses it anyway!?", and that'd both sting and stink.

    It may look like a good feature to you, and probably you aren't planning to abuse it, but there'll be those who will.

    From gameplay perspective I'd rather see it buried.
  6. ledarsi

    ledarsi Post Master General

    Messages:
    1,381
    Likes Received:
    935
    A unit's "optimal" range is not something that should be baked into its design explicitly. Its maximum range can be baked into the unit design, but its 'optimal' combat behavior is not so easily determined, and may actually change based on the situation, such as against different enemies or taking into account terrain, elevation, and other factors.

    What I propose is to have a unit with a displayed maximum range, just as now. However at that maximum range, the unit will not hit every shot. But as the target gets closer, the unit's accuracy would increase. Also note this would not apply to all weapons- guided missiles, short-range assault weapons, and other weapons might have the same accuracy regardless of range.

    However I disagree with the notion of having a second range, such as an expressly defined "optimal" range, or even with expressly defining accuracy. That's not how projectile simulation works- there isn't a pre-calculated dice roll.

    To implement distance-based inaccuracy, a very slight random variation in the unit's firing angle is probably all that is necessary. As the target gets closer, the firing error gets smaller, but the target's size remains the same, making a hit more likely.

    However a unit's "optimal range" is more complicated than that. For example, a tank with a turret with a limited traverse rate is ineffective at close quarters. Even though its tank cannon would certainly hit almost anything the barrel was pointed at, its turret traverse speed becomes a limitation.
    godde, beer4blood and nanolathe like this.
  7. chronosoul

    chronosoul Well-Known Member

    Messages:
    941
    Likes Received:
    618
    Have you played World in Conflict?
  8. liltbrockie

    liltbrockie Active Member

    Messages:
    314
    Likes Received:
    160
    I agree with OP i think it would be a great dynamic to add.
  9. beer4blood

    beer4blood Active Member

    Messages:
    917
    Likes Received:
    201
    So tell me again how you know they're fakes when you said yourself you don't know coding and have seen said games only once????
  10. beer4blood

    beer4blood Active Member

    Messages:
    917
    Likes Received:
    201
    Ledarsi always a man of wisdom and good explanations ;)
    I believe though TA maps are 2d with different height variations to represent and make the game play like 3d.

    Yes you should go get TA so you can be informed of what you are currently pulling out your arse. 5.99 at God.com or you can rip it from the pirates bay, however that version has a mod installed already.
  11. beer4blood

    beer4blood Active Member

    Messages:
    917
    Likes Received:
    201
    Sorry no matter ho how advanced the technology is it will still miss. There will always be variables that can't be calculated. Like if the target dies before impact or moves in a different direction.

    As far as realism go shoot at something three feet high a hundred yards away and miss. What happens to your projectile??? It doesn't magically stop right there a hundred yards away does it???


    You should go research physics and come back after that and after you play or just watch YouTube of a game that simulated it SIXTEEN YEARS AGO!!!!!! When the system requirement was 64mb XD seriously though
  12. beer4blood

    beer4blood Active Member

    Messages:
    917
    Likes Received:
    201
    Sorry for multi posts hard to edit on my phone.

    I'm for effective ranges as well like tanks and artillery being horrible at cqc. I believe things at the edge of engagements are harder to hit already though as I see tanks miss when I skirt their range with bots. I really just want the projectiles to continue instead of stop at the edge of engagement magically.
  13. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Apparently you didn't play TA-Kingdoms enough. If you did some further testing you would find out that projectiles can pass above enemies as well as hit the terrain if it missed. TA had pretty much the same physics model from my experience.
    A simple experiment would be to build a wall segment beneath a high hill or a castle wall. Place one Fire demon on the hill or the castle wall and one fire demon beneath. Then attack the ground far away with the Fire Demons so that the wall segment is in line with target location. The Fire Demon on the low ground will hit the wall while the Fire Demon above will fire above the wall.
    I don't know if TA-Kingdoms took any shortcuts with its' 3D simulation but I am sure that it were 3D to a large degree where projectiles could go above ground units, trees and terrain while going under or above flying targets.
  14. beer4blood

    beer4blood Active Member

    Messages:
    917
    Likes Received:
    201
    Yea I don't see why the game made after the original would use a different engine......

    Was kingdoms good??? Never played it, therefore I won't make asinine comments on something I really have no knowledge of, unlike some ppl......
  15. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    I liked the game. It had much more profound unit diversities between the 4 different kingdoms than TA and the unit roles were very different from each other.
    I think the biggest complaint from TA players were that they didn't like the simple economic model with only 1 resource and that there were less units overall in TA:Kingdoms even though many units in TA ended up being redundant in competitive play.
  16. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    I find the O.P.s idea viable ..given correct balance! but viable. I think we should put it into PA. Perhaps it's the next big element of simulated projectiles that shall serve as another betterment compared to other rtses.
  17. comham

    comham Active Member

    Messages:
    651
    Likes Received:
    123
    Edge cases are important.
  18. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    There is at the moment some inaccuracy at maximum range.
    beer4blood likes this.
  19. KNight

    KNight Post Master General

    Messages:
    7,681
    Likes Received:
    3,268
    Yes, edge cases are important to consider, but if a mechanic will ONLY cause an issue/matter in edge cases you need to really question whether including that mechanic is worth it.

    Mike
  20. beer4blood

    beer4blood Active Member

    Messages:
    917
    Likes Received:
    201
    @KNight Most engagement happens at the edge does it not??? I only charge when I know my units are doomed already.....

Share This Page