Netfox - Addons for online multiplayer games

assets | docs | source


Overview

Hi All,

Let me share you a set of addons I have recently released. It’s called netfox and it’s a set of addons built to help you with your online multiplayer games.

Features

  • :timer_clock: Consistent timing across multiple machines
  • :desktop_computer: Supports client-server architecture
  • :butter: Smooth motion with easy-to-use interpolation
  • :dashing_away: Lag compensation with Client-side Prediction and Server-side Reconciliation
  • :wireless: Bullet-proof connectivity with noray integration

netfox is built with online, server-authoritative games in mind, where the server acts as the source of truth, and players only submit their inputs.

This comes at the cost of some input latency, since players have to wait for the server to respond with a new state after the input. To compensate, netfox implements rollback, in the form of RollbackSynchronizer, similar to Godot’s built-in MultiplayerSynchornizer

Install

You can:

If you’re just starting, download the netfox addon, and then read the docs to see what the other addons do.

Docs

docs | Forest Brawl

Docs are hosted as a dedicated site on Github pages for each addon, including tutorials to get you started, guides to explain each system on a deeper level, and a few concept docs to explain design decisions.

In addition, the repository contains multiple examples, including a full, open-source game called Forest Brawl, both so you can refer to some game mechanics already implemented, and for myself to ensure that netfox has a pleasant developer experience.

Support

submit an issue

At the time of writing, I am working on an online multiplayer co-op survival game, that is powered by netfox. This means that the addons are used and checked against a bigger project, and any improvements I make during the development are backported to netfox.

In addition, I am regularly setting aside some time to improve netfox, based on the issues submitted.


Overall I’d love to hear your feedback, and I hope that you can build some awesome stuff with it too. I’ve been wanting to build multiplayer games for years, and after a while I’ve decided to just build the tools myself.

Also let me know if you have any questions or if you’re stuck with some netfox feature and I’ll be happy to help as soon as I have some time!

18 Likes

Hey, I long wondered how to best approach multiplayer and this looks really nice!
Checked the docs and the further references, I got more and more interested at it, but it might be a while until I can get something up to try this out, can’t wait though.
I hope I can help eventually but I’d better familiarize with the codebase first.
Thanks a lot for the amazing work!

2 Likes

Hey, hope you can build something cool with it! :slight_smile:
I think the example game can be a good cheat sheet for laying out your mechanics.

Also, feel free to shoot questions my way, whether it be about networking in general, the repo codebase, or anything inbetween :slight_smile:

3 Likes

Hi!

I feel kind of nasty for bumping up this post but it completely is my intention to do so. It’s been a while since I’ve seen these addons running around and being used and even featured in tutorials. Honestly, the portrait is so clean I couldn’t believe that this all started as a project of just one individual and for your own project. :open_mouth:

Still, this post is 2 years old already and it has not seen any more discussion. Not even with the recent adoption of Godot as a more widespread engine and its use for numerous multiplayer games that are already out there. I guess most of the discussion is long being done in Discord or through other posts that I’ve seen, but I’m going to ask here. I prefer forums. :face_with_tongue:

Specifically, I would like to ask about the current status of Netfox, which I guess is evident by documentation and GitHub releases but, still, a reflection back on these 2 years would be cool to know.

Also, it would be really cool to get a section, common in many documentations, about “Who is this for”. Although the home page says that this resource is obviously targeted towards people with some expertise on both the engine and networking, I still find it hard to realize at first glance if the implementation of the addon is seamless enough as to make it appropriate for me to add. My game is yet another co-op multiplayer game that sits in the boundary between not a competitive lantecy-critical game nor a turn-based type of game.

In any case, I aim to draw some more attention to this resource on the forum context since it seems promising and has only been so discussed throughout videos and issues as it looks to me.

1 Like

Great post thanks for sharing it. It is helpful for me.

I’m trying to get back into socializing, so I wanted to give my opinion on Netfox via this post.

So, I think Netfox is a really good resource for Godot’s general ecosystem. It gives potential devs a plug-in-play multiplayer system for Peer-2-Peer games. But only for new projects and developers inexperienced with multiplayer systems.

I personally don’t use it because I already have my own custom built netcode in place. Also, because Monkanics is a dedicated server setup and not P2P.

