Circle vision vs real range - Pelter and Radar

Discussion in 'Support!' started by Martenus, March 4, 2014.

  1. Martenus

    Martenus Well-Known Member

    Messages:
    530
    Likes Received:
    437
    So far I have this issue with two structures - pelter and radar.

    If you click pelter, you can see its range by red circle around it. The actuall range does not correspond to the circle, but is smaller. Yes I had a radar coverage. I cannot express this is any dimensions, but the difference is significant, if you trying to place your pelter just so he reaches the structure you wanna destroy, you gonna have a bad time.

    Another issue I have is with basic radar. its "clear vision" circle does not correspond to actual vision. In the bright circle you can see only dots and units pop out from nowhere from dots to actual models. It is very confusing to tell what is gonna appear - you can see dots, but you cannot see what it is until probably the middle of the clear vision circle.
    The radar should have its clear circle vision reduced to match the actual vision, and the total range can stay unchanged, showing only unidentified dots.

    I cannot confirm it, but there might be a similar problem with Holkins and advanced radar, same as other defensive structures and units - their range radiuses don't correspond to the circle drawn on the planet.

    This would need some checking, so if anyone knows about a difference between shown range and actual range, let us know.
    blacksword13 and kayonsmit101 like this.
  2. j4cko

    j4cko Member

    Messages:
    47
    Likes Received:
    37
    Is it always happening or on specific planet sizes? I can imagine physics rules getting in a way of UI showing the range written on paper. As the ballistics are calculated. Dunno bout the radar tho - horizon curve? But that's only assuming small enough planet.

    Thought its the case when playing FFA Commander wars where building an artillery didn't quite cut it ;)
  3. Martenus

    Martenus Well-Known Member

    Messages:
    530
    Likes Received:
    437
    Standart planet size 600-800 radius.
  4. j4cko

    j4cko Member

    Messages:
    47
    Likes Received:
    37
    Well there goes my theory ;)
  5. puppeh

    puppeh Member

    Messages:
    42
    Likes Received:
    9
    I had a similar issue with the Holkins earlier, just couldn't get it to fire to enemy units/structures within its red highlighted range. I did wonder if maybe the planet was too small, but I guess the range indicator should reflect this? Will try it again later when I next have a game.
  6. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    What was the height range? The circle it draws should be correct for height range = 0
  7. Martenus

    Martenus Well-Known Member

    Messages:
    530
    Likes Received:
    437
    No clue, but it wasn't zero for sure.
  8. cptconundrum

    cptconundrum Post Master General

    Messages:
    4,186
    Likes Received:
    4,900
    I wouldn't expect it to ever be off by that much though. It does sound like a bug.
  9. kayonsmit101

    kayonsmit101 Active Member

    Messages:
    197
    Likes Received:
    128
    Same experiences for me. I wasn't sure if the radar thing was on purpose or a bug though. If it is intentional I am not a fan. I don't like having radar lift the fog of war but instead of showing what is there everything comes up as radar blimps still.
  10. jdrozdik

    jdrozdik New Member

    Messages:
    1
    Likes Received:
    0
    I've noticed that shellers which just had their range increasted to be the same as pelters fire no where near their advertised range. They'll shoot 70% the distance at best. Even with radar, visual and attack commands. They'll drive forward to a shorter range then fire instead of just firing at everything in the red circle.
  11. rawrifficus

    rawrifficus Member

    Messages:
    36
    Likes Received:
    17
    What the guy above me said shellers range isn't correct.
  12. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    So there's two different topics here, radar range and weapon range.

    Lets start with radar sight range as it's the easier one (mostly).
    The radar vision range is the range as it is set in that unit's spec (the client's local .json file). I go through the recon list and look for the maximum radius for each "channel". The game renders a sphere at the center of the unit's location with that range. Though some shader magic these get turned in to the vision fog or range rings you see in game.

    Now the question of why is the radar range wrong? Well we don't have a way to separate the vision distance rendering between different recon layers, so I just take the maximum range ignoring the layer. When I wrote the code we only had underwater and surface vision layers, and underwater was almost always tiny compared to surface ranges so this was an acceptable approximation.

    Now lets look at the recon spec for the radar unit:
    Code:
        "recon": {
            "observer": {
                "items": [
                    {
                        "layer": "surface_and_air",
                        "channel": "sight",
                        "shape": "capsule",
                        "radius": 100,
                        "uses_energy": true
                    },
                    {
                        "layer": "surface_and_air",
                        "channel": "radar",
                        "shape": "capsule",
                        "radius": 600,
                        "uses_energy": true
                    },
                    {
                        "layer": "orbital",
                        "channel": "sight",
                        "shape": "capsule",
                        "radius": 300,
                        "uses_energy": true
                    },
                    {
                        "layer": "orbital",
                        "channel": "radar",
                        "shape": "capsule",
                        "radius": 600,
                        "uses_energy": true
                    }
                ]
            }
        },
    
    We now have an "orbital" layer, and for the radar its "sight" range is 3x the distance of the "surface_and_air" layer. Woops!
    There's other fun issues here too, like you'll notice the shapes are listed as "capsule" which has some... interesting behavior on the way the server handles recon vision distances that the client does not yet replicate. This really only causes problems with radar satellites right now though.


    Now the second issue, weapon ranges. Weapon range is determined by a number of factors. The most basic one is a max distance setting in the weapon itself. It is a range that the unit will not target regardless of if its projectile or weapon is capable of firing those distances. This can be most apparent when a unit is attacked by several units at a time and is utterly obliterated by incoming fire. The remaining shots will sometimes fly far beyond the usual attack ranges. Eventually most of these will be cleaned up so that the projectile lifetimes don't grossly outrange the weapon's intended use.
    The other way weapon range is determined is by calculation of a firing arc. This takes into account factors like pitch ranges, projectile velocity ranges, gravitational arc, and intermediate collisions (like a cliff side in the way). This is an expensive calculation we already do quite frequently and can be a not insignificant portion of the sim performance. Many man hours have already been spent trying to make this as efficient as possible, but it is not a calculation that the client game can efficiently do potentially millions of times every second (as would be required to accurately render the "true range" of the weapon). We've discussed doing some sort of loose grid and interpolate in between, but the resulting data would still be so inaccurate as to be possibly less useful than even the current range rings. Really what you want is to know if you can hit x targets or not, and that would be fine if you have one unit selected and maybe one or two units are in range to check against, but if you've built a line of 10 holkins and have an entire army advancing your position the number of calculations required would quickly become insurmountable.

    Edit: A little more on firing ranges. The range circle is of course drawn with that max range I mentioned in the exact same way the radar and vision ranges are rendered. They're also somewhat incorrect as the server does range checks based off the location of that particular weapon's aim bone (as set in the unit spec), whereas the rendered distance is from the center of the unit.
    It's also entirely possible to set the max range of a weapon to a distance that is greater than any combination of the other weapon settings allow. This is sort of intentional as it gives range preference to higher ground, but it makes drawing the ranges more difficult. It can also lead to setting the max range to something wanted for their balance without that unit being capable of getting even remotely close.

    I really want to spend some more time on these kinds of problems, but they're already incredibly expensive parts of the rendering pipeline I would only make worse.
    Last edited: March 5, 2014
    chronosoul, lokiCML, wondible and 6 others like this.
  13. midspark

    midspark Member

    Messages:
    66
    Likes Received:
    47
    Is the red targeting range created by a weapon set by the max distance of the weapon or the algorithm?
  14. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    The drawn range is just the single max range number set by the designer. The TLDR of my previous post would be it's way too slow to calculate the true range.
  15. Dementiurge

    Dementiurge Post Master General

    Messages:
    1,094
    Likes Received:
    693
    Terrestrial radar has problems as well, as they display a greater range than is actually in effect, particularly on small planets. That's probably the fault of the 'capsule' shape? (What IS the capsule shape, anyway?)
  16. iakin

    iakin New Member

    Messages:
    3
    Likes Received:
    0

    Same happened for me the other week. This was a really small planet so the Holkins should have been able to fire on almost anything on the planet (the red circle disappeared around the horizon on all sides). Instead it decided to fire on nothing.
  17. puppeh

    puppeh Member

    Messages:
    42
    Likes Received:
    9
    Thanks for your original explanation, and I appreciate the problems involved in calculating the true range of units especially when numbers start ramping up. However, forgive me for my ignorance when I ask, for stationary objects is it not possible to do this calculation a single time upon placement, at least in order to set the range indicator?

    I have recorded an example of the Holkins and the difference in displayed and actual range on a small planet : http://www.twitch.tv/pupp3h/c/3854091

    If nothing else, would it be possible to have a different sound effect between an attack order within it's actual range compared to one outside of it?
  18. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    So apart from the radar layer problem (which I fixed for build 62443), the capsule issue can show up for radar range as well, and yes there is an issue with capsules on the client because of planet size.

    So the difference between a capsule and a sphere can be explained like this:
    A sphere is a distance from a point.
    [​IMG]
    A capsule is a distance from a line.
    [​IMG]

    Now this might sound odd but units on the client don't know how close they are to the ground. They could of course find out, but they don't generally need to know that information as the server does all that work for them. On the server recon ranges (sight, radar, etc) are all capsules that go from the ground to orbit, but as the client doesn't necessarily care where ground or orbit is, we approximate it by going from the unit location to the center of the planet.
    [​IMG]
    The server graphic isn't quite correct as it's not showing it going up to orbital, but I left it out to make the point more clear.
    There's a slight difference between the two on larger planets and smaller radii capsules, but most of the time it's negligible.

    However this means if the radar or vision range is about as big as the planet you're on it'll falsely show you having vision on the entire planet and not just half of it.
    [​IMG]
    Obviously this is something that needs to get fixed.
    huangth, SXX, chronosoul and 4 others like this.
  19. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    For stationary vs stationary, sure, that's plausible. For stationary vs everywhere in it's range it's still way too expensive. Worse is the time when people really want to see accurate ranges is when doing placing, and that means it still has to be fully dynamic and updated every frame.

    We don't know for sure what we'll do, but I definitely want better player feedback for lots of these kinds of things. Right now mouse clicks always show the same "click" effect (colored by mouse button) no matter what. I would like for it to show some visual feedback for what command was just issued and to what. Also some immediate feedback like the mouse cursor changing if you target a location that can't be hit as we could do checks for just the target under the cursor.
    SXX, Devak and puppeh like this.
  20. chronosoul

    chronosoul Well-Known Member

    Messages:
    941
    Likes Received:
    618
    Quite an excellent write up as always.

    I think you and Varrak should start a blog with all the tid bits of knowledge you guys drop on a weekly basis. It's appreciated.

Share This Page