the3dfxdude/7kaa

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

tmr83 opened this issue · 5 comments

tmr83 commented

7K62

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.

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.

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

  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.

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