Empyrion - Galactic Survival

Empyrion - Galactic Survival

Gone Apr 5, 2019 @ 6:58am
Fix Lag Shots
Change how hits are calculated so this doesn't happen.

I think (as a programmer) a good idea would be to change it so that instead of making projectiles just be moving colliders, you can calculate hits based on a ray trace from the firing location of the projectile. If a projectile hits any block on a ship, it should do damage to the block the ray trace hits first. So even if a projectile "lags" and skips the outside armor, it will still only damage the outside armor.
< >
Showing 1-15 of 16 comments
Tarc Novar Apr 5, 2019 @ 7:28am 
Originally posted by Lord Tellrog of Tellrog Castle:
Change how hits are calculated so this doesn't happen.

I think (as a programmer) a good idea would be to change it so that instead of making projectiles just be moving colliders, you can calculate hits based on a ray trace from the firing location of the projectile. If a projectile hits any block on a ship, it should do damage to the block the ray trace hits first. So even if a projectile "lags" and skips the outside armor, it will still only damage the outside armor.

If I may, how do you know EGS works like this? Where did you get this information?
VulcanTourist (Banned) Apr 5, 2019 @ 8:15am 
Granted I've never even once played the game with other players, but I'm not convinced that these "lag shots" even exist as a distinct issue caused by what is claimed. The way explosive damage is calculated and applied in this game is quite simplistic. I've experienced "lag shot" consequences in solo gameplay, caused by explosive damage from a laser or plasma drone that destroyed internal device blocks without even breaching the hull. This was possible because the game simplistically applied the blast damage to ALL blocks in its defined radius of effect regardless whether those blocks were even yet exposed to it; the result was that the external combat steel block(s), having high hitpoints, survived the damage, while the more fragile device blocks behind that combat steel did not; the first internal device that was destroyed itself exploded and caused a cascade of self-explosions that took out multiple critical systems... all without ever breaching the exterior hull.

You want to fix "lag shots"? Reduce the BlastRadius property for weapons to a value of 1 (or 0?). Whether you also choose to do the same to the self-destructive BlastRadius properties of all the devices is another matter.
Last edited by VulcanTourist; Apr 5, 2019 @ 8:19am
DarkFire Apr 5, 2019 @ 8:29am 
Originally posted by VulcanTourist:
Granted I've never even once played the game with other players, but I'm not convinced that these "lag shots" even exist as a distinct issue caused by what is claimed. The way explosive damage is calculated and applied in this game is quite simplistic. I've experienced "lag shot" consequences in solo gameplay, caused by explosive damage from a laser or plasma drone that destroyed internal device blocks without even breaching the hull. This was possible because the game simplistically applied the blast damage to ALL blocks in its defined radius of effect regardless whether those blocks were even yet exposed to it; the result was that the external combat steel block(s), having high hitpoints, survived the damage, while the more fragile device blocks behind that combat steel did not; the first internal device that was destroyed itself exploded and caused a cascade of self-explosions that took out multiple critical systems... all without ever breaching the exterior hull.

If you've never played the game on an external server then you will never have experienced the problem. It certainly does exist and functions as Lord Tellrog described. It occurs when the tick rate of a server is insufficient to correctly calculate the impact of a tracked projectile with a target. If the tick rate is sufficiently high then the server will correctly calculate the place of interaction of the projectile with the target as being on the outside hull of a vehicle. If the server tick rate is too low then the first calculated interaction of the projectile with a vehicle can happen not on the hull but when the projectile has actually moved inside the vehicle. Ergo, damage is caused to internal things rather than the outside hull.

Overly simplistic modelling of explosive damage is an entirely separate problem.
Last edited by DarkFire; Apr 5, 2019 @ 8:32am
VulcanTourist (Banned) Apr 5, 2019 @ 8:40am 
The way to disprove my skepticism is to nerf all the weapon BlastRadius properties on a server and see what happens: if damage continues to skip blocks, then there's more to it than the simplistic application of radius damage. Has that ever been done?
Gone Apr 5, 2019 @ 8:41am 
The problem is that the server doesn't do collision checks enough, and it detects the hit long after the projectile has passed through the armor, causing it to skip it and hit internal blocks. There also seems to be code that causes it to automatically trigger a hit when it hits the targeted block (core, weapon, etc), meaning even if the server is too slow to catch it hitting armor, it will always detect when it hits its final target.