For a middle of the road dev like me, I would have to rewrite my entire codebase to use Netfox for only a potential benefit. And for developers who are very knowledgeable of multiplayer systems and the needs of their own project, they can create their own architecture from scratch.

Multiplayer development is just so nuanced because every game’s needs are VASTLY different.

This is a VERY good question that needs to be answered ASAP. I think Netfox is too generalized to be of much use.

This sounds outlandish, but I think the best course of action is to actually make specific netcode addons for SPECIFIC genres and game types. Like, if there was a specific FPS/TPS netcode addon with server authority, interpolation, extrapolation, and hit validation. A fighting game addon with rollback. You get the picture.

These theoretical genre netcode addons could be a gateway for someone to make a prototype and learn how to program netcode for themselves. Because I really think learning how multiplayer works is the end goal here. Abstraction this deep really doesn’t work long-term for multiplayer games, as highly game-specific problems WILL arise and have to be dealt with/mitigated.

1 Like

Thanks a lot for the kind words, much appreciated! :heart:

Specifically, I would like to ask about the current status of Netfox, which I guess is evident by documentation and GitHub releases but, still, a reflection back on these 2 years would be cool to know.

As you’ve mentioned, netfox has been going on for a while, specifically it turned 2 years old on nov 23rd :smiley: We’ve celebrated the anniversary with the v1.35.3 release! It has expanded greatly in features during those two years, and for a long while, it hasn’t been about the game I want to build with it, but about the games the community is building. A good example is rewindable state machines - I rarely use state machines in general, but there was need for them, so they got added :slight_smile:

Another large pain point is the fact that you can’t really do physics with rollback - Godot doesn’t provide a way to manually rewind the physics state, or simulate a single step. As of recently, netfox can also manage physics, though you either need to use the Rapier addon, or a custom build of the engine.

I feel like netfox is in its teenage years currently - it can do exciting new things, but it is a bit awkward in some cases. Specifically, the core features are rather solid, but some new features are still maturing, simply because we can’t always anticipate all the ways people are going to use them :smiley: There’s also the added complexity of thinking in terms of netcode and rollback that can be tough to wrap your head around.

Another core thing I’ve been working on is maintainability - specifically refactoring and introducing more unit tests, so it’s easier to support new features.

If your game is mostly about moving around, I’d say netfox is a no-brainer.

There’s also some games that are on Steam and use netfox: Bubble Battle, Chrome Carnage, Plan B4

Some of the things I’m planning for the next year:

  • Refactor conditional simulation
    • This will enable much more automated testing, and stabilize the mutations API ( for cases like one player shoving another, i.e. nodes affecting each other )
    • Conditional sim is also something that tends to be confusing, so the refactor will make it opt-in - your game should just work, and if you want to optimize it, you can configure conditional sim
  • Rewrite the documentation
    • While it gives a tour of all the features, I want to add more theoretical background so people have an easier time grasping what’s going on
    • We’ve also been discussing a cheat sheet format for best practices and things that can give you headaches
  • Bandwidth
    • This has already seen improvements due to popular demand
    • I’ve also been planning Schemas, so you can save space by specifying how to serialize each property ( e.g. use 1 byte for a counter that won’t go over 100, instead of a 8 byte integer ), but someone already contributed a PR :smiley: So that’s probably coming earlier!
    • There’s also Batched RPCs on the horizon - basically group multiple RPC calls that netfox would’ve made into one. This reduces bandwidth, since each RPC call has its own header, so sending less RPCs means less bytes spent on headers.

Also, tangentially, we’ve also been working on services that implement things related to online games:

  • noray
    • Helps connecting players even behind routers, without having to mess with port forwarding or similar
    • Has mostly been on maintenance since netfox’s v1 release, planning to upgrade docs and improve stability during the next year
  • nohub
    • Manages lobbies for online games
    • Recently announced, currently in pre-release
    • It’s basically feature complete, I’m announcing it before v1 so I can make breaking changes if there’s demand

Also, it would be really cool to get a section, common in many documentations, about “Who is this for”. Although the home page says that this resource is obviously targeted towards people with some expertise on both the engine and networking, I still find it hard to realize at first glance if the implementation of the addon is seamless enough as to make it appropriate for me to add.

