Percedal / FS22_UpgradableFactories

FS22 mod that increase production chains efficiency
GNU General Public License v3.0
28 stars 8 forks source link

Multiplayer Support? #42

Open Fors3ti opened 1 year ago

Fors3ti commented 1 year ago

Hey Dude,

du you plan a Multiplayer Support?

Habe a nice day.

ornellino commented 1 year ago

HI, any hope for multiplayer support? Regadrs Andrea

Jenriksen commented 1 year ago

Hello @Percedal,

Perhaps you could shed some light on why this mod is not supported in multiplayer? Which problems have you run into if you have at all tried multiplayer enabling it? From what I can tell its a matter of changing modDesc.xml and doing initial test. Perhaps the community here could help if you listed some of the input needed in a separate issue?

Shad0wlife commented 10 months ago

I believe the production speed information would need to be synced between all players, the game doesn't do that by itself.

Shad0wlife commented 10 months ago

My friends are too busy to actually test this with me, so if somebody could test the following fork on multiplayer: https://github.com/Shad0wlife/FS22_UpgradableFactories/tree/multiplayer

(mind the "multiplayer" branch!) Things to test:

Jenriksen commented 10 months ago

I will see if I can gather friends for the test. Otherwise I might have to have my server join as a client.

SuperSid2007 commented 9 months ago

@Shad0wlife my friends and myself tried it on our server and everything seemed to be working except we got the upgrades for free it wasnt charging anyone

Shad0wlife commented 9 months ago

@SuperSid2007 Thanks for testing. I'll check why the money adding/deducting code doesnt work as intended in multiplayer. Maybe I need to get the farm ID where the money gets taken from from somewhere else.

Edit: so when testing in Multiplayer but alone it worked. So it seems to be an issue that happens when multiple players are active, which I cant really test currently.

SuperSid2007 commented 9 months ago

@Shad0wlife I meant to also state it was running on a dedicated server not sure if that makes a difference

bosshoss61 commented 9 months ago

es funktioniert zwar im Multiplayer aber wir haben alle Produktionen erweitert danach konnte man nicht mehr joinen auf dem Server. Wo dran könnte das liegen @Shad0wlife

Shad0wlife commented 9 months ago

@bosshoss61 Gibt es Fehlermeldungen in einer log (entweder client oder server)? Ich hab mit der Synchronisierungsfunktion nur geraten wie es klappen könnte, das kann durchaus noch nicht richtig so sein.

bosshoss61 commented 9 months ago

Also in normalen Lok war nichts aber in der serverlock war was aber haben wir leider nicht mehr die fehlermeldung da wir den Server wieder zurückgesetzt haben aber wir werden es noch mal probieren die Tage und dann werden wir dir das noch mal schicken @Shad0wlife

SuperSid2007 commented 9 months ago

I know we never got an error it just locked anyone from joining at 99% loaded and wouldnt go passed 29% synchronized

Shad0wlife commented 9 months ago

Ok, thanks. Then I probably messed up the sync somehow. I just dump all the upgraded factories towards the client that is joining. Really weird that there is no error in any log when it freezes up though.

bosshoss61 commented 9 months ago

Wird es denn für diesen Mod noch ein Update geben der diesen Fehler behebt weil es ist ja ein schöner Mod wenn ja würde mich freuen wenn der Fehler behoben wird und würde es denn noch mal ausprobieren @Shad0wlife

Shad0wlife commented 9 months ago

I plan on looking into this, yes, but I don't really have the option to investigate actively and have no real idea where to start, so it'll just have to be lots of trial and error.

Shad0wlife commented 9 months ago

I have a guess what it might be (the placement initializaton bot running dor clients, thus missing variables), but I still can't really test it. Maybe I'll try to make a debugging version with lots of log info messages for you guys to test and see where it hangs.

bosshoss61 commented 9 months ago

Okay kannst ja Bescheid sagen wenn du dieses Dokument da fertig hast oder den Mod dafür oder das umgeändert hast dann kannst du ja Bescheid geben dann testen wir das noch mal @Shad0wlife

DerTypDerBrennt commented 8 months ago

@Shad0wlife Ich hab zu dem Problem das man nach dem Upgraden nicht mehr joinen kann einen Error Code. Wir haben auch rausgefunden das man eine Fabrik platzieren kann und so lange sie nicht geupgraded ist auch ohne probleme joinen kann. Sobald man aber die Fabrik upgraded und leaved und dann neu joinen will geht es nicht mehr. Folgender Error wird angezeigt:

