#Creating & syncing a Configuration File.
1 messages ยท Page 1 of 1 (latest)
you may or may not see some config pages on the wiki soon : )
Ebic
If im reading this correctly this also explains how to just setup configs from scratch too yes?
Steps 1 and 2 are regular client side setup ye
Should probably include that net46 is recommended
and why would that be?
@sour wolf had an issue with registernamedmesssgehandler, but it could have also been missing assembly reference
I see
I probably wouldn't add that on a one-off with unsure reasons but I'll keep it in mind
Yhyh
It's actually funny since I started writing config docs last night but only just setup a fork so this will be an amazing outline to convert to the wiki format and build from. Thanks
@tepid pine PR looks nice, gj. There is a slight nuance tho, if they use ConfigurableCompany, they likely wont have Instance (thats created on manual section) which might leave people confused.
would you mind writing a comment for the section and detail what needs to be changed please?
Just want to say this was incredibly well written and helped me massively. Thank you for taking the time to make this!
<33
Running into an issue where a single config setting is not syncing with the host. the mod only has 3 features:
1st setting: correctly syncing with host config
2nd setting: Not syncing with host config โ
3rd setting: correctly syncing from local config
syncedAutoLanding is working while syncedInstantLanding is not
Not sure what i'm doing wrong considering they are being set up the same exact way. Everything works fine when i'm in a game alone, so I know all the settings work
Can you show your Config file
no they are likely fine. maybe you are hitting the return ?
the return for what exactly?
Oh i see in my patch for the instant landing code
this could end the function before checking instant landing
That's a good catch. I'll try moving my if statement for the config check around the entirety of that code. Will let ya know if it works but i'll have to wait until later tonight to test multiplayer lol
Can you not use 2 lan instances?
I looked at the resource for setting that up. It didn't seem like I could test config syncing because I cant change the configs for each instance individually
I usually just get them both in, change the config and reboot & rejoin on the client
Oh thats a pretty good idea
Ill try this out
This was not the issue unfortunately
Thats odd. Have you confirmed through logging that syncedInstantLanding is not what its supposed to be?
I kind of figured that wouldn't fix it because it is still working host side correctly, when you change the config setting. So it is passing that return in the right circumstances.
Yeah just confirmed this
The value is being set up correctly (ie changing the value in the config file will change the value of syncedInstantLanding. That value is not syncing correclty however. It stays as whatever the local config is set to
Do you have a github repo I can take a look at?
I do not unfortunately. I could set one up a little later
send over a dll for now, ill decompile
@tepid pine bro went AWOL on the PR
@wise dawn I'll go fix the shit now ๐ญ
damn right. no sleeping on the job 
After you finish it I'll make another PR to update to my latest gist
- revert sync on leave
- client-side "default" instance
- troubleshooting section
bro why is vscode being a bitch ๐ญ
why does it not work on my project but a fresh vscode terminal does?!???!??!
@silver pelican can you please explain to me your link bullshit on the pr
like it literally just doesn't work
Why is github just not pulling some files?
tf
finally fixed this bs
@wise dawn could you elaborate on this?
Here's that code. I find it unclear what you meant
public Config()
{
configGreeting = Config.Bind("General", // The section under which the option is shown
"GreetingText", // The key of the configuration option in the configuration file
"Hello, world!", // The default value
"A greeting text to show when the game is launched"); // Description of the option
configDisplayGreeting = Config.Bind("General.Toggles",
"DisplayGreeting",
true,
"Whether or not to show the greeting text");
}
would it just be this:
public Config()
{
configGreeting = cfg.Bind("General", // The section under which the option is shown
"GreetingText", // The key of the configuration option in the configuration file
"Hello, world!", // The default value
"A greeting text to show when the game is launched"); // Description of the option
configDisplayGreeting = cfg.Bind("General.Toggles",
"DisplayGreeting",
true,
"Whether or not to show the greeting text");
}
sry for late reply. yes, but also specify the parameter
public Config(ConfigFile cfg)
got it
you can come in vc a do a once-over of my preview deployment of the site if you want
@wise dawn \

This guide is now also documented on https://lethal.wiki 
Big thanks to @tepid pine and @silver pelican.
Hopefully this helps some peeps since its quite a common case.
You missed one of the key points on the wiki which was in owen's gist btw https://i.1a3.uk/1703863672.png
since commonly most people define the fields as a ConfigEntry which obviously doesn't work in this case
Also after following the wiki and correcting the fields to not be ConfigEntry's I'm stuck with this error on the host when the client connects ๐ค
seems to work fine with 7 config options but doing 55 causes that
Fixed it by changing the MessageManager.SendNamedMessage within OnRequestSync to MessageManager.SendNamedMessage("ModName_OnReceiveConfigSync", clientId, stream, NetworkDelivery.ReliableFragmentedSequenced)
Glad you solved it. I will add it to the troubleshooting section
Weird that it has to be fragmented
I'd guess not having it has a lower max payload size
I may just edit the code to only fragment past the max packet size
It may be better to use ReliableFragmented without sequenced
you mean without fragmented? https://i.1a3.uk/1703880037.png
oh I see, there is no ReliableFragmented.
in that case I should definitely edit the code
Gist updated. I may PR lethal wiki at some point
there's a list of the major issues here https://github.com/LethalCompany/ModdingWiki/issues/65
The problem with BinaryReader/Writer is that u have to do writer.Write(value) for each config property
Works like a charm in NET 4, but requires every property (if using private setters) to have [DataMember] attribute. 
one small thing https://i.1a3.uk/1704244671.png
๐
While DataContractSerializer is slightly more annoying to use, is definitely worth it.
http://james.newtonking.com/archive/2010/01/01/net-serialization-performance-comparison
I could use a package like Newtonsoft or Protobuf, but I think they would make the guide more convoluted.
Gist updated to replace BinaryFormatter.
https://gist.github.com/Owen3H/c73e09314ed71b254256cbb15fd8c51e
@silver pelican
oh yeah i'll take a look at this
i think newtonsoft might be OK since it ships with the game
protobuf would probably be a pain though
it should be able to if you use properties
Yeah.. im not so sure about Newtonsoft
in theory it sounds better, in practice its not rly worth it over DataContractSerializer
turns out stream.Capacity > stream.MaxCapacity doesnt work
since both return the same value
According to https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/2363#issuecomment-1407507707 you'd probably want stream.Capacity > 1300
which one is "wrong" ?
Size of stream: 6560, max buffer size: 6560
๐
I just noticed that you didn't change that on the wiki PR btw
I wouldn't say that...
The reason I say that is because Bobbie is looking into retaining ConfigEntry, since it's pretty bad practice to assign the Value on start as it prevents editing config values at runtime.
Which isn't a quick thing to do
Yeah; I'll take a look since Bobbie's out on a trip rn
Im currently trying ISerializable
https://github.com/Owen3H/CSync/blob/main/Lib/SyncedEntry.cs
@honest mantle In the meantime, it may be best to pull the syncing section from the wiki
yeah I'll remove it from the sidebar and add a warning on the page in case anyone's linked to it
I also noticed that harmony uses BinaryFormatter ๐
really?
if you update the pr I'll take a quick glance over it and send it through
@honest mantle would it be ok to make the config syncing guide use CSync now its released?
We try to keep a neutral stance on the wiki, so you can't add the usage of an API to a modding topic. You can, however, add a tip that the API exists, and link to the api's wiki article/brief description on the api overview page.
So provide the guide to do it manually, but link it at the top?
yeah
the only exception to that are developer tools; specifically things like BepInEx, MelonLoader, Harmony, Monomod, or NetcodePatcher
kk, I'll take a look when I have the chance (and if I remember)
@honest mantle ๐ค
lmao okay, ping me in a few hours, working on something quickly before I have to go for a few
just add me to collaboraters 
not something I can do 

@honest mantle 
lmao good thing you reminded me
weird bc npm run dev was fine
npm run dev is slightly different than npm run build
dev just makes a temp site without making it static, build actually builds the static site
(tis why I added the build CI to the gh)
posted the review
Is the CC bit not the original line?

@honest mantle isn't it bad practice to have something up on the wiki that is prone to RCE ?
also ConfigEntry cant be serialized
it is, I meant it more as a "add back the stuff you had earlier in the commit history" type of thing
If I do that, they will have to use primitive values within their config which contradicts the custom configs page
I think this page should probably just be deleted imo
hmmm
let me get back to you on this, will have to discuss with the other maintainers
I'll tell you what, for now separate the CSync PR and the update config syncing PR, and I'll take a more in-depth look to see if I can easily add something on the BinaryFormatter & Serialization stuff
Will do
@honest mantle idk what u mean by "update", but I have removed CSync from the syncing PR and made a seperate one.
Thank you two for the great work. I use both of your stuff.
It may be worth checking the issue I ran into with CSync #dev-general message
I can think about taking LethalConfig support a bit further, but it should work if you change settings before joining
although aina was thinking of locking of some sort so idk yet
The settings were changed before joining/hosting but after the game launched.
Thats odd, bc LC should apply the changes to the file, which is then used to sync on join
I'm not sure if these factors change it but the mod I was testing it with is a local DLL, and testing was done on Lan on the same device by launching two instances of the game.
Syncing is working just fine with CSync. I just noticed that issue while trying to test it and it threw me off for a bit.
My testing with LethalConfig was fine
I'll test it again to double check and maybe record
Yeah that makes sense. As mentioned, it's before joining.
All settings changes are after launch, before join/host.
Unless you are on a pre 1.0.7 version, I can't guess at all what it would be
1.0.7 
I'll double check to save you the trouble. If I replicate it as expected, then I'll record it as well.
ty
@wise dawn
You can skip to 0:35 for after launching the two instances.
Refering to Left as Client #1 and Right as Client #2
The value I'm modifying is something called "fGasBuildupPerSecond". You can tell how high it is based on how fast the green meter under the stamina fills up.
The game launches with a value of 10. I change it on Client #2 to be 1 before hosting or joining.
I host on Client #1, whose value is still 10. As you can tell, the meter builds up fast, and Client #2 joins in and builds up with the same speed.
I disconnect both, then without changing any values, I host on Client #2. It's easy to tell that the buildup is much slower due to changing it to 1 with LethalConfig. However, Client #1 joins and it still has the Speed of 10 that it launched with.
I've confirmed that It doesn't matter who hosts first. The value synced is always what was launched with. I've also confirmed that changing both clients through lethal config also doesn't change the value that gets synced as it'll always be the initial value that the process launched with.
Can you try this again but manually change the value in the .cfg
instead of LC
just to confirm its an incompatibility and not CSync itself
Open instance, change config with r2, then open another?
do as you did but with the file instead of lc
nw
Only just got to test it.
Launched #1 instance with value 50.
Changed config value to 10.
Launched #2 instance.
Hosting with #1 makes everyone have value 50. Hosting with #2 makes everyone have value 10.
In this case, that's expected because instance #2 launched with that value.
I'll test whether launching both and THEN changing the config value matters.
Changing config settings had no effect on the already launched instances. Though it may be worth noting that at one point, the cfg file got forced back to the value it launched with. Couldn't replicate it after it happened once.
@honest mantle somehow csync ended up under LethalLib lmaoo
thats what i get for not npm run dev on the new pr
lmao I didn't run it either
make a fix pr and I'll approve
yuh
done. i used the same branch but only changed the mts file
kk
sry for all the mistakes. had to reinstall my OS throughout the past few days
fucking drive died
np, it happens
also can you rebase your branch off of the latest master?
yuh
currently has merge conflicts since it's trying to add the same things you added last time




