#Creating & syncing a Configuration File.

1 messages ยท Page 1 of 1 (latest)

wise dawn
#

If anyone from Lethal Wiki sees this, feel free to yoink it.

tepid pine
wise dawn
#

Ebic

tepid pine
#

If im reading this correctly this also explains how to just setup configs from scratch too yes?

wise dawn
#

Steps 1 and 2 are regular client side setup ye

#

Should probably include that net46 is recommended

tepid pine
#

and why would that be?

wise dawn
#

@sour wolf had an issue with registernamedmesssgehandler, but it could have also been missing assembly reference

tepid pine
#

I see

#

I probably wouldn't add that on a one-off with unsure reasons but I'll keep it in mind

wise dawn
#

Yhyh

tepid pine
#

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

wise dawn
#

Wicked

#

Np

wise dawn
#

@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.

tepid pine
stoic star
#

Just want to say this was incredibly well written and helped me massively. Thank you for taking the time to make this!

wise dawn
#

<33

stoic star
# wise dawn <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

wise dawn
#

Can you show your Config file

stoic star
#

Do you want me to send all the request/receiver methods & join/leave patches too?

wise dawn
#

no they are likely fine. maybe you are hitting the return ?

stoic star
#

Oh i see in my patch for the instant landing code

wise dawn
#

this could end the function before checking instant landing

stoic star
#

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

wise dawn
#

Can you not use 2 lan instances?

stoic star
#

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

wise dawn
#

I usually just get them both in, change the config and reboot & rejoin on the client

stoic star
#

Ill try this out

stoic star
wise dawn
#

Thats odd. Have you confirmed through logging that syncedInstantLanding is not what its supposed to be?

stoic star
#

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.

stoic star
#

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

wise dawn
#

Do you have a github repo I can take a look at?

stoic star
#

I do not unfortunately. I could set one up a little later

wise dawn
#

send over a dll for now, ill decompile

wise dawn
#

@tepid pine bro went AWOL on the PR

tepid pine
#

@wise dawn I'll go fix the shit now ๐Ÿ˜ญ

wise dawn
#

damn right. no sleeping on the job ReallyMad

#

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
tepid pine
#

bro why is vscode being a bitch ๐Ÿ˜ญ

#

why does it not work on my project but a fresh vscode terminal does?!???!??!

tepid pine
#

@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

tepid pine
#

@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");
}
wise dawn
tepid pine
#

got it

#

you can come in vc a do a once-over of my preview deployment of the site if you want

#

@wise dawn \

tepid pine
wise dawn
wise dawn
#

This guide is now also documented on https://lethal.wiki HYPERS

Big thanks to @tepid pine and @silver pelican.
Hopefully this helps some peeps since its quite a common case.

tepid pine
sullen narwhal
#

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 ๐Ÿค”

sullen narwhal
sullen narwhal
#

Fixed it by changing the MessageManager.SendNamedMessage within OnRequestSync to MessageManager.SendNamedMessage("ModName_OnReceiveConfigSync", clientId, stream, NetworkDelivery.ReliableFragmentedSequenced)

wise dawn
#

Glad you solved it. I will add it to the troubleshooting section

#

Weird that it has to be fragmented

sullen narwhal
wise dawn
#

I may just edit the code to only fragment past the max packet size

wise dawn
wise dawn
#

in that case I should definitely edit the code

wise dawn
#

Gist updated. I may PR lethal wiki at some point

silver pelican
wise dawn
wise dawn
#

Works like a charm in NET 4, but requires every property (if using private setters) to have [DataMember] attribute. saj

wise dawn
wise dawn
#

ah ye

#

thats how i have mine locally

#

ty

sullen narwhal
#

๐Ÿ‘Œ

wise dawn
wise dawn
wise dawn
silver pelican
silver pelican
#

protobuf would probably be a pain though

wise dawn
#

Oh it does

#

can it deserialize without attributes?

#

lemme cook rq

silver pelican
#

it should be able to if you use properties

wise dawn
#

Yeah.. im not so sure about Newtonsoft

#

in theory it sounds better, in practice its not rly worth it over DataContractSerializer

sullen narwhal
#

since both return the same value

wise dawn
sullen narwhal
#

Size of stream: 6560, max buffer size: 6560

wise dawn
#

why is maxcapacity changing monkaHMM

#

dumbah unity

wise dawn
#

๐Ÿ‘

sullen narwhal
wise dawn
#

I will get on with that

