Godot Version
4.6
Question
For example, I have an array that has different items in it, and the game randomly chooses one item and deletes the other items. How do I sync this so everyone gets the same item and not a different one?
4.6
For example, I have an array that has different items in it, and the game randomly chooses one item and deletes the other items. How do I sync this so everyone gets the same item and not a different one?
Have the server pick the item and RPC everyone, or use a seeded random that always returns the same everywhere (sync the seed right before). First approach is probably more secure.
How exactly do I do that? Right now Iām researching how to use RPC, but it would be helpful if you could explain it.
OK, an RPC is a Remote Procedure Call, or a function (procedure) that everyone knows and can be called remotely. Basically, if all clients have a list of items, the server can pick a number (lets say 5), and pass that as an argument into the function. Everyone will get that function pick_item(5) and choose the 5th item from their list, making it synced. Iām bad at explaining, so for more info, check the docs: High-level multiplayer ā Godot Engine (stable) documentation in English MultiplayerAPI ā Godot Engine (stable) documentation in English