Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Spontaneous Existence Failure

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Solonar
Deadly
Deadly
Posts: 174
Joined: Sun Dec 04, 2011 4:04 am
Location: Galaxy 2 - Space Truckin

Spontaneous Existence Failure

Post by Solonar »

Spontaneous existence failure, massive damage from a custom shield spark.

This is involving oolite-trunk-1.79.0.10a5886-dev.x86 on Windows 7 64 bit while using OXP Custom Shields version 0.83.

Code: Select all

22:42:58.637 [LogEvents]: Player targeted Escape Capsule 26309 who has 25 energy
22:43:04.197 [Telescope]: Delta Long-Range Escort 88km 14° <v
22:43:04.251 [Telescope]: filteredEntities: 1, 11, 6, 54 list:54 allShips:248
22:43:05.774 [LogEvents]: Player collided with Metal fragment 12876
22:43:05.802 [LogEvents]: Player collided with customshieldssparksblownpanels 11218
22:43:05.803 [LogEvents]: Player killed customshieldssparks 10534 with scrape damage
22:43:05.803 [LogEvents]: Player collided with customshieldssparks 10534
22:43:05.804 [LogEvents]: Player collided with customshieldsshieldflasherflareupJ1 23055
22:43:05.890 [LogEvents]: Player collided with customshieldssparks 23243
22:43:05.891 [LogEvents]: Player killed customshieldssparks 21780 with scrape damage
22:43:05.892 [LogEvents]: Player collided with customshieldssparks 21780
22:43:05.892 [LogEvents]: Player killed customshieldssparks 8358 with scrape damage
22:43:05.912 [LogEvents]: Player taking 58097 scrape damage from customshieldssparks 8358 384+0 shield and -57572 energy left
22:43:05.914 [LogEvents]: Player got scrape damage from customshieldssparks 8358 and died!
Image

SolarTech proudly presents the Plasma Turret Regulator Device Apparatus, aka the Turret Toggler
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Spontaneous Existence Failure

Post by cim »

The sparks are very small objects, but they still exist as a (near-point) mass. That means that they can collide with things.

Damage is proportional to mass, so to do that much damage because it's so light the spark would have to have been travelling at around 1 million metres/second. That's fast, but because it's so light, it could be accelerated to that speed relatively easily, if it was very near the centre of an explosion.

So some order of events like this within the calculations for one frame
- player has sparks 21780 and 8358 both within collision radius, and both sparks are very very close to each other.
- Collision is processed first for 21780, which does no damage to the player (the sparks are moving at speeds way below that needed to cause damage) but destroys the spark (because the player ship is heavy enough to deal collision damage to it), creating an explosion.
- This transfers a trivial amount of momentum to very nearby objects, but the momentum transfer is increased in an inverse-square relationship to the distance between the objects, so if the two sparks had basically identical positions, this could transfer an incredibly large amount of momentum.
- 8358 is now travelling at ridiculous speeds, but we're still going through the collision checks, so it hasn't actually been moved yet.
- Now we process the collision between 8358 and the player, note that 8358 is travelling at relativistic velocities, and deal huge kinetic damage to the player ship.

Momentum transfer from explosions should probably be capped to avoid this, though if the OXP had been written for 1.77 rather than 1.76 it could use visual effects (which don't collide) for the shield sparks.

This probably isn't anything specific to it being a nightly build: that code hasn't changed for a long time, and it could have happened even in 1.76. The precise sequence of events needed should be rare, though.
Post Reply