Can you help improve your favourite game? // GameLoss

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Can I help improve your favourite game? Dosn't look like

Post by cazfi »

Ĩmhotep wrote:
cazfi wrote:As I told in wiki discussion, freeciv-dev mailing list is the place for freeciv development discussion. Or, gna.org patch & bug trackers, actually. Any updates to tickets there will be automatically sent to mailing list, and mailing list traffic consist of almost solely of those ticket updates.
So, for specific requests or patches create gna.org ticket (so the discussion about it is properly tracked by the ticket), for more generic development discussion send mail to mailing list directly.
Mailing lists: http://gna.org/mail/?group=freeciv From the bar on top of the page you can switch to bug or patch trackers too.
Ĩmhotep wrote:If so, what is this forum, this thread, good for?
Forum is primarily for users. Life on freeciv-dev mailing list is often hectic enough so that developers have not much time to check what happens in wiki or forums (I know I had months between my forum visits at the old forums)
Ĩmhotep wrote:Why should I believe that those gurus or anyone else interested in advancing freeciv code are over there, purposefully ignoring any posts here or on the wiki?
Well, it's the official place for that kind of discussion, for starters. Though I have to admit that at the moment all the other developers are busy with other things, so I'm responsible of almost all the traffic to mailing list. Still, even I'm more likely to take time to answer coding questions there, in proper place, properly tracked for reference, than other places.
As for your questions here, I've noted them, but I've not been able to write proper answers from the top of my head. I'll give some answers when I'm next investigating that part of code. Again - if this was in gna.org ticket, say Bug: "AI not handling GameLoss units properly" I'd be reminded about the issue when ever I go ticket list back and forth, and would be more likely to do something about it.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Can you help improve your favourite game? // GameLoss

Post by cazfi »

Ĩmhotep wrote:I have some issues about the GameLoss, referring to version 2.4.99.
In the future, please tell the revision number too when referring to development versions.
Ĩmhotep wrote:1) When I lose my leader, my client just wont be able to interact with the server any more.
Maybe this feature is intended, but it seams especially strange when I am the only human player.
Is this a bug, or just an unintended feature?
It should be like any other way to lose game. With default settings you should at least get the entire map to see. There's know bug in this, though. With big map client cannot handle entire map coming in so fast (especially in local game where network speed is not limiting the dataflow).
Ĩmhotep wrote:2) When the GameLoss figure of an AI is killed, all the units, cities and everything else just vanishes as if it never had been.
It looks as if the enemy citizens, shocked by my victorious superiority, in total despair, take down their buildings, burn their cities and kill themselves.
Yeah, that's the simple removal of player. I'm not really sure how to improve this without losing meaning of GameLoss flag. What's the point if another AI player (which human player can then /take) just takes the place of "dead" player.
I would really like the GameLoss feature to be augmented, such that when the leader dies, there is civil war (I have proposed some 5 additional lines of code to do that), and some random events inspired from what can happen when a city is conquered to what can be gained by diplomatic action,. (BTW, why isn't it possible to get a (possibly incomplete or distorted) map from the enemy after conquering a city?).
Configurable behavior would certainly be welcome. Where you have made code proposal? I don't remember seeing such a patch.
3) I have violated the modpack Ancients to create a modpack of my own. To give future human players some incentive to take a risk, the leader is now a military unit with non-zero attacking strength,.
Not quite to my satisfaction, this works also for the Ai players. They go and send their leader forth into dangerous situations (AI has more understanding of language, the unit is called LEADER, not HIDER,
so he leads into battle instead of hiding behind city walls and drinking wine and having all kinds of private fun).
I grepped AI code for GAMELOSS, and it indeed seems to be mentioned in two places: hunters consider GameLoss units extra juicy targets, and AI rarely build GameLoss units to defend their cities. Check against not attacking with GameLoss unit should be easy to add, though.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: GameLoss and civil war

Post by cazfi »

Ĩmhotep wrote:When civil war occurs, the new AI plaer does not have a GameLoss figure.

If someone could give me a hint on where to start I would like to try fixing it.
This is certainly not as simple question as you seem to think. What's you use-case? Why should new player have GameLoss unit?

