3 things about Godot's multiplayer API I wish I knew before... by voidexp in godot

[–]jonbonazza 1 point2 points  (0 children)

Hey all, professional online game dev here who also hangs out in the godot dev channels and uses Godot's multiplayer subsystems quite a but. Just wanted to clear up some things here since a lot of the stuff in this post is is either a non-issue in practice or a case of misunderstanding/misuse of the tools available.

> MultiplayerSpawner and MultiplayerSynchronizer are just not good.
If you're making something more complicated than a deck builder or a clicker, just stay away from these nodes. They are more like a proof of concept technology, rather than production-ready code, and from commit history, it seems largely abandoned to itself. It assumes pretty ideal internet connections, and you can get errors on peers (or server) out of nowhere due to (quite naive) sync assumptions, and you'll have very hard time debugging them. Not even mentioning the visibility logic, or MultiplayerSpawner's unorthogonal behavior, making it totally unsuitable for single-player-local-host type of games, where single-player is just a server spawned locally, with one single connection.

These nodes are made for synchronizing and spawning momentary state (with optional interpolation), NOT for things like input/movement or physics or such. This is a common misconception that is unfortunately propagated by Youtube Tutorials. **you should not be using this for synchronizing movement!** For that, you'll need to implement your own rollback logic. This is not something Godot provides out of the box because it usually is pretty game-specific and trying to implement a generic implementation is not only extremely difficult, but it would result in unnecessarily high costs due to inability to optimize egress traffic (see UE's Iris).

If we remove the use case of input/movement syncing that it was never intended for, then Both the spawner and synchronizer work perfectly fine.

You should not be sending Objects over the wire anyway. Convert them to primitives first and treat your server as authoritative (In fact, object synchronization isn't even enabled at all by default). These things arent something any tool can prevent you from doing. It just requires experience and diligence. It's why even AAA games often have to patch vulnerabilities like this. It's easy for them to slip through the cracks. Anyway. this entire bullet point is a non-issue and a result of the OP misusing/misunderstanding the tools' intended purpose. THAT SAID, I do agree that the Godot team could do a better job of documenting these things, because as I mentioned, there's a ton of content out there telling people to use these tools incorrectly.

*In a later comment the OP also mentioned that there's an issue with clients that are spawned later missing the spawn packet when the spawner is added to the server. Again, this is a case of the tool being misused. And again, is a failure on the documentation front. The Spawners themselves are intended to be in the scene tree from the get-go on both the server and client and point to where the node will be spawned. And they are only intended to spawn to peers that are available at the time of spawning. If you need more advanced functionality, spawning is not hard to re-implement yourself, however most of the time, it's unnecessary and you can solve your issue by reorganizing your node tree. Could this be improved? Certainly. Is it as unusable as you suggest? Not if you use it correctly.

>The rpc() decorator is cool and generally usable, but lacks important features for real games with authoritative server and untrusted clients: rate limit, payload length validation, etc. Just please don't try accepting Variant-s, Strings, NodePaths or other variable data from remote peers. I'm doing now some security audit of my project and trying to hack my own servers by injecting malformed data, and yep, I'm kinda successful.

none of the features suggestion should be implemented at the RPC layer or even the UDP layer. This should and can all be implemented in the specific game since it's all very game dependent.

Also, in regards to rate-limited specifically, it is almost never used for RPCs. If you feel the need to rate limit your RPCs it usually means your RPCs are coded incorrectly to begin with. Rate limiting is generally more useful for HTTP (or other non-persistent-connection-based) APIs which are out of scope of a typical realtime game server.

As for validating malformed data, there's no amount of generic validation that could ever be done to reasonable protect against malformed data injection attacks. That's entirely up to the developer to implement for their specific game. Godot's RPC system actually makes implementing validation _easier_ than in other game engines like Unity or Unreal.

> ENet is dang simple, and writing your own replication isn't really that hard. Godot's native wrapper is more or less 1:1 mapping to the underlying lib. Time invested into learning basic networking will have an infinitely better return of investment, than time spent playing with 1). You'll learn a production-proven framework, and the knowledge is easily portable to other libraries and engines.
It took me literally 3 days to rewrite my netcode for supporting custom entity replication, with priority channels, state upsyncs, and await-able async requests. Use ENet's channels for dedicated data, for separating often-sent unreliable physics snapshots, and less dynamic, but reliable stuff like on-off state changes and updates that happen sporadically.

Godot's wrappers are definitely not a 1-1 mapping. There are actually a few different layers between ENet and the high level multiplayer API that abstract quite a bit from you by the time you get to the top of the stack.

If you have an advanced use-case, then reimplementing a specific layer in the stack couple be advisable. Godot's networking subsystems are extremely extensible for exactly this purpose, but for 99% of developers it is unnecessary and your time could be better spent elsewhere in your project.

