nicymike / serflings

Serflings Remake Project
https://serflings.simpleguide.net/
26 stars 0 forks source link

Stock Issue #133

Open Jingles7 opened 2 months ago

Jingles7 commented 2 months ago

Hi, so pleased to find out about your Settlers remake after being a fan of original for 30 years. I have an issue from a game created in Settlers history edition where the stock/ warehouse has got stuck. Apparently the issue dates back to original amiga/pc version. I read in your issues log someone else had reported it and you'd added some optimisation to serflings to fix on load, but i tried this (copying the ubisoft save file across to the 64 bit stable version of serflings) but it's still stuck. Can provide save file if needed. Is there a way i can fix the save file by manually editing it? I don't know what program is needed to open it. Looking forward to playing serflings more and loving the zoom feature. Thanks.

Jingles7 commented 2 months ago

...it was the response to issue #23 i had read before, whereby the load process should now fix it, but it hasn't. I've just found out about issue #69. I hadn't heard about an activation settler before but that fits with what i did. As soon as the stock was created, i changed it to top value for goods in, and middle value for people neither in or out. It was a while until i noticed the stock was stuck. So, goods are still accepted but they aren't taken out for use in the settlement, and the goods can't be emptied either by changing the settings. The settings still work so that people can be set to go in, but they won't leave to work on things automatically. I can empty the Stock of people still though through the settings, but they just spill out in random directions as if there's no roads, and then rejoin the roads to find their way back to the castle. I had a memory that they used to empty the stock in a queue and walk immediately along the roads to the nearest stock/castle that was accepting people. It seems that although goods are stuck inside, the gold bars in there still count towards morale so at least that's good!

nicymike commented 2 months ago

Hi, thank you for describing the error. I guess you found another issue if my current fixes do not help. Please attach a save game and I will check the stock.

If you empty a stock, the settlers will always run in random directions. I think in Settlers 2 the settlers will stay on the road.

Jingles7 commented 2 months ago

Thanks. Save Game file attached. There are 2 stocks to the South West of the main castle. The top one of the 2 is the broken one. SAVE1.zip

nicymike commented 2 months ago

I checked your save file. You are running into a different issue where a wrong settler is assigned to the stock. You may enable the debug information by pressing F3.

image

As you can see there is a CARRIER (id 469) assigned to the stock. This is wrong because every stock must have an CARRIER_INVENTORY assigned to it and not just a CARRIER. I also checked the position of settler 469 and came up with a different location than the stock which is even worse.

image

Keep in mind: At the moment you can only see information about a carrier if the carrier is walking.

I will think about a solution to fix this situation. Do you have any ideas why this could happen in the first place?

Jingles7 commented 1 month ago

Hello, Thanks for looking into this. It took a bit of playing around, but I managed to replicate the issue in Serflings, save file attached.

The steps I took were, once the Stock was built, Settler 79 (Carrier) left the main castle to activate the stock, but before he reached it, I changed the stock people setting to the middle value (no people in or out). This caused Settler 79 (Carrier) to return to the main castle before getting to the Stock.

I then changed the stock people setting back to the top value of people in, but neither Settler 79 or any other activation settler was sent from the main castle. At this point there was still no "Assigned Settler" for the Stock.

One of the people manning a road near to the Stock was Settler 6 (Carrier). I then took one of the flags away from the road which caused Settler 6 (Carrier) to no longer be needed on the road, so he walked into the Stock as it was nearest to him.

This made him the first person to enter the Stock, and he therefore became the "Assigned Settler" as "Settler 6 (Carrier)". I then changed the Stock setting to all people out, so all of the people in the Stock left, which meant Settler 6 (Carrier) returned to the main castle along with the other unemployed people who had been created in the Stock after Settler 6 had "activated" it. I then made some new roads to the right of the main castle, and Settler 6 (Carrier) is one of the people you can find there in the save game.

So it seems the key is that because the intended activation settler 79 didn't reach the stock, the first person to enter it (Settler 6) effectively activated it.

I found though that when this "unintended" activation "Settler 6 (Carrier)" activated the stock, he wasn't renamed in the usual way to be assigned to it as "Settler 6 (Carrier_Inventory)". He just stayed as "Settler 6 (Carrier)". I ran a second test allowing the intended Settler to activate the Stock. He was called "Settler 79 (Carrier)" until he reached the Stock and activated it, at which point he was renamed and assigned to it as "Settler 79 Carrier_Inventory)". I think there's some additional code in there that prevents the "Carrier_Inventory" settler from leaving the stock when you send the people out, which explains how Settler 6 managed to leave the stock after activating it, as he was still classed as just a "Carrier".

I haven't done other tests, but I am wondering if there are other circumstances that would result in the wrong settler being the first to enter the stock and be assigned to it. For instance, if one of the Carriers on a road nearby was the first settler to enter by delivering some goods there. Hope all this helps!

Save.zip

nicymike commented 3 weeks ago

Thank you for your tests. I think you found the root problem of the issue. The carrier, which will be sent to activate the stock, should not return if you change the stock settings. And also no other settler should be able to activate the stock.

I think there's some additional code in there that prevents the "Carrier_Inventory" settler from leaving the stock when you send the people out, which explains how Settler 6 managed to leave the stock after activating it, as he was still classed as just a "Carrier".

Yes, you are right. The carrier for the inventory will not leave the stock even if sending people out.