I’ve made small FPS game without any kind of lag compensation and played with fake lag and results are… expectable, but sometimes confusing.
[75 ms (client + server = 150 ms); Loss 1%; variation ±5] - Pretty much playable, haven’t got fatal issues, I don’t even see any net corrections. There is a question: why I don’t have problems?
[150 ms; Loss 2%; variation ±30; order 5%; duplication 5%] - Everything what worse than this is extremely unplayable.
About game architecture.
1 simple player pawn - built-in untouched character.
1 gun with 2 type of projectiles, this one requires more explanations why is it so hardcore.
This gun is universal, it can switch between projectile types.
First type is simple bullet. It’s being fired using BulletSystem actor. Bullet is simple class (not an actor, not a UObject, it has no inheritance), so the only thing, that bind this Bullet with World is BulletSystem. So the first hardcore case is that I need 3 things to do:
->Resimulate bullet by lag. Also need to rewind characters by lag. BUT bullets are being simulated with fixed timestep and I must not use any other timestep values, or it will break bullet trajectory, what must be 100% same on all machines.
->Fire fake Bullets on client to compensate lag. I’am even don’t need to bind this bullet with one on server, so this is kinda easiest one.
->Deal with high RPM number, somewhere around 5000-6000 and shotguns with 50 Bullets per shot.
Second type is Explosive: Actor, sphere, physics are enabled, but that is not a problem. They are Actors spawned by client, so if in case of Bullets I will be able to launch fake Bullet which only a visibility, then what should I do with Actor? One hardcore moment:
->Launch somehow fake Explosive which and bind to real ones on server.
For make things worse there is extreme conditions which literally nowhere else:
->When any projectile is being fired laws of physics are still working - from heavy projectile launched with great speed player will fly away in opposite direction as well.
->Bullet can push other players using same laws of physics.
->BAD ONE: Bullets can ricochet or go through.
->Explosive can be explode on contact (instantly or with timer) or triggered manually, what needs to be also covered by lag compensation.
And The Grand Culmination: Any Bullet or Explosive parameter (damage, mass etc.) can be changed in-game at any time as well as Gun parameters (projectile velocity, projectile count, shot delay). Bullet can pretty much act as ray if velocity is very high or as heavy rock (I mean physical body, not music genre) if velocity is low.
Mainly I know how to compensate lag, I know these techniques for fixed guns and their projectiles, but I invented such incredible conditions for one man… Why I haven’t thought about insane difficulty of this idea when I only was on stage of developing gameplay rules.
How? Just how?