远程对手按照录像流长度进行更快速的追帧,解决本地卡顿导致看到对手也会卡顿的问题

This commit is contained in:
MrZ626
2021-05-09 22:30:59 +08:00
parent 16e7dd71f1
commit cba9464b6f

View File

@@ -397,14 +397,16 @@ function update.dead(P,dt)
updateTasks(P) updateTasks(P)
end end
function update.remote_alive(P,dt) function update.remote_alive(P,dt)
local frmDelta=PLAYERS[1].frameRun-P.frameRun local frameRate=(P.stream[#P.stream-1]or 0)-P.frameRun
for _=1, frameRate=frameRate<20 and 1 or
frmDelta<20 and 1 or frameRate<30 and rnd(2)or
frmDelta<45 and rnd(2)or frameRate<60 and 2 or
frmDelta<90 and 2 or frameRate<90 and 3 or
frmDelta<180 and rnd(2,3)or frameRate<120 and 5 or
3 frameRate<150 and 7 or
do frameRate<180 and 10 or
20
for _=1,frameRate do
local eventTime=P.stream[P.streamProgress] local eventTime=P.stream[P.streamProgress]
if eventTime then--Normal state, event forward if eventTime then--Normal state, event forward
if P.frameRun==eventTime then--Event time, execute action, read next so don't update immediately if P.frameRun==eventTime then--Event time, execute action, read next so don't update immediately
@@ -444,7 +446,7 @@ function update.remote_alive(P,dt)
end end
P.streamProgress=P.streamProgress+2 P.streamProgress=P.streamProgress+2
else--No event now, run one frame else--No event now, run one frame
update.alive(P,dt) update.alive(P,dt/frameRate)
end end
else--Pause state, no actions, quit loop else--Pause state, no actions, quit loop
break break