Maybe ray trace outward the reverse direction and do damage to the last block hit. Increasing tick rate is not the only way to fix this.
Last edited by Gone; Apr 5, 2019 @ 8:45am
DarkFire Apr 5, 2019 @ 11:05am 
Originally posted by Lord Tellrog of Tellrog Castle:
The problem is that the server doesn't do collision checks enough, and it detects the hit long after the projectile has passed through the armor, causing it to skip it and hit internal blocks. There also seems to be code that causes it to automatically trigger a hit when it hits the targeted block (core, weapon, etc), meaning even if the server is too slow to catch it hitting armor, it will always detect when it hits its final target.

Maybe ray trace outward the reverse direction and do damage to the last block hit. Increasing tick rate is not the only way to fix this.

Agreed. Raytracing would be an interesting way to solve the problem. I think it would have to be predictive to some extent though to stop all weapons from being simply hitscan.
VulcanTourist (Banned) Apr 5, 2019 @ 12:40pm 
Originally posted by VulcanTourist:
Has that ever been done?
I asked a question. If the answer is no, then you're all just guessing.
Tarc Novar Apr 5, 2019 @ 1:14pm 
Originally posted by VulcanTourist:
The way to disprove my skepticism is to nerf all the weapon BlastRadius properties on a server and see what happens: if damage continues to skip blocks, then there's more to it than the simplistic application of radius damage. Has that ever been done?

I would have to modify and test on a server. I might be able to get to it this weekend.
Last edited by Tarc Novar; Apr 5, 2019 @ 1:14pm
VulcanTourist (Banned) Apr 5, 2019 @ 1:21pm 
Originally posted by Tarc Novar:
Originally posted by VulcanTourist:
The way to disprove my skepticism is to nerf all the weapon BlastRadius properties on a server and see what happens: if damage continues to skip blocks, then there's more to it than the simplistic application of radius damage. Has that ever been done?
I would have to modify and test on a server. I might be able to get to it this weekend.
I gather from past discussion that you'll know exactly what to do? I've already done it for the alien turrets because I wanted to confirm the result in solo play.
Tarc Novar Apr 5, 2019 @ 1:43pm 
Originally posted by VulcanTourist:
Originally posted by Tarc Novar:
I would have to modify and test on a server. I might be able to get to it this weekend.
I gather from past discussion that you'll know exactly what to do? I've already done it for the alien turrets because I wanted to confirm the result in solo play.

I believe so. Right now I have something of a headache, so I will revisit this when I am of clearer mind.
DarkFire Apr 5, 2019 @ 3:19pm 
Originally posted by VulcanTourist:
Originally posted by VulcanTourist:
Has that ever been done?
I asked a question. If the answer is no, then you're all just guessing.

Yes, you asked a question. I felt no requirement to provide an instant answer. Bluntly, rather than wondering if lag shots were a phenomenon that you'd never seen, having admitted to never having played Empyrion in multiplayer, and possibly researching the subject, you instantly assumed that your explanation was the only possible correct one. Lord Tellrog and I both described the phenomenon of lag shot, and what causes it. This is not guesswork or idle speculation - lag shooting has been a problem for games for a quarter of a century. 10 seconds spent conducting a google search would have proven the point. Your skepticism is irrelevant.