Error Running LUA method packetReceived. C:/Users/max12/Documents/My Games/Farming Simulator2022/mods/F522 UpgradableFactories/UpgradableFactories lua:317: attempt to call method sendEvent' (a nil value) 20231218200427_1

Shad0wlife commented 8 months ago

@DerTypDerBrennt ich hab einen moment gebraucht um zu schnallen was das Problem ist, aber es war ein dummer Programmierfehler glaube ich. Könntest du vielleicht nochmal mit dem aktuellen code testen? Ich will nicht garantieren dass dann magisch alles funktioniert, aber zumindest dieser Fehler sollte behoben sein. Die Fehlermeldung war auf jeden Fall schonmal extrem hilfreich, dankeschön dafür!

English for context: I think I know what the error was, a dumb programming mistake. With the current code on the multiplayer branch, it should not throw (this specific) error anymore.

DerTypDerBrennt commented 8 months ago

@Shad0wlife Ich teste das heute Nachmittag wenn mein Freund online kommt. Aber erstmal vielen dank das du so schnell geantwortet hast :D

Miikkeeyy106 commented 8 months ago

@Shad0wlife I wont be much help when it comes to code but I'm keen to get this on a server with friends so if anyone needs an able body to help test anything I'm happy to.

DerTypDerBrennt commented 8 months ago

@Shad0wlife Wir haben jetzt die neue Version getestet und es funktioniert so halb. Man kann jetzt joinen und die produktion wird mir als host auch auf level 2 angezeigt aber meinem freund der joint nicht. (Wenn die Produktion aber geubgraded wird, in diesem fall dann level 3 wird diese auch korrekt allen angezeigt) Die produktion wird aber trotzdem als level 2 gewertet und verbraucht auch dementsprechend produkte und produktionskosten. Also wird glaube ich nur noch die anzeige falsch übermittelt. Wir versuchen den Mod jetzt mal auf unseren richtigen Server zu packen. Ich berichte heute abend nochmal was der versuch ergeben hat.

DerTypDerBrennt commented 8 months ago

@Shad0wlife Wir haben den Mod jetzt mal auf den Server gepackt und er funktioniert genau so wie schon beschrieben. Einzige problem ist dass er nicht das level nach neu joinen anzeigt und man dadurch dann beim upgraden auch nur die gebühr für das level 1 upgrade bezahlen muss.

Shad0wlife commented 8 months ago

Ok danke schonmal. Sehr seltsam, eigentlich entscheidet der server final was er abzieht. Ich vermute in Wirklichkeit wirf trotzdem der volle Preis bezahlt? Naja, dieses problem kann ich nicht so einfach finden wie das letzte, das muss ich die Tage mal selbst ausprobieren, wenn ich einen "Assistenten" finde ;)

