Difference between phase and turn?

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
Post Reply
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Difference between phase and turn?

Post by Lachu »

I prepared player-related counters ;patch, so I could probably selects between phase or turn end code

http://www.hostedredmine.com/issues/859061

But I need to add recalculation of world counters, when each player end moving, so I need to clarify difference between phase and turn, so calculations won't be done ,multiple times.

I suppose turn is related to single player end moving event, but phase about each player ends moving (done it's turn).
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Difference between phase and turn?

Post by Ignatus »

Code: Select all

Begin turn
  Begin phase 1
   Players of phase 1 moving
  End phase 1
  Begin phase 2
   Players of phase 2 moving
  End phase 2
End turn
See https://freeciv.fandom.com/wiki/Turn what happens at begins and ends (but some things were remade since 2.5). That's why I proposed field "event" for counters. May we call counters recalculation by the same function that invokes the corresponding Lua callback?
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Difference between phase and turn?

Post by Lachu »

Ignatus wrote:May we call counters recalculation by the same function that invokes the corresponding Lua callback?
I don't known exactly, what you mean. I think for AI better is do not use LUA, but I known nothing about programming AI, so I don't known making AI understand counters is doable.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Difference between phase and turn?

Post by Ignatus »

Lachu wrote: I don't known exactly, what you mean. I think for AI better is do not use LUA, but I known nothing about programming AI, so I don't known making AI understand counters is doable.
Yes, AI does not understand Lua. But it has a mechanism to see how much it needs some effect and from this value and reqs it deduces how much it needs things required by the effect. The multipliers, likely, are somehow veawed into the system, so that AI has an idea where to shift the slider. If counters math is simple enough, AI may decide as well what does it need to shift the counter towards a desired value.

My idea is that the events at which counter steps are decided (turn/phase ends, attacks, buildings built...) are basically the same as when we call script_server_signal_emit(), and why not to make this function also to iterate over event-updated counters bound to involved objects. This shows a way to explain to the AI desirability of Lua callback effects or influencing its behaviour otherwise: let's introduce virtual requirements and virtual effects that don't really work as game rules but AI counts as they do, and then make them dependent on counters affected by the events when we call callbacks.

E.g., in CivIII when an elite unit wins a combat, there is a probability that a Great Leader appears. We can make the same in Freeciv with action_started_unit_unit(Action attack, Unit elite, Unit target) + unit_lost(Unit target_or_elite, Player loser, string "killed") but AI won't know the additional advantage of sending an elite unit to the combat. But let's introduce a player-ranged counter that increases when the player's elite unit gets into a combat and decreases when it loses, and make a virtual effect that virtually increases the player's productivity at 500% for a while when the counter fills (main CivIII Great Leader purpose is quick finishing wonders), and the AI will have some right idea.
Lachu
Elite
Posts: 472
Joined: Sat May 04, 2013 2:19 pm

Re: Difference between phase and turn?

Post by Lachu »

I thnik I understood now. Progress has mechanism to use lua signals as requirements of effect. It uses signals tables/linked list, put signal name with parameters once called and clear this list once new turn appear. But I think we need to count counter, when lua event being fired, not once effect are calculated.

If it's true, I understood. I can work on this counters mechanism, but I must warn, I don't know how much time I will have (currently covid-19 world problem makes my boss close my work place, so I have free time, which I paid).
Post Reply