Heavy exploit/bug/nonsense at turn change

Various topics about the game, the website, or anything else Freeciv related that doesn't fit elsewhere.
User avatar
Corbeau
Elite
Posts: 1088
Joined: Mon Jan 13, 2014 11:13 pm

Heavy exploit/bug/nonsense at turn change

Postby Corbeau » Mon Feb 24, 2020 11:34 am

I can't really believe that this hasn't been reported so far, but I have been here for a while and I haven't seen the discussion so I'll post it.

The sequence of calculation at turn change is as follows:

1. Production points accumulate in each city.
2. Completed production materialises.
3. City Happiness calculated (might have changed because of what was produced.)
- if a population unit was made: population reduced by one and new tiles are chosen
4. Surplus food calculated.
5. City grain store accumulates surplus food (or loss of food).
- if rapture is taking place, population changes.
- if city did not rapture, population changes from grain store.
- - if population changed, new tiles are chosen.
6. Surplus trade is calculated.
7. Trade assigned to gold and science according to national tax rates.

This sequence produces two problems and all of them come from the fact that worker/tile reshuffling happens in the middle of this sequence. One is an exploit allowing a player to yield more tile resources compared to his city size and the other is a problem because the game is effectively preventing a player to exploit resources he may need, basically, making decisions for him.

1. The exploit.
For example, a city in Republic is about to produce a Migrant or a Settler. A mine on a nearby hill is worked on and gives 1/3/0 while a irr/road Grassland (3/0/2) nearby is not. With this sequence, production happens, unit is produced, city size changes and tiles are reshuffled automatically, ending at Grassland (for most food). In the end, the city has effectively produced 3/3/2 with one population point. If the city has more mines and Grasslands, multiply this with the "more".

The same thing happens when a city goes through rapture (if the ruleset allows rapture): you get both the production from the best production tile (if you have set it that way) and food and trade from the best food tile, effectively using more than one tile with one population/worker

2. The bug.
With this sequence, there is no way in hell you are ever going to get trade from goldmine or, in most cases, wine, on the turn when your city changes size, either by production, starvation, rapture or food growth (unless you use a governor, which is equivalent to blowing up your house in order to kill a mosquito). Simply, as trade comes last in this sequence: if the tiles are reshuffled, the game will decide that trade is not as important as food, remove workers from the goldmine and set them to produce food instead.


So, the game sets priorities for you which, in the first place, is not something that should be allowed to happen. Also, this "game deciding thing" is manipulated in the first example to produce unrealistic and unfair gains, and in the second example it produces senseless restrictions and penalties.

And all that has to be done to prevent this is to move the tile reshuffling to the end of the sequence so that it doesn't affect current turn change, but the next, as would make the most sense (because the numbers you have set and been watching and planning the previous turn should be there when the effect happens).

What would also be more logical is to move all the calculation to the first half of the sequence and the effects of the calculation to the end. Namely, something like this:

1. Surplus food calculated.
2. Production points accumulate in each city.
3. Surplus trade is calculated.
4. Trade assigned to luxuries, gold and science according to national tax rates.
---
5. Completed production materialises.
6. City Happiness calculated (might have changed because of what was produced.)
- if a population unit was made: population reduced by one and new tiles are chosen
7. City grain store accumulates surplus food (or loss of food).
- if rapture is taking place, population changes.
- if city did not rapture, population changes from grain store.
- - if population changed, new tiles are chosen.

Basically, the sequence of events within each half can be adjusted further if new problems arise, but there needs to be a clear line between calculation and effect.
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers, contains forum: http://longturn.net
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
* What Is Longturn?

Ignatus
Elite
Posts: 329
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Heavy exploit/bug/nonsense at turn change

Postby Ignatus » Mon Feb 24, 2020 10:10 pm

Actually, I knew abiut the trick from my teammates from LT49, that made me to dwell a bit in and write the article Turn... BTW don't know if it happens due to city radius changes.

One problem is that you can't calculate happiness without knowing precisely the size. As a result, happiness is recalculated for any size change, as well as any in-process rearrangement.

So if I understand your idea well and think it to the logical end, instead of believing that during TC the city passes through some consequent states, we take all output and changes from the state configured to the end of the turn and only then apply all changes?

User avatar
Corbeau
Elite
Posts: 1088
Joined: Mon Jan 13, 2014 11:13 pm

Re: Heavy exploit/bug/nonsense at turn change

Postby Corbeau » Mon Feb 24, 2020 11:10 pm