English for context: current Issue is that clients only see level one on the factories after joining (so the sync still doesn't work properly). Buying the upgrade them visually fixes the level. I don't really know what the issue is here, so I've got to test ur myself if I can manage to find another tester.

Miikkeeyy106 commented 8 months ago

@Shad0wlife I'm free for the next 4 hours or so if you need a person.

Shad0wlife commented 8 months ago

Thanks for the offer. I think I'll be busy today until the evening though, sorry...

DerTypDerBrennt commented 8 months ago

@Shad0wlife Moin, wir haben heute festgestellt das die Fabriken nach einem Server neustart nur so viel produzieren wie eine level 1 fabrik. Ich habe vergessen zu testen ob die Fabriken ihr level behalten haben nach dem neustart darum kann es sein das der server einfach die level zurück gesetzt hat. Bin mir da aber nicht so sicher. Ich hab vielleicht morgen zeit um dir beim testen zu helfen. Am besten schreibst du mich einfach auf Discord (@DerTypDerBrennt) oder falls es hier dm's gibt an.

Shad0wlife commented 8 months ago

Ok, das ist spannend, das speichern war seitdem wir das Koordinatensystem gefixt haben eigentlich nie ein Problem. Vielleocht macht ein Dedi Server da was anders

Shad0wlife commented 8 months ago

@Jenriksen @Miikkeeyy106 @bosshoss61 @SuperSid2007

A first prerelease that is multiplayer compatible: https://github.com/Shad0wlife/FS22_UpgradableFactories/releases/tag/v2.0.0.1-Multiplayer

Feel free to give me feedback if anything doesn't work as it should - especially on dedicated servers, it's not been tested there yet. I think I removed an issue that may have caused production levels to not load correctly already though.

Thanks so much for @DerTypDerBrennt for sticking with me for like 20 testing runs during the whole 9 hours of mental breakdown I had while making this work :D

DerTypDerBrennt commented 8 months ago

Quick update. The Mod only works on dedi servers if you dont restart the server. After a restart all industries are level 1 again.

Miikkeeyy106 commented 8 months ago

We have seen the same issue, on server restart it doesn't seem to store the upgraded levels.

Shad0wlife commented 8 months ago

We have done a first check, it seems the server somehow doesnt save the data correctly, the save file dor the productions ends up empty (even though the player farms have owned buildings, and they should all end up in the mods save file).

But we'll only start debugging the issue further after christmas.

AmericanGoku commented 8 months ago

Look forward to any more sort of progress on this. Farm I am on currently running into either having to buy 5+ production buildings to keep up with amount harvested and this mod seems to be the exact solution to our local server Multiplayer game

markus14051991 commented 8 months ago

Läuft der mod jetzt einwand frei im multiplayer oder gibs noch probleme

Shad0wlife commented 8 months ago

Im "normalen" multiplayer ja. Auf dem Dedi läuft es noch nicht. Ich hatte bisher noch keine Zeit da weiter dran zu arbeiten.

markus14051991 commented 8 months ago

hoffe das es bald was wird finde den mod mega geil

Shad0wlife commented 7 months ago

@markus14051991 @AmericanGoku @Miikkeeyy106 Fixed the issue. It was caused by there being multiple farms and eg. the first one not owning any productions. https://github.com/Shad0wlife/FS22_UpgradableFactories/releases/tag/v2.0.0.2-Multiplayer

Thanks again for @DerTypDerBrennt for testing!

reyollc commented 6 months ago

Hey, gibt es schon News zum Multiplayer Support auf dedizierten Servern?

Shad0wlife commented 6 months ago

Ja, siehe den Post vor dir. Da ist der Link zur funktionierenden Version. Viel Spaß!

reyollc commented 6 months ago

Vielen Dank, es funktioniert auf jedenfall :D Hat mich nur gewundert, weil auf offizieller Modseite noch "kein MP" Support steht

DerTypDerBrennt commented 6 months ago

@reyollc Da Shad0wlife nicht der Originale Mod ersteller ist wird das da auch nicht angezeigt. Das müsste dann der Originale Modersteller (@Percedal glaube ich ist das) machen.

Beastelson commented 5 months ago

@Shad0wlife What is the current status of the multiplayer options? We decided to add v2.0.0.2-Multiplayer to a (non-dedicated) server to play together with a friend, and upon reboot a day later the loading got stuck at 99%. We had to remove the mod in order for me to join the game again. Any idea as to what might went wrong?

Shad0wlife commented 5 months ago

I havent had any reports of issues with 2.0.0.2 yet.

If it is stuck at 99% then it is usually an isse while loading the map. There should be a log error when the script failed, that error could help finding the issue.

My tests and the guys I worked with all ran as intended so I currently have no idea on what could be the cause.

Shad0wlife commented 5 months ago

@Beastelson Alternatively, if there aren't any mods in there that are not on modhub, you could upload the save and give me a list of the mods needed, then I could test it myself.

invisible337 commented 2 months ago

Hello I tried every version but my game loading stuck at 99%

Shad0wlife commented 2 months ago

I don't know what causes that. Is there an error in your log?

cartienjoyer commented 2 months ago

2024-06-26 08:34 Error: Running LUA method 'onSaveGameLoadingFinished'. dataS/scripts/utils/MathUtil.lua(1100) : attempt to perform arithmetic on local 'y1' (a nil value)

Shad0wlife commented 2 months ago

Ok, I think I know what's going on. Did you have the "original" (modhub) version installed in that savegame? Because that savesthe wrong coordinates, and loading the mod save with my "new" version will break.

So PSA: If you used the modhub version in a save, delete upgradableFactories.xml in the save. Attention: you will lose all upgrades and get no money.

If I find the time, I might try to build a compatibility layer, that tries to fix old mod saves.

cartienjoyer commented 2 months ago

its working now

Shad0wlife commented 2 months ago

Great, I'll have to put that info with the download so people can know. Thanks for reporting it.