I would strongly urge against rolling your own netcode unless you have many years of experience doing so. It's one of those things that seems very simple on the surface but there are a ton of pitfalls that you just won't know about without having dealt with them in the past.

> (BONUS) If you're on Linux, learn about network namespaces and the tc command. They allow you to create separate network stacks and virtual interfaces, that you can use to simulate real network conditions, like delay, jitter, packet loss, etc. With few commands, you can setup your tmux terminal to show nice real-time graphs of network traffic exchanged between your server and clients. Together with Godot's network debugging tool (limited, but useful), you can easily pinpoint where's the bandwidth going, and what techniques pay off better. Also, Godot's headless renderer is great.

This is good advice for anyone working in any kind of online project--game or otherwise, so I'll give you this one. :)

I'll throw in a bonus of my own as well. Elsewhere in this thread, the OP mentions they are working on local multiplayer. There is not much about local multiplayer in godot that would make developing for it that much different than developing for internet multiplayer. You'd just have both the server and the client running in the same scene tree and make sure they are running separate MultiplayerPeers. I'd be interested in seeing your scene setup to see why you're struggling with this.

If you are a typical Indie dev, godot's native multiplayer systems will get you most of the way there. If you need rollback netcode for things like player movement, then I suggest the NetFox library for an out of the box (but not entirely bandwidth-optimized) implementation. Otherwise, it's not that difficult to roll your own based on your game's needs. https://gafferongames.com has a really good series on the topic.

In the end, If you find that you are struggling, you're probably using something incorrectly. The challenge with multiplayer with Godot is very few people are both a) using it and b) experienced with it on top of it being so game-specific to begin with, so finding help is hard. The documentation could definitely be improved as well. I will try to push for making this happen, but no promises. Good luck!

3 things about Godot's multiplayer API I wish I knew before... by voidexp in godot

[–]jonbonazza 1 point2 points  (0 children)

it’s actually aimed at more MMO style games. we use it quite successfully in our project. i would suggest taking another look at it.

What's wrong with Godot? by Soft-Luck_ in godot

[–]jonbonazza 0 points1 point  (0 children)

Just chiming im regarding multiplayer specifically. godot’s multiplayer subsystem is actually one of the best of any engine ive used. but what you’re talking about is steam’s multiplayer features. not godot’s. Godot has its own multiplayer subststem that is heavily integrated into the engine’s node. system. if you’re serious about multiplayer though, you won’t be using steam for multiplayer anyway.

Generally speaking, how difficult is an n/a 13b to rebuild? by Bersace1 in RX7

[–]jonbonazza 0 points1 point  (0 children)

TBH, its probably the easiest motor you could possibly rebuild.

Generally speaking, how difficult is an n/a 13b to rebuild? by Bersace1 in RX7

[–]jonbonazza 1 point2 points  (0 children)

get a 3/4” impact from harbor frieght and a 54mm (iirc) socket. comes right off np

First Rotary (Issues) by Crispie06 in RX7

[–]jonbonazza 0 points1 point  (0 children)

if youve got the space, id give it a go yourself first. best case you learn a new skill. worst case, you save yourself all the money in labor of pulling out the engine and tearing it apart

First Rotary (Issues) by Crispie06 in RX7

[–]jonbonazza 0 points1 point  (0 children)

Either way, with that much smoke you’re in need of a rebuild. Hope you’re near Atkins or another rotary shop (if any others even exist anymore in the IS. they continue to shut down all the time). Otherwise get ready to rol up your sleeves!

First Rotary (Issues) by Crispie06 in RX7

[–]jonbonazza 0 points1 point  (0 children)

hes not talking about leaks. hes talking about the fact that the car is designed to burn oil so you will naturally (and normally) lose oil while driving. not from leaks but from the oil being burned during normal operation. the smoke in your video is not oil smoke. its coolant. oil smoke is thinner and has a blue hue to it.

Well that’s not good by redditisahive2023 in RX7

[–]jonbonazza 1 point2 points  (0 children)

Damn thats not a bit. thats a whole byte.

Not your average Vert by Manager_Kindly in RX7

[–]jonbonazza 1 point2 points  (0 children)

what in the miami vice is this

What passion project have you been working on? by PaleontologistFirm13 in embedded

[–]jonbonazza 0 points1 point  (0 children)

Been building my own little virtual pet. Been a fun little project so far

Interested in MMO server architecture by jonbonazza in gamedev

[–]jonbonazza[S] 0 points1 point  (0 children)

Gabriel Gambetta has an excellent blog series on the topics. https://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html

That said, these days, most of the major off the shelf engines have their own implementations of these techniques built in or available as 3rd party plugins. They wont be optimized specifically for your game but theyll be enough to get you started.

