mirror of
https://github.com/genxium/DelayNoMore
synced 2025-10-18 13:06:29 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0373665382 | ||
|
3b0db64792 |
@@ -2,11 +2,11 @@
|
||||
|
||||
This project is a demo for a websocket-based rollback netcode inspired by [GGPO](https://github.com/pond3r/ggpo/blob/master/doc/README.md).
|
||||
|
||||
_(the following gif is sped up to ~1.5x for file size reduction, kindly note that around ~11s countdown, the attack animation is resumed from a partial progress)_
|
||||
_(the following gif is sped up to ~1.33x for file size reduction, kindly note that around ~8s countdown, the attack animation is resumed from a partial progress)_
|
||||
|
||||

|
||||

|
||||
|
||||
Please also checkout [this demo video](https://pan.baidu.com/s/1U1wb7KWyHorZElNWcS5HHA?pwd=30wh) to see how this demo carries out a full 60fps synchronization with the help of _batched input upsync/downsync_ for satisfying network I/O performance.
|
||||
Please also checkout [this demo video](https://pan.baidu.com/s/172AmIKxbFgGXZzWVqxNUPA?pwd=e2tp) to see how this demo carries out a full 60fps synchronization with the help of _batched input upsync/downsync_ for satisfying network I/O performance.
|
||||
|
||||
The video mainly shows the following features.
|
||||
- The backend receives inputs from frontend peers and broadcasts back for synchronization.
|
||||
|
@@ -26,7 +26,7 @@ func NewRingBuffer(n int32) *RingBuffer {
|
||||
}
|
||||
|
||||
func (rb *RingBuffer) Put(pItem interface{}) {
|
||||
for rb.Cnt >= rb.N-1 {
|
||||
for 0 < rb.Cnt && rb.Cnt >= rb.N {
|
||||
// Make room for the new element
|
||||
rb.Pop()
|
||||
}
|
||||
@@ -78,7 +78,7 @@ func (rb *RingBuffer) GetByOffset(offsetFromSt int32) interface{} {
|
||||
}
|
||||
|
||||
func (rb *RingBuffer) GetByFrameId(frameId int32) interface{} {
|
||||
if frameId >= rb.EdFrameId {
|
||||
if frameId >= rb.EdFrameId || frameId < rb.StFrameId {
|
||||
return nil
|
||||
}
|
||||
return rb.GetByOffset(frameId - rb.StFrameId)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.7 MiB |
BIN
charts/smooth_melee_attack_spedup.gif
Normal file
BIN
charts/smooth_melee_attack_spedup.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 MiB |
@@ -440,7 +440,7 @@
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
216.50635094610968,
|
||||
210.4441731196186,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@@ -13,7 +13,7 @@ var RingBuffer = function(capacity) {
|
||||
};
|
||||
|
||||
RingBuffer.prototype.put = function(item) {
|
||||
while (this.cnt >= this.n - 1) {
|
||||
while (0 < this.cnt && this.cnt >= this.n) {
|
||||
// Make room for the new element
|
||||
this.pop();
|
||||
}
|
||||
@@ -65,7 +65,7 @@ RingBuffer.prototype.getArrIdxByOffset = function(offsetFromSt) {
|
||||
};
|
||||
|
||||
RingBuffer.prototype.getByFrameId = function(frameId) {
|
||||
if (frameId >= this.edFrameId) return null;
|
||||
if (frameId >= this.edFrameId || frameId < this.stFrameId) return null;
|
||||
const arrIdx = this.getArrIdxByOffset(frameId - this.stFrameId);
|
||||
return (null == arrIdx ? null : this.eles[arrIdx]);
|
||||
};
|
||||
|
Reference in New Issue
Block a user