FabLabsMC / fiber

A configuration system. Maintained by @zeroeightysix and @Pyrofab
Apache License 2.0
32 stars 8 forks source link

Sync system #10

Open zeroeightysix opened 5 years ago

zeroeightysix commented 5 years ago

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.

quat1024 commented 5 years ago

In my eyes there are 4 common types of synchronization between elements:

also:

quat1024 commented 5 years ago

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

quat1024 commented 5 years ago

After more discussion on Discord:

quat1024 commented 5 years ago

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

quat1024 commented 5 years ago

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?

zeroeightysix commented 5 years ago

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.

quat1024 commented 5 years ago

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?

zeroeightysix commented 5 years ago

Problem is serialisation: one of fiber's features is producing schematics of configurations - how are you going to serialise a custom constraint?

kvverti commented 4 years ago

I see the need for only two or three types of sync: