GithubHelp home page GithubHelp logo

carbone13 / godot-rollback-cs Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 2.0 100 KB

A complete implementation of Rollback Netcode in the Godot Engine, made in C#

License: MIT License

C# 97.03% GDScript 2.97%

godot-rollback-cs's People

Contributors

carbone13 avatar guliver-jham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

guliver-jham

godot-rollback-cs's Issues

Inputs not parsed properly.

The input dictionary can't access entries by index for some reason.

(forget all that's below this line, my fix worked but it stopped working for no reason, i have no idea how)

For some reason godot dictionaries in c# doesn't actually registers your entry just by calling 'dictionary[entry] = value', it only registers if you call 'dictionary.Add(entry, value)', and because the input parsing in 'ReceiveInputTick' uses the faulty method, you can't get inputs by entry, leading to very nonsensical bugs.

Very simple fix: change line 939 of the SyncManager from "allRemoteInput[int.Parse(entry.Key)] = entry.Value;" to "allRemoteInput.Add(int.Parse(entry.Key),entry.Value);"

EDIT: strange, this fix doesn't work all the time, what the hell? It stopped working!

Float might cause desync over time.

Floating points are very infamous for not being calculated properly and causing a lot of issues, including the possibility that they give different results on different machines.

The "solutions" i know (honestly they are pretty risky, there might be something else that's better):

  • Correct floats with some calculation related to scale. (might not solve the issue tbh, for example: the difference between the resulting move_and_collide or just changing the position could theoretically be more than the scale, causing a bigger desync than if it didn't have this calculation)

  • Make the server send the entire world state every X seconds and resimulate. (might be too much for UDP, and it might take a lot of work, but it's the safer option. If you try this let me know how i can help you, i'm very bad at this stuff but i can try)

Unity.

Is there any possibility of portability to Unity 3D?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.