There's no new units created when civil war occurs, but current units are divided by the players. I understand that if you have defined your rules with the idea that each player always has Leader unit, this is not satisfactory. We may need to add another server setting similar to startunits to control which units are given to players always (I don't think it makes sense to always give "startunits")
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: GameLoss, AI and AIUNIT_DEFEND_HOME

Post by cazfi »

Ĩmhotep wrote:I did a little debugging to see what causes the AI Leaders to go out and take a fatal risk.

The unit_data->task was either None or Defend home, and, rarely, recover.
Defend home was also the state of the enemy hordes that swept against my borders..
A rather aggressive way to "defend home".

Is there anyone out there who can give me a hint on where to look, or possibly explain why "defend home" behaves in this way?
Well, I meant to check the code, but here I go by hunch instead: unit_data->task is used in some code paths only, and its value can be anything when it's not relevant and not correctly set.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: A question to the gurus

Post by cazfi »

Ĩmhotep wrote:A question to the gurus: does

Code: Select all

dai_military_rampage
actually perform a game action or is it just a virtual calculation of outcome?
Among other things, function header says that unit kills enemies and might die in there. It only returns wether rampaging unit died - not results of the hard work of selecting suitable target, nor how beneficial killing that target would be.
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: Can you help improve your favourite game? // GameLoss

Post by cazfi »

I'm sure you have checked the Development section links from the wiki mainpage, but just a reminder about the How_to_Contribute instructions:
http://freeciv.wikia.com/wiki/How_to_Contribute
Ĩmhotep
Posts: 18
Joined: Fri Feb 01, 2013 11:46 pm

Re: Can you help improve your favourite game? // GameLoss

Post by Ĩmhotep »

cazfi wrote:I'm sure you have checked the Development section links from the wiki mainpage, but just a reminder about the How_to_Contribute instructions:
http://freeciv.wikia.com/wiki/How_to_Contribute
This sure is the way to do it, but only after I am sure my code and patches are of decent quality,
not for a newbie like me who had only a few looks into the code.

I would not want the developers spending lots of time to cancel any silly changes of mine.

For example, the first version of "civil war on gameloss" had civil war each time a player was killed,
including barbarians. Especially, there was civil war even when there were no cities.

Each time a new ai-player was created, with no cities most of the time. And as each time a nation was used up,
the game soon run out of nations.
Ĩmhotep
Posts: 18
Joined: Fri Feb 01, 2013 11:46 pm

Re: Can you help improve your favourite game? // GameLoss

Post by Ĩmhotep »

cazfi wrote:
Ĩmhotep wrote:I have some issues about the GameLoss, referring to version 2.4.99.
In the future, please tell the revision number too when referring to development versions.
Where can I see the revision number?
cazfi wrote:
Ĩmhotep wrote:1) When I lose my leader, my client just wont be able to interact with the server any more.
Maybe this feature is intended, but it seams especially strange when I am the only human player.
Is this a bug, or just an unintended feature?
It should be like any other way to lose game. With default settings you should at least get the entire map to see. There's know bug in this, though. With big map client cannot handle entire map coming in so fast (especially in local game where network speed is not limiting the dataflow).
Ĩmhotep wrote:2) When the GameLoss figure of an AI is killed, all the units, cities and everything else just vanishes as if it never had been.
It looks as if the enemy citizens, shocked by my victorious superiority, in total despair, take down their buildings, burn their cities and kill themselves.
Yeah, that's the simple removal of player. I'm not really sure how to improve this without losing meaning of GameLoss flag. What's the point if another AI player (which human player can then /take) just takes the place of "dead" player.
Well, the nation is dead, the player lost. Any human player can always take one of the remaining AIs. Especially one of those without a GameLoss.
The new AI gets only half of the cities (and should have other damages, too. Some tech loss, for example).
And the player who caught the enemy leader should have some benefits, besides kicking out someone else.
cazfi wrote:
I would really like the GameLoss feature to be augmented, such that when the leader dies, there is civil war (I have proposed some 5 additional lines of code to do that), and some random events inspired from what can happen when a city is conquered to what can be gained by diplomatic action,. (BTW, why isn't it possible to get a (possibly incomplete or distorted) map from the enemy after conquering a city?).
Configurable behavior would certainly be welcome. Where you have made code proposal? I don't remember seeing such a patch.
It's not yet configurable, it only causes civil war up to now.
http://freeciv.wikia.com/wiki/Forum:Civ ... oss_figure
cazfi wrote:
3) I have violated the modpack Ancients to create a modpack of my own. To give future human players some incentive to take a risk, the leader is now a military unit with non-zero attacking strength,.
Not quite to my satisfaction, this works also for the Ai players. They go and send their leader forth into dangerous situations (AI has more understanding of language, the unit is called LEADER, not HIDER,
so he leads into battle instead of hiding behind city walls and drinking wine and having all kinds of private fun).
I grepped AI code for GAMELOSS, and it indeed seems to be mentioned in two places: hunters consider GameLoss units extra juicy targets, and AI rarely build GameLoss units to defend their cities. Check against not attacking with GameLoss unit should be easy to add, though.
I didn't find those places but I have found a reason why the AI carelessly attacks with the Leader. There is a function cost_stack that adds up the building costs to determine wether it is worth attacking. The build costs of the attacking unit are subtracted (assuming it gets lost). It does not take into account whether a unit is a gameloss. My leader happened to have build costs of only 10. Setting it to 99999 cured the symptoms.