Frankly, somehow I haven’t considered this question much. What kind of answer would help to decide if netfox is a good fit for you?

2 Likes

First and foremost, these:

are so exciting!!! Those are two of the simplest yet most useful optimizations that we used to work with for the similarly high level multiplayer of Roblox. At the end of the day, it’s all a matter of logistics.

I think a good example is Zylann’s Voxel Tools “Is Voxel Tools for you” section. Nothing too fancy, specially considering all of the technical details that are spread throughout the docs and could end up being relevant, but still, a good summary of:

  • Common questions about the addon, aka FAQ.
  • Technical capabilities and/or limitations.
  • And more specifically, concrete examples regarding games, because that’s why we’re here at the end of the day.

It’s why I stated that, while my game is not a competitive one where latency is critical, scenario in which I think netfox would be a no brainer, it also isn’t a game that would end up with multiple seconds between remote actions. It’s an in-between, that has no critical decisions that depend on good network but still has things happening fast enough as to de-syncs and delay to be a turn-off for players.

This all comes from my experience with R.E.P.O. I tried it with my friends during the free weekend and it was a blast. However, one of my friends is currently struggling with connectivity issues and was constantly lagging considerably behind our view of the game. It is a co-op game and so it posed no real issue for us to keep going, but still, it really seemed like R.E.P.O probably didn’t take into account bad connectivity and thus spectating, interacting with or letting valuable objects to my friend was discouraged.

Now, I don’t want to ask you much, I guess we cannot account for all possible games with multiplayer, but I’ve ended up deciding to use Netfox following the criteria that my game is:

  • Not competitive, although co-op
  • With continuous action and not turn-based or condition-based
  • Heavily reliant on physics
  • Fast paced
  • Incorporated with features that may load too much the net and thus affect other systems, like voice chat, synchronized voxel world…

It gives potential devs a plug-in-play multiplayer system for Peer-2-Peer games.

What gives you the impression that netfox is for p2p games? Also, by p2p do you mean players can host their own game sessions, or that the network is running in a mesh topology?

For a middle of the road dev like me, I would have to rewrite my entire codebase to use Netfox for only a potential benefit.

Agreed, if you have your own solution, it does not really make sense to migrate to another solution that does just about the same. Or maybe even less, I don’t know your solution so I can’t judge how netfox fares in comparison.

And for developers who are very knowledgeable of multiplayer systems and the needs of their own project, they can create their own architecture from scratch.

Well yes, but is it always the best option? It would be overkill to build your own car every time you do a grocery run. Or a less extreme example - I could write my own renderer, but as long as Godot’s does what I need, I don’t need to build my own. Even if I know how they work and I could do it. I think this really boils down to the question of using an existing solution for any given problem, or rolling your own.

Unless I’m massively misunderstanding your point, in which case please feel free to elaborate :sweat_smile:

This is a VERY good question that needs to be answered ASAP. I think Netfox is too generalized to be of much use.

Is netfox’s general nature the issue here? If so, how would you contrast that to other, existing libraries like Mirror, Photon, or Fish Networking? I’d argue each of these are just as, or more general than netfox.

Also see my previous reply, I’m wondering what kind of answers would be helpful here, as to whom is netfox made for.

Like, if there was a specific FPS/TPS netcode addon with server authority, interpolation, extrapolation, and hit validation.

I do believe there’s a point in a generalized solution. Surely, if I were to build an FPS-specific addon, I’d need all these features you mentioned. But then if I move on to another genre, I would still probably need server authority, interpolation, or for example clock sync, which imo you need for most multiplayer games if you want to do latency compensation.

My approach has mostly been to dogfood with a specific genre in mind to build generic tools. For example FPS games - I needed a way to synchronize shots during rollback. I’ve boiled this down to a case of the client predicting something happens, and then the server confirming / rejecting the prediction. So netfox ended up with a tool that is general, but works for FPS games.

Longer term, I do plan on building more specific tools for specific genres, but we’ll see how that turns out :slight_smile:

Abstraction this deep really doesn’t work long-term for multiplayer games, as highly game-specific problems WILL arise and have to be dealt with/mitigated.

If that’s the case, that also means there’s no point in using third party components for building multiplayer games, no? :sweat_smile: Or what’s your view on this?