Compare commits

..

4 Commits

Author SHA1 Message Date
58a432eb3c Merge pull request 'master' (#52) from Alienjack/AxibugEmuOnline:master into master
Reviewed-on: #52
2024-11-12 16:51:31 +08:00
ALIENJACK\alien
4afcc2f1f1 添加动态追帧机制 2024-11-12 14:55:45 +08:00
ALIENJACK\alien
46a404f40b Merge branch 'master' of http://git.axibug.com/sin365/AxibugEmuOnline 2024-11-12 14:49:39 +08:00
ALIENJACK\alien
bddb84c57d 微调追帧策略 2024-11-12 14:47:57 +08:00
3 changed files with 22 additions and 11 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
namespace AxiReplay namespace AxiReplay
{ {
@ -104,6 +105,23 @@ namespace AxiReplay
data = mCurrReplay; data = mCurrReplay;
return result; return result;
} }
public int GetSkipFrameCount()
{
var frameGap = mDiffFrameCount;
if (frameGap > 10000) return 0;
int skip = 0;
if (frameGap <= 2) skip = 0;
if (frameGap > 2 && frameGap < 6) skip = 1 + 1;
else if (frameGap > 7 && frameGap < 12) skip = 2 + 1;
else if (frameGap > 13 && frameGap < 20) skip = 3 + 1;
else skip = frameGap - 2;
return skip;
}
} }
} }

View File

@ -119,7 +119,7 @@ namespace AxibugEmuOnline.Client
LastTestInput = rawData; LastTestInput = rawData;
App.log.Debug($"{DateTime.Now.ToString("hh:mm:ss.fff")} Input F:{App.roomMgr.netReplay.mCurrClientFrameIdx} | I:{rawData}"); App.log.Debug($"{DateTime.Now.ToString("hh:mm:ss.fff")} Input F:{App.roomMgr.netReplay.mCurrClientFrameIdx} | I:{rawData}");
} }
App.roomMgr.SendRoomSingelPlayerInput((uint)App.roomMgr.netReplay.mCurrClientFrameIdx, rawData); App.roomMgr.SendRoomSingelPlayerInput(frameIndex, rawData);
} }
else else
{ {

View File

@ -68,14 +68,7 @@ namespace AxibugEmuOnline.Client
private void FixEmulatorFrame() private void FixEmulatorFrame()
{ {
int skipFrameCount = 0; var skipFrameCount = App.roomMgr.netReplay.GetSkipFrameCount();
var frameGap = App.roomMgr.netReplay.mDiffFrameCount;
if (frameGap > 10000) return;
if (frameGap > 2 && frameGap < 6) skipFrameCount = 1;
else if (frameGap > 7 && frameGap < 12) skipFrameCount = 2;
else if (frameGap > 13 && frameGap < 20) skipFrameCount = 3;
else skipFrameCount = frameGap - 2;
if (skipFrameCount > 0) App.log.Debug($"SKIP FRAME : {skipFrameCount}"); if (skipFrameCount > 0) App.log.Debug($"SKIP FRAME : {skipFrameCount}");
for (int i = 0; i < skipFrameCount; i++) for (int i = 0; i < skipFrameCount; i++)