远程对手按照录像流长度进行更快速的追帧,解决本地卡顿导致看到对手也会卡顿的问题
This commit is contained in:
@@ -397,14 +397,16 @@ function update.dead(P,dt)
|
||||
updateTasks(P)
|
||||
end
|
||||
function update.remote_alive(P,dt)
|
||||
local frmDelta=PLAYERS[1].frameRun-P.frameRun
|
||||
for _=1,
|
||||
frmDelta<20 and 1 or
|
||||
frmDelta<45 and rnd(2)or
|
||||
frmDelta<90 and 2 or
|
||||
frmDelta<180 and rnd(2,3)or
|
||||
3
|
||||
do
|
||||
local frameRate=(P.stream[#P.stream-1]or 0)-P.frameRun
|
||||
frameRate=frameRate<20 and 1 or
|
||||
frameRate<30 and rnd(2)or
|
||||
frameRate<60 and 2 or
|
||||
frameRate<90 and 3 or
|
||||
frameRate<120 and 5 or
|
||||
frameRate<150 and 7 or
|
||||
frameRate<180 and 10 or
|
||||
20
|
||||
for _=1,frameRate do
|
||||
local eventTime=P.stream[P.streamProgress]
|
||||
if eventTime then--Normal state, event forward
|
||||
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
|
||||
P.streamProgress=P.streamProgress+2
|
||||
else--No event now, run one frame
|
||||
update.alive(P,dt)
|
||||
update.alive(P,dt/frameRate)
|
||||
end
|
||||
else--Pause state, no actions, quit loop
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user