foxssake / netfox Goto Github PK
View Code? Open in Web Editor NEWAddons for building multiplayer games with Godot
Home Page: https://foxssake.github.io/netfox/
License: MIT License
Addons for building multiplayer games with Godot
Home Page: https://foxssake.github.io/netfox/
License: MIT License
Originally, the state interpolation logic was added to RollbackSynchronizer
. However, a bit later, the interpolation logic by itself was needed by things that were synchronized over the network, but without rollback, so TickInterpolator
was born. Ideally, RollbackSynchronizer
should manage only the rollback logic, and TickInterpolator
would handle the tweening.
enable_recording
property to TickInterpolator
from
and to
state before and after the tick looppush_state()
method to TickInterpolator
-with-deps
addons that include dependenciesgrep "version=" addons/netfox/plugin.cfg | cut -d"\"" -f2
zip -r target.zip /path/to/dir
godot --headless --export-release <preset> <path>
Godot has v-sync enabled by default. When turning it off, the fps increases, and movement of networked objects will slow down greatly.
This is due to move_and_slide()
taking the current frame delta, instead of always using the physics delta as assumed earlier. This in turn means that NetworkTime.physics_factor
is wrong, unless the current fps matches the configured physics tickrate.
While creating TickInterpolator
, the same PropertyEntry logic was needed to specify properties to interpolate, as in RollbackSynchronizer
. Since that was not exposed, the fastest solution was to just copy the related code and implement the new component. To improve maintainability, it's time to extract that logic.
PropertyEntry
class is extractedPropertyCache
class is implemented
RollbackSynchronizer
uses the new property entriesTickInterpolator
uses the new property entriesCurrently, timing is synced to the server at regular intervals. This gives us a good estimate on the server time, but it does fluctuate both forwards and backwards. When the sync happens, rollback logic hitches, as its data is based on now outdated timing.
local_tick
and remote_tick
on NetworkTime
remote_tick
is a regularly updated estimate of the server's timelocal_tick
is synced once, at jointick
is same as local_tick
Can we get away with adjusting the local_tick
if it's too far away from the estimated remote_tick
?
_set_input_age
methodNetworkRollback
implements utilities ( same as is_rollback_aware
and `process_rollbackNetworkRollback.discard(what)
BaseNetInput
to be input age awareBrawlerController
to discard if input age is not 0NetworkTime should emit an event when a client completes the time sync. This could be used e.g. for spawning the client's avatar once it has the time synced, so it won't jump around as it updates its time.
static func _pick_random(from: PackedStringArray) -> String:
return from[randi_range(0, from.size())]
randi_range is inclusive on both ends
Testing multiplayer games under different latencies is key to making a good, stable online game. While this is not supported out of the box, it can be done under Linux with the tc
command. To make testing easier, it would be nice to have a simple and configurable tool inside Godot to simulate latency.
Regardless of type, tick callbacks are usually called _tick
, which can make code more confusing, both to write, read, and to auto-register rollback handlers in RollbackSynchronizer
.
_rollback_tick
is_fresh
flag
Bombs collide with weird and unexpected geometry.
Based on this line, Shapecast's target_position
is relative to the node's transform, as a child node would be.
Multiple TODO's are left over from the original game POC - create new issues for each of them to be resolved.
During rollback, RollbackSynchronizer
has a list of nodes to simulate. The list consists of all nodes that:
This can be sometimes unexpectedly conservative, for example when a node implements some effect but has no state of its own. To make things easier, simply include all child nodes that implement the necessary method.
RollbackSynchronizer
resimulates all of the root's child nodes with the _rollback_tick
method implementedNetfox offers interpolation for various properties. Currently, a bunch of builtin types are supported with a fallback "const" interpolator. However, we'd like to support arbitrary data types, even ones that are specific to the host application. For this, an interpolator registrar mechanism is to be implemented.
Interpolators
singletonis_applicable(v)
and interpolate(a, b, f)
RollbackSynchronizer
and TickInterpolator
uses Interpolators
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.