genxium / delaynomore Goto Github PK
View Code? Open in Web Editor NEWA Multiplayer Platformer game demo on websocket with delayed-input Rollback Netcode inspired by GGPO
A Multiplayer Platformer game demo on websocket with delayed-input Rollback Netcode inspired by GGPO
On backend, as "Room.downsyncToAllPlayers -> downsyncToSinglePlayer" is always called when "Room.InputsBufferLock" is released (for good reason, i.e. allowing all-confirmed inputFrames to be marked/forced asap), it's possible that in certain cases "inputsBufferSnapshot with larger snapshotStFrameId" is sent BEFORE "inputsBufferSnapshot with smaller snapshotStFrameId" for a same player, e.g. "Room.OnBattleCmdReceived" called twice for different players resulting in two inputsBufferSnapshots with different snapshotStFrameIds but the later "Room.OnBattleCmdReceived" call invoked "downsyncToAllPlayers" earlier.
To prevent such pitfall, it's possible to put each "queueElement = (refRenderFrameId, unconfirmedMask, inputsBufferSnapshot)" into a FIFO queue "Room.downsyncBuffer" while "Room.InputsBufferLock" is still held but before any network I/O, then let "Room.downsyncToAllPlayers" consume it with network I/O.
On backend,
The backend dynamics can be calculated for 1 more renderFrame, i.e. nextDynamicsRenderFrame should be "ConvertToLastUsedRenderFrameId(lastAllConfirmedInputFrameId, inputDelayFrames) + 1" w.r.t. "lastAllConfirmedInputFrame"
When creating inputsBufferSnapshot, refRenderFrameId can just be "ConvertToLastUsedRenderFrameId(lastAllConfirmedInputFrameId, inputDelayFrames)" which is EXACTLY the last renderFrame our "lastAllConfirmedInputFrame" can apply on. There's no need to make an extra "-1".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.