How can we clean up collision mechanics?

    Joined
    Jul 30, 2017
    Messages
    192
    Reaction score
    203
    Entity collisions are the bane of all servers and the most horrifying eldritch wickedness that threatens our existence. What can we do to optimize collision mechanics to reduce lag?

    One thought is to limit turrets, or moving docked entities in general, from attempting to move into space occupied by a block on the same docking tree. This should be far less computationally intensive than dealing with the actual collision and associated mess and would need to be calculated much less often.

    Secondly, a tiered collision check depending on relative speed might be helpful, so collisions at higher speed could use a simplified entity hitbox instead of needing to check to position of every block relative to one another.
     
    Joined
    Feb 21, 2015
    Messages
    228
    Reaction score
    145
    Good thoughts Coyote27 - sometime-back somewhere similar ideas we thrown around.

    Something previously mentioned was making checks for potential turret rotation at build or other times of low CPU-cycle, creating bounding boxes or similar, to limit calculation in combat.

    I like the idea about relative speed of separate entities and fine vs coarse grained collision boxes > i think it would be much better to have fast moving objects sometimes bounce of an apparently invisible 'wall' a bit distant from the actual hull, rather than clip into each other as they do currently.

    (that changes for example those clever little warhead-logic-trigger torpedo drones, as they wont clip the warhead several blocks into the enemy hull ...sigh, but probably for the best really in the long-run)
     
    • Like
    Reactions: Macharius

    Non

    Joined
    Nov 17, 2013
    Messages
    296
    Reaction score
    157
    How about we just don't have collisions?

    Make it so that nothing is able to physically interact with anything else.
     
    Joined
    Oct 8, 2014
    Messages
    138
    Reaction score
    220
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 9
    Make it such that (or at least give servers config options to do so)
    • Ships do not collide with ships. They just pass through them. I'm serious. Why do we even need ship collisions? Almost ANY ship-ship collision is by mistake and unwanted.
    • But then this would mean small ships can "hide" in larger ships! Simple suggestion: make weapons pass through ships and stations of the same faction. Permanently. This was a headache already. This would mean heat seeking missiles would be able to take out small enemy ships "lurking" inside your titan.
    • Ships will dock to ships and stations in the same way- that is, docking will be denied if blocks overlap. Ships (and turrets because they basically are ships) will have collision damage with the entity they are docked to. Only as long as they are docked. Basically, the system still knows where things are, when stuff is overlapping, so area trigger control blocks and docking is fine.
    • Astronauts will have collisions with everything always. So will stations and planets.
    • **Warhead missiles will still be a thing - just place trigger area control blocks around it.
    • **Shops are stations in case somebody is wondering.
    • **BONUS: No longer will other players be able to ram into your partially built - shell. I've got rammed out of many protected sectors on multiple servers. Sad memories.
    Basically, this will remove 90% of the collision lag and will not affect any other aspect of play afaik

    If you think exploits are possible, you've not read this post thoroughly enough.
     
    Last edited:
    Joined
    Feb 21, 2015
    Messages
    228
    Reaction score
    145
    'No collisions' settings as outlined would be good for servers and some universes.

    However fundamentally I personally would like to see physics-type reactions between entities in the core game - who doesn't want to bop away a few newbie ships with, eg a giant space ramming-whale, once in a while ? :)
     
    Last edited:

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    An entity could reserve space on the parent entity for where it can be.
    And where it cannot reserve space, that turn angle is blocked.

    This could even be calculated once and forever whenever you exit build mode, but you run into issues on complex setups.
    2 trains which use the same rail system, 3 rotators in a chain.

    Can these issues be resolved?
    I think partially. The 3rd-level barrel would reserve space on the 2nd-level barrel which uses this space as it's own when reserving space on the turret base.

    But this would be inaccurate against other entities.
    For this, we could expand spheres for a simple jet not accurate detection.


    I think the collision inaccuracy could scale with frequency which scales proportionally to speed.
    [doublepost=1511625478,1511624998][/doublepost]
    Make it such that (or at least give servers config options to do so)
    1. Ships do not collide with ships and stations. They just pass through them. I'm serious. Why do we even need ship collisions? Almost ANY ship-ship collision is by mistake. Ship-station collision s, I'm not really sure on though.
    2. Ships will dock to ships and stations in the same way- that is, docking will be denied if blocks overlap. Basically, the system still knows where things are, when stuff is overlapping, so area trigger control blocks and docking is fine.
    3. Astronauts will have collisions with everything always.
    4. Ships will collide with planets though.
    5. Warhead missiles will still be a thing-just place trigger area control blocks around it.
    6. **Shops are stations in case somebody is wondering.
    Basically, this will remove 90% of the collision lag and will not affect any other aspect of play.

    If you think exploits are possible, you've not read this post thoroughly enough.
    1. I agree with ships not colliding with ships. But there should be a way of preventing ships from going into a certain area.
    4. Ships could collide with orbits when they are too big (depending on server config).
    5. Delayed trigger :D But it does only work on the entity where they are on and the entity triggering it by touch :/
     
    Joined
    Feb 21, 2015
    Messages
    228
    Reaction score
    145
    maybe 'collision inaccuracy could scale with frequency and docking level, which scales proportionally to speed' ?
     

    jayman38

    Precentor-Primus, pro-tempore
    Joined
    Jul 13, 2014
    Messages
    2,518
    Reaction score
    787
    • Purchased!
    • Thinking Positive
    • Legacy Citizen 4
    If I understand how a voxel game works, then ships end up with model "hulls", based on the non-covered surfaces of all included blocks.

    If the physics hulls were scaled down slightly (E.g. ~0.01%) from the visual hulls, then the problem of collisions due to floating-point math inaccuracy would be almost completely eliminated. This would help solve a lot of problems with turrets not being able to move for no apparent reason. It would also give doors and other incidental rail entities some clearance for smooth movements.

    The downside is that the rail entities will move farther than they should. (Doors sliding too far, turrets pointing down slightly, clipping through the base of the turret at a shallow angle, that sort of thing.

    It would be nice if the scale-down could be "slimmer", but we're dealing with Java's signed 32-bit math here, which means lots of floating point inaccuracy as well as limited multipliers.
     
    • Like
    Reactions: rocketman221