For what it may be worth the only time I've ever experienced being lag shot in EGS was while facing cannon and minigun turrets, never weapons that do volume damage such as plasma or missile weapons. I've physically seen minigun rounds impacting blocks *inside* my ship, completely ignoring the hull as if it was transparent. Once again, just to make it crystal clear - lag shot is a known phenomenon in games such as EGS. It has a known cause but many potential solutions, one of which Lord Tellrog described.
Last edited by DarkFire; Apr 5, 2019 @ 3:20pm
Xango2000 Apr 5, 2019 @ 3:53pm 
If I understand the problem correctly, lag shots are caused by the projectile traveling at such a speed that the packet containing the data for the "frame" where the projectile comes into contact with the plane of the targeted block gets dropped.

So, the simplest solution would be to slow down the projectiles so that there are more Frames where the projectile intersects the plane of the targeted block.

Then as a real fix, do that Ray tracing thing... I have no knowledge of Ray tracing, sounds legit though.
Gone Apr 5, 2019 @ 5:31pm 
Ray tracing involves creating an invisible line from one point going forward a distance (a Vector3 in the engine Empyrion uses). If the point intersects a collision box, you can do things with it. As an example, it is used in Minecraft when you mine to see what is in front of you.

Did some testing on a locally hosted server and I came to some conclusions. Note that this is kinda a technical explanation, but I've tried to make it easy for people with no knowledge of this to figure out what I'm talking about.

For bullet weapons, a "hitscan" system is often used in many games for projectile weapons. Hitscan weapons hit their target the instant they shoot, as they have no projectile and are calculated only with ray-tracing. All the calculation is done instantly when the gun fires, as an invisible line shot from gun forward for gun's shooting range. The first thing this line hits is what the bullet hits. If it hits nothing, than the bullet hits nothing. This is not 100% realistic, and simulation games like Arma opt out of this system (due to no bullet drop and speed), but it is very fast and usually is good enough for a game not too hellbent on realism.

The second most common system uses "projectiles", which treats each projectile fired from a weapon as an individual object with its own collision box. When the collision box of the projectile hits the collision box of something else, the game treats this as a hit. This is the only system that Empyrion uses.

A raytracing system like this could be used for bullet weapons in Empyrion to fix lag shots with those, though it seems it is not used at the moment for any of Empyrion's weapons as far as I can tell. Even pistols have tiny projectiles with micro collision boxes and use a projectile system, which I think is kindof silly, especially since there is no bullet drop anyways, so whats the point even?


The "lagshot" problem is caused because when the server does a projectile update every projectile moves forward by its move distance for that update. This means that projectiles "jump" between each update. As a player, this jump isn't visible because of interpolation. Most of the faster moving projectiles seem to go further per update than a block size, especially for SV's. This can cause projectile to skip blocks and end up hitting further inside a ship by the time the update occurs. Also, Empyrion servers can have lag spikes. Even a very short lag spike can cause a projectile to pass through the entirety of a ship and hit its target block (usually the core). When the server lags and it takes longer for an update to occur, the server will automatically compensate for this by moving the projectile forward further that update. It appears that once a projectile gets far enough to hit its target block, it automatically hits it no matter the update speed. Only turret weapons will stop at the target block, and since mounted guns have no target block, it seems they can go even further and even pass through an entire ship if a lag spike is long enough or the ship is thin enough.

Obvious solution in my opinion, would be to move all of the bullet weapons over to a hitscan system. For the projectile weapons, remove the colliders on the projectiles. I think a good idea would be to raytrace backwards from each projectile each update for the distance it traveled in that frame. Register hits on the furthest back location on the raytrace. Of course, moving ships might mess this up a bit. This is only a simple solution, and I'm sure a more complex one is needed. However, this would be much better than the current system, and would even be faster for the server to calculate the hitscan weapons.
Last edited by Gone; Apr 5, 2019 @ 6:02pm
DarkFire Apr 6, 2019 @ 8:21am 
Reverse raytracing would be a nice solution. Done server side authoritatively, as it would have to be done, would also probably account for client side lag.
Obsidiac Apr 6, 2019 @ 9:46am 
Since the game knows the bounds of the structure that was struck, reverse raytracing to the structure's bounds makes a lot of sense.
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Apr 5, 2019 @ 6:58am
Posts: 16