Collision Damage and How it's implementation could make Starmade Awesome

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    I was reading this thread (http://starmadedock.net/threads/its-hard-to-play-with-collision-damage-turned-on.2213/) and I noticed some bug complaints (nothing new there) but also some interesting ideas. They got me thinking about how EXACTLY collision damage currently works - and how it could make Starmade the best creative Voxel game EVER (well....almost...).

    So the way collision damage works right now (from what I have been told and what I've experimented with) is on a block-by-block basis - that is, it's not tied into the ship (or ships) as a whole. Now, this leads to some interesting and sometimes realistic results, but once you start pushing the envelope (faster, bigger, really small, really fast, etc) the system breaks down and in some cases causes extreme lag for the server.

    Say you're in a ship with 5000 mass (rather small). You get hit by this tiny, 4 block object (a core, power block, thruster, and a disintegrator). What happens in the current system is that both sides get completely wrecked, and depending on how fast you guys are traveling, he might get stuck inside your ship and deal tons of damage. Even bumping eachother at low speed causes bad things (no, not the disintegrator exploding - that's a given :eek:).

    Here's what I came up with to figure out collision damage:

    First, make collision damage based on the overall mass and speed of your ship. In other words, use the movement equations of modern physics to compute the Kinetic Energy of the collision dealt to each ship. This would be based on the smallest surface area, direction, and velocity of the two colliding surfaces, as well as their total mass.

    So, using the above example:

    m1 = 5000
    v1 = 0 (for example)
    SA(smallest) = 1 (1 unit because only one block is colliding)
    Angle of attack (AoA) = 90 degrees

    m2 = 0.4
    v2 = 140 m/s (it says km/h, but that's a little interesting to convert, so we'll just stick with m/s)

    This all means the larger ship (Ship 1) is hit by the smaller one (the Torpedo of Doom) at a right angle at the maximum server speed from the MushroomFleet Server.

    Current System:

    The Torpedo of Doom would essentially drill through Ship 1 until they either glitched out, or the Torpedo of Doom exited the superstructure. Minimal damage, really, unless the guy piloting the Torpedo is really, really lucky.

    Modern Physics:

    The Torpedo of Doom would cause a 'force' of m2*v2*sin(AoA) = 0.4*140*1 = 56 (this isn't a force, as in F=ma - it's really just a number).

    So, Ship 1 would have a velocity in the opposite direction of the impact of 56 / m1 + v1 * sin(AoA) = 0.0112 m/s. Essentially zero, in the world of Starmade. And since we have Newtonian drag, we really wouldn't go far in Ship 1. So the impact doesn't force us to go anywhere, so rotation is probably negligible, too. Especially if Ship 1 is controlled by someone with a brain.

    But we need the Kinetic energy lost to the momentum to calculate the applied energy. So, that is:
    (1/2*m1*v1^2 + 1/2*m2*v2^2) - 1/2 (m1+m2)V^2 = 3919.7 Energy Units. Big number, there. Looks like we have some penetration power.

    Where we could go from here:

    Give each block an appropriate resistance level to the applied energy. Keep in mind that larger objects cause less damage because their damage is spread out over the entire object under this system.

    So Systems would be built like paper (more vulnerable, ofc). Normal hull would be worse than hardened hull, and hardened hull would be the 'hardest' object in the game (well, there are alternatives, like a really expensive 'diamond' block, but that might make torpedo boats overpowered).

    Personally, I'd love it if collision damage didn't damage per se, but only had an effect if a block were destroyed. (This is for aesthetic reasons. I hate seeing my ship banged up, especially accidentally.)

    Overall result:

    There is a built-in threshold for collision damage to occur, meaning people can still bump and jostle without being super careful about their fragile ships.

    Ramming actually isn't very effective due to the spread out damage of larger surface areas. Torpedoes, however, are an entirely different story.

    In fact, you could BUILD a ramming ship with a massive one block stick on the end meant for spearing. :D

    What I'm really getting at here is that players could innovate beyond the current weapon system. Not only do you have to master the efficiency of the weapons, you have to figure out the best way to take out the most cubic area of your enemy. Missiles might do the trick, but Torpedoes of Doom might be a good alternative. Maybe a broadside of one block logical time bombs with a couple of disintegrators on the back side for when they lodge into the ship??

    With the addition of the 50% threshold in combat (50% of ship must be killed before Core is vulnerable), this might be a revolutionary change. Who knows, add in a few performance improvements, and we might have some long fleet battles on our hands :D

    --Ender
     
    • Like
    Reactions: NeonSturm

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    Problems:

    You need relative speed difference (delta-velocity) dv and distribute it to all collision points.
    When does a collision occur? in this 30 milliseconds or the next 30 ms calculation step? May be a bit randoom? :)

    How do you get the impact vector? You would need to know centre of mass, impact point and how much mass*velocity is behind the impact point (colliding with a wing, rotation)

    Your calculations seem a bit too easy (especially as centre of mass is not implemented jet)

    What I'm really getting at here is that players could innovate beyond the current weapon system. Not only do you have to master the efficiency of the weapons, you have to figure out the best way to take out the most cubic area of your enemy
    That is the point I really like.
    But should it be such a difference having a cannon and push a core?

    If you argue with "only single-ammo shot" how will it be balanced? Did you see my dis-integrator cannon thread? (http://starmadedock.net/threads/how-do-you-want-dis-integrators-to-be.2270/)
    I imagine it much worse with collision damage on. right now it is already so powerful that a 9x8y11z system can so easily drain 400% of shields on a 50 times larger (mass) death/doom-pyramid... (especially the new local version with 2 dis-integrators opposite from the core).
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    Problems:

    You need relative speed difference (delta-velocity) dv and distribute it to all collision points.
    When does a collision occur? in this 30 milliseconds or the next 30 ms calculation step? May be a bit randoom? :)

    How do you get the impact vector? You would need to know centre of mass, impact point and how much mass*velocity is behind the impact point (colliding with a wing, rotation)

    Your calculations seem a bit too easy (especially as centre of mass is not implemented jet)



    That is the point I really like.
    But should it be such a difference having a cannon and push a core?

    If you argue with "only single-ammo shot" how will it be balanced? Did you see my dis-integrator cannon thread? (http://starmadedock.net/threads/how-do-you-want-dis-integrators-to-be.2270/)
    I imagine it much worse with collision damage on. right now it is already so powerful that a 9x8y11z system can so easily drain 400% of shields on a 50 times larger (mass) death/doom-pyramid... (especially the new local version with 2 dis-integrators opposite from the core).
    Yikes. I believe I haven't read into disintegrators for a while now. I've just not seen a use for them until the new Logic + weapon systems came online.

    I am, of course, advocating for a balanced version of Disintegrators. Because they are so buggy, right now they are kinda sorta balanced. But if the bugs were fixed.....like I said. Yikes.

    I didn't even cover rotation here because CoM is not implemented yet. Personally, I think we should try it without CoM (so no spinning, just pushing) and see how that goes. Might even be less lag ;)

    A collision occurs when the two meshes intersect, I'm not sure what you mean by when it occurs - thought that would be more than obvious. impact vector is a simple one, if you can determine the direction of travel and angle of both craft in three dimensional space. I don't know the equations to compute the angles off the top of my head, but I know where to find them :) You don't need a CoM for that, just the Core location.
     
    Joined
    Jun 21, 2013
    Messages
    8
    Reaction score
    0
    • Legacy Citizen 2
    There is an option for collision damage in the setting's config
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    There is an option for collision damage in the setting's config
    Quite so. Soon it shall become default, or so I hear.

    What exactly were you speaking of? I feel a rabbit trail into a seamless void coming on.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    It is quite easy and cheap to calculate the CoM whenever you leave the build mode, but it is much more difficult to update for each block.

    But if you do this calculations with CoM and mass behind the impact point, you may get much more mass, leading to exploits like a 5000-mass ship with single free-floating blocks around it using it's own mass multiple times during a battle (think of "defensive" push-effects)

    -> I worry that a balance which counter-acts this would also lead to making it more difficult for a cost-efficient space-torpedo.

    . . . . . 2 . . . . . 3 . . . . .
    . . . . . x . . . . . x . . . . .
    1 . . . x x x . . . x x x . . . 4
    x x x x x x x x C x x x x x x x x
    . . . . x x x . . . x x x . . . .
    . . . . . x . . . . . x . . . . .
    . . . . . x . . . . . x . . . . .

    x = block
    1234 = impact point block.
    C = core
    . = space

    Lets assume that it would usually collide with just one of the front points 2+3 when it will hit a wedge after ramming into the other ship head on.
    The collision will then slow the ramming ship down and cause major damage at spot2.
    When it collides with the other of both points, it will deal and receive less damage due to lower speed.​

    Now the issue:
    At very high speeds (I'll take your 140 + overdrive bonus) your ship jumps with 280/30 = 9.33 m per tick, generating the illusion of constant movement to the human eye.
    It may happen that 1 does not touch the wedge (by about 1 metre) and in the next calculation tick #1, #2 and maybe #3 are inside the other ship - not only that, even more blocks behind these are inside the enemy ship.​

    And the second issue:
    I said you wanted to ram head-on.
    But you hit a wedge - now the high head-on damage feels wrong and not obvious to peoples not knowing the implementation of this.​


    I hope I could help you to understand how games work and why it is so difficult (sry that I have to make this so long)
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    It is quite easy and cheap to calculate the CoM whenever you leave the build mode, but it is much more difficult to update for each block.

    But if you do this calculations with CoM and mass behind the impact point, you may get much more mass, leading to exploits like a 5000-mass ship with single free-floating blocks around it using it's own mass multiple times during a battle (think of "defensive" push-effects)

    -> I worry that a balance which counter-acts this would also lead to making it more difficult for a cost-efficient space-torpedo.

    . . . . . 2 . . . . . 3 . . . . .
    . . . . . x . . . . . x . . . . .
    1 . . . x x x . . . x x x . . . 4
    x x x x x x x x C x x x x x x x x
    . . . . x x x . . . x x x . . . .
    . . . . . x . . . . . x . . . . .
    . . . . . x . . . . . x . . . . .

    x = block
    1234 = impact point block.
    C = core
    . = space

    Lets assume that it would usually collide with just one of the front points 2+3 when it will hit a wedge after ramming into the other ship head on.
    The collision will then slow the ramming ship down and cause major damage at spot2.
    When it collides with the other of both points, it will deal and receive less damage due to lower speed.​

    Now the issue:
    At very high speeds (I'll take your 140 + overdrive bonus) your ship jumps with 280/30 = 9.33 m per tick, generating the illusion of constant movement to the human eye.
    It may happen that 1 does not touch the wedge (by about 1 metre) and in the next calculation tick #1, #2 and maybe #3 are inside the other ship - not only that, even more blocks behind these are inside the enemy ship.​

    And the second issue:
    I said you wanted to ram head-on.
    But you hit a wedge - now the high head-on damage feels wrong and not obvious to peoples not knowing the implementation of this.​


    I hope I could help you to understand how games work and why it is so difficult (sry that I have to make this so long)
    Not sure that it could be longer than the OP :D

    In that regard, I think it would be an issue for all collisions, period, no matter what math system we use for governing behaviour post-collision. I'm not sure how the game calculates on a tick-by-tick basis, but if what you say is true, then it would need to be sped up, which could lead to more lag.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    You could try to do it like "further inside = more % of the overall-force on this spot" (that is how I would do it) but then you need code to detect how far you are inside this ship.
    I am not sure if the calculations are lag-free.
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    You could try to do it like "further inside = more % of the overall-force on this spot" (that is how I would do it) but then you need code to detect how far you are inside this ship.
    I am not sure if the calculations are lag-free.
    I highly doubt they are, since the collision boxes would suddenly be inside one another.

    A check to see how far two objects have penetrated each other sounds like a good idea, though I still maintain that speeding up the tick speed would drastically improve the overall feel of the thing.
     

    Mariux

    Kittenator
    Joined
    Jun 20, 2013
    Messages
    1,822
    Reaction score
    658
    • Purchased!
    • Community Content - Silver 1
    • Legacy Citizen 8
    This is interesting, but I think that it should first have to take down shields and only then hull just to avoid noob cubes making holes in your ships (even when the ramming ship is smaller then the one being rammed it could still leave some nasty scratches)
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    I highly doubt they are, since the collision boxes would suddenly be inside one another.

    A check to see how far two objects have penetrated each other sounds like a good idea, though I still maintain that speeding up the tick speed would drastically improve the overall feel of the thing.
    I guess you can't imagine the nature of this limit? :eek:;)

    Every 33 milliseconds (30 times a second), a tick is created by Schema's holy code.
    This tick's highest desire is to generate a picture of all these 0s and 1s so that we can see what we have done.

    Each schema-sent tick all ships rotate, accelerate/decelerate, move a few metres (or cm) and finally check if their boundary box collides with any other ship (which will trigger a block-perimeter vs block-perimeter check)

    Do you think you can get a computer (especially one running this in Java) faster? ((Java is not Assembler or C++. it is made for portability not performance.))


    The only thing that would work faster are statistical checks. (not: does a collision occur right now, but when will a collision occur if objects keep their inertia and rotation...)
    But I think StarMade does not use statistical formulas here.
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    I guess you can't imagine the nature of this limit? :eek:;)

    Every 33 milliseconds (30 times a second), a tick is created by Schema's holy code.
    This tick's highest desire is to generate a picture of all these 0s and 1s so that we can see what we have done.

    Each schema-sent tick all ships rotate, accelerate/decelerate, move a few metres (or cm) and finally check if their boundary box collides with any other ship (which will trigger a block-perimeter vs block-perimeter check)

    Do you think you can get a computer (especially one running this in Java) faster? ((Java is not Assembler or C++. it is made for portability not performance.))


    The only thing that would work faster are statistical checks. (not: does a collision occur right now, but when will a collision occur if objects keep their inertia and rotation...)
    But I think StarMade does not use statistical formulas here.
    I understand how it works - it's frame by frame, or in this case, server frames. So it is kinda....unavoidable, I guess. Unless we migrated to C++....:D
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    This is interesting, but I think that it should first have to take down shields and only then hull just to avoid noob cubes making holes in your ships (even when the ramming ship is smaller then the one being rammed it could still leave some nasty scratches)
    Of course shields would still be taken into account, and the energy calculations would be factored into the shield somehow (probably a multiplier in the Server config). I wouldn't have it any other way. :P
     

    MossyStone48

    Cmdr Deathmark
    Joined
    May 29, 2013
    Messages
    1,255
    Reaction score
    432
    Try to avoid double posting. If someone hasn't responded just edit your previous post please. :3
     
    Joined
    Jun 19, 2014
    Messages
    1,756
    Reaction score
    162
    • Purchased!
    • Top Forum Contributor
    • Legacy Citizen
    Shields can't and never will stop collision damage. It's an energy field designed to stop weapons, not a kazilion ton planet from destroying your ship upon impact.
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    Shields can't and never will stop collision damage. It's an energy field designed to stop weapons, not a kazilion ton planet from destroying your ship upon impact.
    Normally I would agree, but for a system designed around making this a viable weapon (in the form of torpedoes and the like), Shields may have to be taken into account to keep it balanced.
     
    Joined
    Jun 19, 2014
    Messages
    1,756
    Reaction score
    162
    • Purchased!
    • Top Forum Contributor
    • Legacy Citizen
    Only with disintegrators, they're not heavy, just a big explosion of energy. Having collision damage always go via the shields just seams a waste of the lovely collision system.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    I like dis-integrators bypass shields (to make them more unique).
    -> peoples will complain about cloaked dis-integrator ships blowing holes into them for fun.
    -> -> will go vs shields again.
    -> -> -> peoples cloak/fire so many of them that they either drain the shields completely and damage the hull badly (like now) or they will be completely useless.


    I don't like either (collision, dis-integration) to be blocked by shields, but there should be another way to defend against these strategies.

    deflector shields could be a distance-enforcing effect pushing nearby ships of different factions away from each other.
    If y is your smallest axis, it tries to increase the vertical angle.
    With x it tries to increase the horizontal angle.
    While moving sidewards compare y and z instead of y and x.​

    You can already build deflector shields with long (pulse master + amc slave) weapon module spikes in a vertical line in front of your ship.
    But an extra mechanic would have less lag before the effect applies, require less repairs if the spike tip collides with something fast and causes probably less lag too.​