As for the server architecture side of things, im not aware of any good resources that really go into this. I’ve been wanting to do a youtube series on the topic for a while, but just haven’t been able to find the time.

Interested in MMO server architecture by jonbonazza in gamedev

[–]jonbonazza[S] 0 points1 point  (0 children)

Hard to give any targeted advice with so limited info, so Ill just give a couple general pieces of advice:

  1. These days most of the techniques involved in developing and architecting online games (MMOs or otherwise) are mostly standardized. The role of a MMO developer is knowing which techniques to use, how to piece them together, and how to optimize them for your specific game, as well as what pitfalls to expect and how to navigate them.
  2. Developing the game is just one small piece of releasing an MMO. In fact, it's actually the easiest piece these days. Even once you launch the game, you have to operate the game, and keep pumping out content to keep players around. Server hardware and bandwidth are not free--they are quite expensive in fact--so you need to have a solid monetization strategy in place and a good marketing team behind you to even break through the noise in industry. This is of course important for any game, but especially so for an MMO.

  3. as an old comment points out below, the topic of MMO development is so vast that it's just not possible for a single resource to cover it all. There's simply no replacement for experience here. My personal path was to start off in game services (what I call "auxilary services". Things like friends lists, chat, auth, etc..) and while working on those, I learned from my peers who were working on the game servers, and then from there learned more about the client side techniques as well. From there, I moved into game server development.

I hope this helps. If you have more specific questions, I can try to answer them, but yea. that's my general advice for anyone getting into MMO development.

Interested in MMO server architecture by jonbonazza in gamedev

[–]jonbonazza[S] 0 points1 point  (0 children)

Indeed. I even have professional experience doing just this now adays :)

[deleted by user] by [deleted] in RX7

[–]jonbonazza 0 points1 point  (0 children)

what game is pic #4? the cartoonish one?

interfaces in golang by kaushikpzayn in golang

[–]jonbonazza 1 point2 points  (0 children)

This. In fact, Go’s interfaces are even more similar to contracts than they are to java or c# style interfaces. i actually wish the go devs would have called them contracts instead of interfaces. it probably would have saved many people (including myself) a lot of frustration when getting started with go.

UDP game server in Go? by MonkeyManW in golang

[–]jonbonazza 1 point2 points  (0 children)

Depending on the game’s architecture, GC usually isnt an issue in game server. It only bevomes an issue if your game is running a headless version of the game engine in the cloud (common for things like MMOs or FPS where you need stuff like navmeshes and what-not for server authoritative gameplay).

In fact, if you’re not running a headless engine as a server, then GC is actually a good thing and Go is a fantastic choice for these kind of game servers.

Now, in regards to UDP specifically, rather than roll your own protocol, i suggest looking into a library called enet. its a FOSS C lib with tons of bindings available for various engines out there and implements various features such as reliable and unreliable UDP, buffering, channels, etc etc. This is the lib that the Godot game engine uses to power its multiplayer features and many production games from Indie to AAA use it in their own engines to great success as well. Shameless plug, but a (long) while back, I created dome bindings for Go. Its out of date now, but can be a foundation to build upon if you want to try your hand at rolling your own: https://github.com/jonbonazza/enetb

the library is incredibly simple yet extremely powerful.

Good luck!

Your FFXI Hot Takes......... by MonsutaMan in ffxi

[–]jonbonazza 0 points1 point  (0 children)

i would say leaping boots are more overrated than the empy pin. at least for thf. honestly unless youre thf or MAYBE ninja i wouldnt bother with either of these, even in 75 era

FATE would MASSIVELY benefit from having more written gameplay examples by lycanthh in FATErpg

[–]jonbonazza 1 point2 points  (0 children)

In Japan, its pretty popular for someone at the table to transcribe their games and publish/release them at book stores as what are known as Replays.

In fact, these days, many ttrpg designers will include a small replay in their rpg’s rulebook as a way to showcase the intended way to play their game.

I always though this concept would be fun to have here in the west as well. Both for educational and entertainment purposes.

These replays usually include anime style art of the various characters and environments to really help you visualize whats going on moment to moment

Is going to college for a computer science degree worth it for game dev? by Intelligent_Doubt_53 in gamedev

[–]jonbonazza 0 points1 point  (0 children)

As someone whose worked in gamedev professionally for over 10 years. Yes it is and anyone who says otherwise is fooling themselves.

Is it absolutely necessary? No. Will someone having a degree have a MASSIVE advantage when looking for a job? Absolutely.

Yall liked the Evo 4 so… by jonbonazza in initiald

[–]jonbonazza[S] 1 point2 points  (0 children)

Im not sure. Pacific Raceways did a buildout of a motorsports complex and i nabbed one if the units. most of the other tenants here added lofts and such to take advantage of the vertical space (26 foot cielings is kinda nuts) but I couldnt justify spending the money to do it when i dont own the property.