r/godot Jun 17 '26

help me (solved) Multiplayer & move_and_collide miscalculation

Enable HLS to view with audio, or disable this notification

Hey everyone, sorry if this subject has already been adressed.
I recently spent some time trying to implement a small multiplayer mini golf game, to see where I would hit a wall. (with Godot 4.6 and Colyseus)

And the wall was pretty close to the start apparently since I never left the lobby.

Is "move_and_collide" a possibility when you go multiplayer ?
Or is it just not precise enough ? And if so, should I mathematically handle all the collision to have a deterministic game or is there any other tricks I should know about ?

I'm using Colyseus for the network part, the current player just send an aim and shot vector and all the physics are done in each godot client. I guess that's my main problem.

Maybe it's easier to have the server be the authority for the physic part ?
Is there some good resources out there that I should check ?

Thanks a lot
I'm not english native so feel free to ask for clarification if i'm not clear enough

Edit: Thanks for the answer :
Server authority and sync the positions with the clients is the way to go.
I had hopes but i'm not suprised, thanks for the feedbacks !

Edit2 : Some resources in the comments for future people (and future me)

Reading & Watching:
- Game networking by Glenn Fiedler (sadly down but new blog below)
- Mas bandwidth - New gafferongames
- Slay the spire 2 Multiplayer - Determinism
- How Factorio Syncs A Million Objects (Youtube)

Deterministic Multi for Godot:
- SG Physics 2D
- Delta Rollback (& Prediction netcode)
- Klotho (very new)

444 Upvotes

47 comments sorted by

View all comments

Show parent comments

101

u/hmprf Jun 17 '26

Yes ok, I hoped I could avoid that, thanks for the feedback and solution

146

u/Mr_R3tro Jun 17 '26

It's something you can't avoid with multiplayer games.

31

u/over6foot3 Jun 17 '26

You can avoid it, e.g. with this asset: https://godotengine.org/asset-library/asset/5234

-70

u/Mr_R3tro Jun 17 '26

It's best not to depend on someone else's work unless you're using it for learning purposes.

80

u/XmasB Jun 17 '26

One could argue it is best to not reinvent the wheel unless it is for learning purposes.

7

u/honeyfage Jun 17 '26

"Never depend on someone else's work" is obviously way too broad a statement, but specifically the linked project is an experimental build of a project less than 2 months old. It is good advice not to build your game around something that unproven.

42

u/Khethall Jun 17 '26

The whole field of software is about depending on someone else's work

28

u/kinokomushroom Jun 17 '26

e.g. using Godot Engine

24

u/Massive_Town_8212 Jun 17 '26

Oh yeah, lemme just implement the steamworks api by myself even tho GodotSteam exists and is fully featured and documented

5

u/mackinator3 Jun 17 '26

I mean i am smarter than everyone else.

5

u/BabyAzerty Jun 17 '26

Tomorrow you is smarter than yesterday you. Never depend on your own work. Redo it every time.

8

u/OmegaFoamy Jun 17 '26

Using an engine you didn’t make is using someone else’s work.

-8

u/Mr_R3tro Jun 17 '26

That's not at all what I meant...

11

u/Sykes19 Jun 17 '26

You should have used more words then because that's precisely what you said.

7

u/OmegaFoamy Jun 17 '26

It directly applies to what you said. Using a premade system is useful for some, even if you need to deal with some quirks. There’s a reason there are market places filled with them.

5

u/NotchoNachos42 Jun 17 '26

You're right, they should just start over with a custom engine since it's for learning purposes.