November 22, 2017, 06:55:30 AM

Author Topic: Community patcher  (Read 2223 times)

GothikX

  • Newbie
  • *
  • Posts: 11
    • View Profile
Community patcher
« on: September 12, 2016, 05:56:12 AM »
Helloes!

So I opened Visual Studio and hit my face against the keyboard a few times, and out came a program that will patch the windows version of the game to fix the crash that occurs when deconstructing a steam engine.

You can find the result at https://github.com/GothikX/GnoPatch and I encourage you to try it if you're bothered by your multitude of steam engines you can't demolish. (you can get just the early access executable from the releases page)

If however you're experiencing another rage inducing crash, and by chance you have a savegame that can help in reproducing that crash (or precise instructions that reliably reproduce it), please let me know here and I'll make an effort to torture my keyboard some more, and maybe it will enhance the patcher to fix more issues.

That is all.

Cheers!

GothikX

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Community patcher
« Reply #1 on: September 12, 2016, 05:59:28 AM »
Note: I tried reproducing a few other issues I saw around, and couldn't. Clicking on a goblin tunnel did nothing for me, but I suspect it's highly dependent on where exactly it spawns (and on top of what). I can deconstruct pumps just fine. And I have no saves that crash on load.

I am currently hunting for an elusive crash related to stockpiling and wheelbarrows/sacks, but it happens rarely so it may take a while.

Merry76

  • Moderator
  • Hero Member
  • *****
  • Posts: 3448
    • View Profile
Re: Community patcher
« Reply #2 on: September 14, 2016, 09:17:32 AM »
This makes your face hitting the keyboard a better programmer than I am. Now I feel kind of sad, and happy at the same time  ;)
Have a problem or a fortress so awesome it needs to be shared?

Well, go on, dont be shy! Use the GnomeworldPool Dropbox account!
How to share Savegames

Tacyn

  • Full Member
  • ***
  • Posts: 224
    • View Profile
Re: Community patcher
« Reply #3 on: September 15, 2016, 10:57:04 AM »
Would you be willing to also take a look at bugs that only occur in modded games?

I would, but I can't promise anything, some issues may be simply too time consuming to come up with a patch for :P

Edit: I now have things set up so that I can debug issues muuuuch more easily, so I'm willing to tackle even difficult stuff. Go on Tacyn, throw something my way! Your mod is awesome, btw.

I'll take you up on that.
Let's start with piles, e.g. resource (raw stone and soil), straw, ammo and silica. Pretty much any deviation from the vanilla piles is bugged.
From least to most annoying:

1.  Items that go into piles always use the pile sprite, even if there is just a single item. 

2. Piles always need to also be a transport container. Otherwise their content becomes inaccessible.

3. If an item is defined to be store-able in a pile and a container, e.g. crate, those items in the container become inaccessible.

4. If a workshop produces items that belong into piles, those sometimes bug out creating inaccessible phantom items which disappear again on saving and loading.
I don't know exactly how this triggers, since it seems to not happen with ammo and silica in vanilla.

If I have time later, I'll try to produce some mods/savegames  that show these bugs.


GothikX

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Community patcher
« Reply #4 on: September 15, 2016, 11:04:17 PM »
Uhhh... yeah, sure, this doesn't sound daunting at all :P

Changing a sprite display behavior might not be a big deal but 1. sounds like much more than that. A single item stored in a stockpile probably always gets turned into a container before storage. Changing that would require changing plenty of other places, and any additional place raises the chance I could introduce bugs...

2. How is that a problem? Piles are sort of like transport containers, so I wouldn't be surprised if they're programmed in similar ways. What would you change?

3 and 4. I'd need a way to reproduce these since I don't know much about modding, but since there are multiple systems involved they also sound like a chore to fix...

Perhaps I need to invest some time first in improving the patching tools - or rather automate the actual production of the patch, but debugging the actual game is also slow and I see no way of speeding that up until I've learned the codebase better. I was hoping to start off with something easier, like the steam engine deconstruction bug was, but I'll dig in as soon as I'm able to. Can't really dedicate a lot of time to this, so as long as you don't expect miracles we're good :)

Tacyn

  • Full Member
  • ***
  • Posts: 224
    • View Profile
Re: Community patcher
« Reply #5 on: September 16, 2016, 02:30:37 PM »
Don't worry. I'm mainly just venting frustration since Robobob's disappearance means that that these things likely won't get fixed.

Changing a sprite display behavior might not be a big deal but 1. sounds like much more than that. A single item stored in a stockpile probably always gets turned into a container before storage. Changing that would require changing plenty of other places, and any additional place raises the chance I could introduce bugs...

It's not just inside piles. Even right after appearing items already appear as pile.
However, when it's being carried, the proper item-sprite appears.

2. How is that a problem? Piles are sort of like transport containers, so I wouldn't be surprised if they're programmed in similar ways. What would you change?
You should try it out and see what happens.
The gnomes go kinda crazy; they never pick up the items and instead just keep walking to an empty spot in the nearest stockpile.
They show the same strange behavior for 3.

Number 4 is definitely difficult, but maybe there is something obviously wrong.
I'd probably look how new items are generated from workshops, farms and mining.
Since the bug doesn't happen with straw and stone, any difference compared to workshops could be the culprit.


While I'm at it, here's another big one for me.
I remember that in the past, more enemy kingdoms would appear similar to merchant kingdoms.
I don't know if it was with growing kingdom value or passed time, but apparently this is bugged/was removed.
If the code is still there, maybe you can reactivate this feature.


 


GothikX

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Community patcher
« Reply #6 on: September 16, 2016, 04:21:55 PM »
I remember that in the past, more enemy kingdoms would appear similar to merchant kingdoms.
I don't know if it was with growing kingdom value or passed time, but apparently this is bugged/was removed.
If the code is still there, maybe you can reactivate this feature.

