Open zeroeightysix opened 5 years ago
In my eyes there are 4 common types of synchronization between elements:
also:
Thanks falkeron for kicking sense into me lmao, all this can be accomplished with a simple server
category for config options that gets cut and pasted onto the client as-is
After more discussion on Discord:
Yet more thinking :thinking: : it would be nice to not have to roundtrip every single time a client wants to know if a config option is valid, duh. This actually greatly simplifies everything ever:
Client just performs in-UI validation/config coercion on its own. This handles cases where the server needs to specifically override a config option by just supplying an equals constraint, which the client happily coerces
The current constraints system doesn't have something in place for coercing an arbitrary user-supplied value to fit the constraint. This is kind of a tricky thing, and it's important to get right because some level of coercion will happen every time a client connects to a server with rules about what config options can be what, and their config options don't follow the rules.
It's easy to implement for some options, where coercing a number to fit "x < 5" is just min(x, 5), and it's easy to implement for some constraints, where coercing a string to fit "apple" is just setting the string to "apple", but is it always that easy?
But is it always that easy?
I've actually thought about adding custom constraints written in javascript or lua. It's easy to transmit over a network, (de)serialise, and allows the developer to implement their wildest constraints.
If you have the name of a constraint mymod:my_constraint
attached to a more or less arbitrary json blob, you can just trust the game to load that blob and produce a Constraint
object from it.
Including a scripting language is... a bit much?
Problem is serialisation: one of fiber's features is producing schematics of configurations - how are you going to serialise a custom constraint?
I see the need for only two or three types of sync:
A feature fiber is still missing is a system to synchronise configurations (merge, check, etc) between server and client. Feel free to leave design ideas, etc. in the comments.