Open PieKing1215 opened 1 year ago
Hey, sorry for the delay. I don't know if scatter is really supposed to handle multiplayer at all. As long as you use the same seed on both sides, the results should be identical. (If they're not, that's an issue I need to fix)
I'm not familiar with multiplayer, but if you really need to drive it from the network, I would make it a separate node. (Added under a ScatterNode, like the ScatterItem nodes):
build_complete
signal, and send the transform list to the clientclear_output
and _on_transform_ready
on the scatter node. (similar to what ScatterCache
does) Basically, moving the multiplayer_call method to its own node, along with all the multiplayer features. Makes it easier to maintain (the scatter nodes don't know about multiplayer but still work as usual) and it doesn't cause conflicts with future updates.
(needed this for a project so figured I'd PR in case this is something you want :) )
Adds a new "Multiplayer Sync" option (false by default) on ProtonScatter node, which if enabled will sync the scatter output transforms from the multiplayer authority to clients
More specifically calls to these functions are synced via rpc:
_clear_collision_data
clear_output
_on_transforms_ready
Tested in Godot 4.1.1 (in an unreleased project) Might be worth making a dedicated test setup, idk how thorough you want to be
Demo (left is server with
enabled
field being toggled, right is client):https://github.com/HungryProton/scatter/assets/13819558/b2b1e5af-ee76-4653-88f3-6f5c7cd5bc70
Some notes:
enabled
to false on clients, otherwise they will also try to scatter locally.enabled
/rebuild
/etc if multiplayer sync is on, if that's desired)_multiplayer_call
function looks kinda dumb, but I was trying to avoid usingbind
since iircrpc
only works withbind
on 4.1.1+multiplayer_sync
/"Multiplayer Sync",_multiplayer_call
,_do_transforms_ready
)