Facepunch / sbox-issues

175 stars 12 forks source link

A way to disable lag compensation temporarily #3575

Closed Igrium closed 1 year ago

Igrium commented 1 year ago

For?

S&Box

What can't you do?

I'm writing weapon shooting code, and for reasons too complex to get into, I need to obtain the non-lag-compensated position of an entity in a lag-compensated context (server-side, of course).

How would you like it to work?

Kind of like with prediction, it would would be nice to have a way to turn off lag compensation temporarily like:

using ( LagCompensation.Off() ) 
{
    // Do random shit...
}

What have you tried?

The only other solution I can think of is to add a component to each entity that backs up its position each tick before we enter the lag-compensated context. This is bad for obvious reason.

I could also try saving the position of all the entities before entering the lag-compensated context, but this is also bad.

Additional context

No response

handsomematt commented 1 year ago

This is daft sorry, you would be rewinding everything back to its original position, then rewinding again and again...

Igrium commented 1 year ago

So what would you say is the best way to do this?

On Sat, Jul 8, 2023, 2:13 PM Matt Stevens @.***> wrote:

Closed #3575 https://github.com/sboxgame/issues/issues/3575 as not planned.

— Reply to this email directly, view it on GitHub https://github.com/sboxgame/issues/issues/3575#event-9765941555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFMZZDB5IRLKUHSCFNXPWLXPHEN5ANCNFSM6AAAAAA2DBFFOI . You are receiving this because you authored the thread.Message ID: @.***>

Weldify commented 1 year ago

I feel like this should get a second thought. Its useful for me because ive got a bunch of components that i simulate and most of them need lag compensation, so i turn it on, but one of them doesnt, so pausing compensation during it would make the most sense, because if i dont do that then ill have to go through and compensate everything separately but thats fuckin stupid.