Ignatus wrote:So if I understand your idea well and think it to the logical end, instead of believing that during TC the city passes through some consequent states, we take all output and changes from the state configured to the end of the turn and only then apply all changes?

Yes. Because:

1. "Philosophically speaking", the changes are the consequence of "continuous state during the turn" (game-year or whatever): workers were harvesting, entertainers were entertaining etc. Those "continuous" activities of the city inhabitants result in the changes of the city status: growth, production etc.

2. Game-wise: the effect should be the consequence of the player's planning and actions during the turn, not of the computer's estimate of priorities that happens in the middle of the turn change where the player can't influence it.
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers, contains forum: http://longturn.net
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
* What Is Longturn?

Wahazar
Elite
Posts: 332
Joined: Mon Jul 02, 2018 1:49 pm

Re: Heavy exploit/bug/nonsense at turn change

Postby Wahazar » Sun Mar 01, 2020 3:50 pm

I agree with Corbeau, if I want to have workers arranged automatically for max food, I would use Prefer Food Governor,
if I'm setting workers manually , I expect that they stay on their positions (except one which was added/removed) if city change its size.
Augmented2 ruleset/modpack for freeciv2.6: viewtopic.php?f=11&t=91047

Ignatus
Elite
Posts: 329
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Heavy exploit/bug/nonsense at turn change

Postby Ignatus » Mon Mar 09, 2020 7:51 pm

The problem was already noticed by the developers before, even some workaround was drafted: HRM Task#771900

User avatar
Corbeau
Elite
Posts: 1088
Joined: Mon Jan 13, 2014 11:13 pm

Re: Heavy exploit/bug/nonsense at turn change

Postby Corbeau » Tue Mar 10, 2020 12:43 pm

Wahazar wrote:I agree with Corbeau, if I want to have workers arranged automatically for max food, I would use Prefer Food Governor,
if I'm setting workers manually , I expect that they stay on their positions (except one which was added/removed) if city change its size.

Automatic rearrangement of workers is not the issue here. It may or may not happen, as long as you have control over them. But the problem is that now it is happening in the middle of the Turn Change resolution with no way to influence it.
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers, contains forum: http://longturn.net
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
* What Is Longturn?

User avatar
Corbeau
Elite
Posts: 1088
Joined: Mon Jan 13, 2014 11:13 pm

Re: Heavy exploit/bug/nonsense at turn change

Postby Corbeau » Thu Apr 30, 2020 8:27 pm

More thoughts on this topic.

Apart from the two already described problems, there is the a third: in a multiplayer game, in order to keep competitive, you need to do a lot of micromanagement in order to abuse the exploit which may be fun for some people, but not so much for others. From the game perspective is is a time-spending trick that, once you master it - and there really isn't much to master - it becomes a repetitive chore that you must do.

Added to all this, here's a question: why does extra food disappear when city grows? This also requires repetitive micromanagement to be maximised and, once you've played a lot of games, you get slightly tired with it.

So, any chance a patch for those things appears?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers, contains forum: http://longturn.net
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
* What Is Longturn?

Ignatus
Elite
Posts: 329
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Heavy exploit/bug/nonsense at turn change

Postby Ignatus » Thu Apr 30, 2020 9:44 pm

Corbeau wrote:Added to all this, here's a question: why does extra food disappear when city grows? This also requires repetitive micromanagement to be maximised and, once you've played a lot of games, you get slightly tired with it.

So, any chance a patch for those things appears?

I hope HRM#839704 and HRM#839703 have something to do with it: one introduces CMA setting maximizing growth, the another relocates city management onto the server. Food can't exceed the granary capacity by design.

User avatar
Corbeau
Elite
Posts: 1088
Joined: Mon Jan 13, 2014 11:13 pm

Re: Heavy exploit/bug/nonsense at turn change

Postby Corbeau » Thu Apr 30, 2020 10:03 pm

Ignatus wrote:Food can't exceed the granary capacity by design.

Isn't "design" exactly what we are discussing here?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers, contains forum: http://longturn.net
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
* What Is Longturn?

nef
Hardened
Posts: 190
Joined: Mon Jun 25, 2018 5:01 pm

Re: Heavy exploit/bug/nonsense at turn change

Postby nef » Mon May 04, 2020 9:06 am

You should be grateful for what you do get. In Civ * (notably I & II) the shield box and the tech box are both limited in this way so that you lose the surplus when the box is full. Note that BOTH of these are actually city based, shields naturally but tech completion is done city by city.

Maybe the answer to this is to provide options - either in game.ruleset or directly as server options.