#

that PR isnt going anywhere for a while yet

honest mantle
#

I wouldn't say that...

wise dawn
# honest mantle 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

honest mantle
#

Yeah; I'll take a look since Bobbie's out on a trip rn

wise dawn
wise dawn
#

@honest mantle In the meantime, it may be best to pull the syncing section from the wiki

honest mantle
#

yeah I'll remove it from the sidebar and add a warning on the page in case anyone's linked to it

wise dawn
#

I also noticed that harmony uses BinaryFormatter ๐Ÿ’€

honest mantle
#

really?

honest mantle
#

if you update the pr I'll take a quick glance over it and send it through

wise dawn
#

nevermind

#

wait no i wasnt schizo

#

it does fucking work

wise dawn
#

@honest mantle would it be ok to make the config syncing guide use CSync now its released?

honest mantle
#

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.

wise dawn
#

So provide the guide to do it manually, but link it at the top?

honest mantle
#

yeah

#

the only exception to that are developer tools; specifically things like BepInEx, MelonLoader, Harmony, Monomod, or NetcodePatcher

wise dawn
honest mantle
#

kk, I'll take a look when I have the chance (and if I remember)

wise dawn
#

@honest mantle ๐Ÿ’ค

honest mantle
#

lmao okay, ping me in a few hours, working on something quickly before I have to go for a few

wise dawn
#

just add me to collaboraters mhm

honest mantle
#

not something I can do boiled

wise dawn
wise dawn
#

@honest mantle PauseChamp

honest mantle
#

lmao good thing you reminded me

wise dawn
#

lol impressDerp

#

there is some deadlink warning in the build

#

idk how vitepress works

honest mantle
#

lmao yeah

#

I'll make comments on them

wise dawn
#

weird bc npm run dev was fine

honest mantle
#

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)

wise dawn
#

ohhh

#

i mustve been sleepy

#

i literally just missed /apis/

honest mantle
wise dawn
#

Is the CC bit not the original line?

honest mantle
#

don't think so

#

(unless I just misread)

#

also love the commit names

wise dawn
wise dawn
#

@honest mantle isn't it bad practice to have something up on the wiki that is prone to RCE ?

#

also ConfigEntry cant be serialized

honest mantle
wise dawn
#

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

honest mantle
#

hmmm

#

let me get back to you on this, will have to discuss with the other maintainers

honest mantle
wise dawn
#

Will do

wise dawn
#

@honest mantle idk what u mean by "update", but I have removed CSync from the syncing PR and made a seperate one.

fringe rain
#

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

wise dawn
#

although aina was thinking of locking of some sort so idk yet

fringe rain
wise dawn
#

Thats odd, bc LC should apply the changes to the file, which is then used to sync on join

fringe rain
#

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.

wise dawn
#

It shouldn't.

#

Are you patching correctly and gone through troubleshooting?

fringe rain
#

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.

wise dawn
#

My testing with LethalConfig was fine

fringe rain
#

I'll test it again to double check and maybe record

wise dawn
#

ofc, if you change settings after joining on either end

#

there will be desync

fringe rain
#

Yeah that makes sense. As mentioned, it's before joining.

#

All settings changes are after launch, before join/host.

wise dawn
#

Unless you are on a pre 1.0.7 version, I can't guess at all what it would be

fringe rain
#

1.0.7 NodPopuko

#

I'll double check to save you the trouble. If I replicate it as expected, then I'll record it as well.

wise dawn
#

ty

fringe rain
#

@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.

wise dawn
#

instead of LC

#

just to confirm its an incompatibility and not CSync itself

fringe rain
wise dawn
#

do as you did but with the file instead of lc

fringe rain
#

Aight

#

Need to do that a bit later. Eating now.

wise dawn
#

nw

fringe rain
#

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.

wise dawn
#

@honest mantle somehow csync ended up under LethalLib lmaoo

#

thats what i get for not npm run dev on the new pr

honest mantle
#

make a fix pr and I'll approve

wise dawn
#

yuh

wise dawn
honest mantle
#

kk

wise dawn
#

sry for all the mistakes. had to reinstall my OS throughout the past few days

#

fucking drive died

honest mantle
#

also can you rebase your branch off of the latest master?

wise dawn
#

yuh

honest mantle
#

currently has merge conflicts since it's trying to add the same things you added last time

wise dawn
#

finally installed NPM lol

#

its ready @honest mantle

#

ty

#

pnpm gang tho baseg