the3dfxdude / 7kaa

Seven Kingdoms: Ancient Adversaries - Go to the main source repository at https://sourceforge.net/projects/skfans/ for source code and builds
https://7kfans.com
Other
253 stars 71 forks source link

Town with only a spy rebels, but no rebellion happens. #252

Closed tmr83 closed 2 years ago

tmr83 commented 2 years ago

7K62

the3dfxdude commented 2 years ago

Well, I thought it was behaving as expected as spies don't rebel and I couldn't see how to reproduce this. The key piece of missing information, is that your spy was previously a worker. He got bumped out of the workplace (unintentional bug because he was a spy?) and then he didn't leave the town from another, more obvious bug, and at that point it shouldn't have mattered he was a spy. But two bugs make a right. The issue is primarily in Town::unjob_town_people(), which in 7k2 is better concerning the obvious bug, but there may still be spy accounting issues in that game.

So while trying to find the exact reason for this case, I found the obvious bug, and well, I realized fixing that opens a bit of a pandora's box regarding game balance, because fixing the problem will change the game behavior in a few places. I also now realize more on why the AI could be having trouble managing resources. So now I have to work on several things all due to one silly news item. In terms in game balance, it will likely get done anyway, because 7k2 fixes the issue in question, so if it was ok there, it's probably what should be done.

the3dfxdude commented 2 years ago

So I think the think_rebel() code while it is rewritten for 7k2, it has the same problem, not keeping proper accounting of where all spies are. But the other thing that affects game balance is done in an expected manner in 7k2, and that is probably what we will want to duplicate, with testing of course.

J-Moravec commented 2 years ago

Could you please expand on the game balance aspect and influence of other things? You have piqued my interest.

the3dfxdude commented 2 years ago

1) This bug is basically due to improper accounting of spies in firms stemming from the code in Town::think_rebel(). 7k2 seems to have a similar problem.

2) The other thing discovered is that Firm::resign_worker has a return value that might be needed only in one place, but everywhere else it is used, and used wrong (in most cases returning "0" is actually a completed resignation for in-town firm residents), causing things similar to the reported issue, masking the affect of what was supposed to happen. Having the incorrect usage in game has the possibility of lessening the effect of damage to workers the town in being attacked by an enemy or in an earthquake and more. Peasants are not affected by Firm::resign_worker, and will die at the expected (higher rate than worker, even if the game code currently prioritizes peasant death as a feature), which is the potential balancing issue that could affect AI but also human's game play depending on the play style. This return code does not exist in 7k2 due to the rewrite done on Towns and Firms... they realized it wasn't needed, and also cleaned up some of the dead code from early development in the same functions.

Issue 1 will be fixed for this report, which will prevent the 1-spy non-rebellion (very hard to trigger??) from showing up. Issue 2 I want to see what will happen when fixed in all the scenarios. If you'd like to speak more, let's talk in the forum.

the3dfxdude commented 2 years ago

I went ahead and merged the fix for this. Additional fixes will be done later. e1936f8d8da8416d7dce3322f81d48dadf83a83c