TheSil / base_enhanced

sil's base_enhanced server mod
3 stars 4 forks source link

Value of FRAMETIME is not accurate and leads to inccorect behaviour #120

Open TheSil opened 9 years ago

TheSil commented 9 years ago

Currently FRAMETIME is constant defined as 100 (ms). This would make sense if server would only run on 10 Hz, but since this is driven dynamically, this value does not yield correct results.

Little ugly but working solution would be to change all occurences of

 level.time + FRAMETIME

to something like

 level.time + 1

or

 level.time

This would ensure it will be evaluated on next frame. Last one is a little tricky in case there are some hidden recursions that would lead to running multiple times (or maybe infinitely many times) during single frame, the +1 should work alright though.

EDIT: Eventually i have chosen to add level.frameTime variable which is set to sv_fps/1000, and referencing code to it.

TheSil commented 9 years ago

Now looking at it, it is actually used for frametime as supposed to be, so +1/+0 wont do the trick. I think best will be to add something like level.frameTime that will hold the actual frameTime value. I only wonder what effects it will have overall...

TheSil commented 9 years ago

Added in 17ddd723c2bbc for test. It seems to be working alright so far.

TheSil commented 9 years ago

This one d7e0193e4b is also related, it seems they wanted to do something on 1/2 frame period which does not really make sense, and caused an issue when frameTime refers to actual frame time...

deathsythe47 commented 9 years ago

Would it be possible to get the basejka knockback/launch effects, with all the other benefits of frametime?

TheSil commented 9 years ago

And what exactly this is? I have tried rocket jumping for example and it seems to be working same way as in basejka.

deathsythe47 commented 9 years ago

If you roll over mines(common siege tactic) your launch trajectory is a lot bigger vertically and a lot smaller horizontally.

TheSil commented 9 years ago

Just placed mines on the ground and rolled over it and i am getting on average same velocities for both, frametime being fixed value and frametime being 100 ms. Also visualy i dont notice any difference.