That's a fairly easy one. The code explicitly only allows FriendlyCiv to spawn over time, I can add EnemyCiv to the condition and make it an optional item in the patcher. What's EnemySmall tho, any ideas? Should that be included in the condition as well? This would make the civ that appeared random, with a greater weight towards friendly ones since I imagine each friendly civ type (agricultural/merchant etc) has its own faction def.

I'm still looking at the other ones, reading the code and trying to figure out how it all fits together, maybe I can spot something obviously going wrong, but it's slow going since most of the variable and method names are gone, they'd have given me valuable hints.

Tacyn

  • Full Member
  • ***
  • Posts: 224
    • View Profile
Re: Community patcher
« Reply #7 on: September 17, 2016, 12:57:24 AM »
That's a fairly easy one. The code explicitly only allows FriendlyCiv to spawn over time, I can add EnemyCiv to the condition and make it an optional item in the patcher. What's EnemySmall tho, any ideas? Should that be included in the condition as well? This would make the civ that appeared random, with a greater weight towards friendly ones since I imagine each friendly civ type (agricultural/merchant etc) has its own faction def.

Having an Enemy spawn instead of a friendly civ would probably be frustrating.
I imagine that is the reason it was turned off.

One way would be to have the two separate or have at most one spawn of each enemy civ.

The best for me, would be to have each enemy civ spawn around the same time, but at greater distances.
On normal, for example, with one enemy  they have a 3 day distance.
With two they should be 6 days away, with three it's nine days and so on.
Even better if each spawns 3 days after the previous one.
That way you'd still get attacked every ~3 days, but there would be greater variation in the attackers.
I'm mainly thinking about my enemy kingdoms mod, which works best under these conditions.

« Last Edit: September 17, 2016, 01:41:29 AM by Tacyn »

GothikX

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Community patcher
« Reply #8 on: September 17, 2016, 10:09:13 AM »
The best for me, would be to have each enemy civ spawn around the same time, but at greater distances.
On normal, for example, with one enemy  they have a 3 day distance.
With two they should be 6 days away, with three it's nine days and so on.
Even better if each spawns 3 days after the previous one.
That way you'd still get attacked every ~3 days, but there would be greater variation in the attackers.
I'm mainly thinking about my enemy kingdoms mod, which works best under these conditions.

Am I right in saying right now it picks one of the enemy factions at random? You can define multiple enemy factions right? Like I said I don't know all that much about modding.

The only problem is you could potentially get attacked by multiple enemies at the same time - the one 3 days away won't wait patiently until the one 6 days away has finished their attack, they operate on separate timers. I imagine the balance would be ruined. And adding code to make sure only one can attack at a time starts to sound like a full time job.

Tacyn

  • Full Member
  • ***
  • Posts: 224
    • View Profile
Re: Community patcher
« Reply #9 on: September 17, 2016, 10:19:05 AM »
Yes, you can define  multiple enemy factions , but it just picks one at random.

What I meant with balancing is the following:
If there are, for example,  three defined enemy civs, A, B and C,
then on the first day of the first summer A spawns 9 days away.
Then on the fourth day, B spawns also 9 days away.
Lastly on day seven of summer, C spawns; again  9 days away.

Generally, if the difficulty is set to attack every X days and there are Y enemy civs total,
then at the start of the fist summer, a new enemy civ spawns every X days Y*X days away.

GothikX

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Community patcher
« Reply #10 on: September 17, 2016, 11:08:59 AM »
Sure, I just hoped I'd get away without modifying the first auto-generated faction, so it would only make a difference if you played with mods :P

The goblin faction is generated at the start of the game (just not visible till later, and with a larger delay until attack), so it's not trivial to both change that and make sure the factions spawn as they should later. I'm starting to see double now when I look at code so I'll take a break. This is totally doable tho.

Tacyn

  • Full Member
  • ***
  • Posts: 224
    • View Profile
Re: Community patcher
« Reply #11 on: September 25, 2016, 04:13:21 AM »
Another thing you could try is underground pastures.
Maybe all it takes is to remove a check that prevents them.

GothikX

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Community patcher
« Reply #12 on: October 03, 2016, 04:48:35 AM »
Sorry about the prolonged absence, I've had all sorts of stuff to deal with and pretty busy with work. I've looked at the code a bit more now and then but didn't make any more real progress; I'll start digging again soon.

As for the underground pasture bit, the main condition for the pasture to be valid is it needs to be on grass. I can remove that easily enough, if you think that makes sense (although to also make the rectangle green when you make the designation I'd need to also modify a terrifyingly long and complex method, but I'm sure I can do it with some trial and error). I just tested it and it works. I'll need to build a bit of UI to the patcher so you can pick and choose which patches you want applied, I guess...

Thaarael

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Community patcher
« Reply #13 on: October 04, 2016, 01:02:35 PM »
Sorry about the prolonged absence, I've had all sorts of stuff to deal with and pretty busy with work. I've looked at the code a bit more now and then but didn't make any more real progress; I'll start digging again soon.

As for the underground pasture bit, the main condition for the pasture to be valid is it needs to be on grass. I can remove that easily enough, if you think that makes sense (although to also make the rectangle green when you make the designation I'd need to also modify a terrifyingly long and complex method, but I'm sure I can do it with some trial and error). I just tested it and it works. I'll need to build a bit of UI to the patcher so you can pick and choose which patches you want applied, I guess...

There are no real in game-reasons why pastures should be over grass only, since animals are fed with straw/seeds anyway, and I am ever sure there was moment when that restriction was lifted for few patches after Trough was introduced.
BTW., if you are meddling with pasture mechanics anyway, could you look at Trough, if it's possible to make it being able to empty without deconstructing?