But the real problem is that the AI should not only look at the build costs.
Ĩmhotep
Posts: 18
Joined: Fri Feb 01, 2013 11:46 pm

Re: GameLoss, AI and AIUNIT_DEFEND_HOME

Post by Ĩmhotep »

cazfi wrote:
Ĩmhotep wrote:I did a little debugging to see what causes the AI Leaders to go out and take a fatal risk.

The unit_data->task was either None or Defend home, and, rarely, recover.
Defend home was also the state of the enemy hordes that swept against my borders..
A rather aggressive way to "defend home".

Is there anyone out there who can give me a hint on where to look, or possibly explain why "defend home" behaves in this way?
Well, I meant to check the code, but here I go by hunch instead: unit_data->task is used in some code paths only, and its value can be anything when it's not relevant and not correctly set.
Here is the code I used for debugging:
in ai/default/aitools.c in function ai/default/aitools.c just before the unit_data->task = task;

Code: Select all

  //  if (unit_owner(punit)->ai_controlled && unit_has_type_flag(punit, UTYF_GAMELOSS)) {
  //  if (unit_has_type_flag(punit, UTYF_GAMELOSS))
 {
   log_normal("The %s of the %s has new task %s. Previous task was %s."
             , unit_rule_name(punit), nation_plural_for_player(unit_owner(punit)), 
             dai_unit_task_rule_name(task), dai_unit_task_rule_name(unit_data->task));
  } /* Imhotep DEBUG */

  unit_data->task = task;
The units switch from "None" to "Defend home" and back, sometimes switching to "Recover".
I never saw "Attack" and the only places I fond in the code are for diplomats and sea-units. Strange.

I haven't found out what makes the "Non" or "Defend home" units move forward. They definitely don't move just at random.
Ĩmhotep
Posts: 18
Joined: Fri Feb 01, 2013 11:46 pm

Re: GameLoss and civil war

Post by Ĩmhotep »

cazfi wrote:
Ĩmhotep wrote:When civil war occurs, the new AI plaer does not have a GameLoss figure.

If someone could give me a hint on where to start I would like to try fixing it.
This is certainly not as simple question as you seem to think. What's you use-case? Why should new player have GameLoss unit?

There's no new units created when civil war occurs, but current units are divided by the players. I understand that if you have defined your rules with the idea that each player always has Leader unit, this is not satisfactory. We may need to add another server setting similar to startunits to control which units are given to players always (I don't think it makes sense to always give "startunits")
When civil war splits an empire a new (ai-) player is created. If this player doesn't have a GameLoss but the others do, he has an unfair advantage.

I think in this case, all units with flag GameLoss that occured in "startunits" (and possibly those with "NoBuild", but no others) should be created along with the new palace.

Maybe for some modpacks it would even be a good idea to create whatever is necessary to have a Gov_Center, lest the new player may be doomed without.
Post Reply