patchBattle for Wesnoth - Patches: patch #1666, Select the era AI by default if...

Show feedback again

patch #1666: Select the era AI by default if declared as default

Submitted by:  FAAB <faabumc>
Submitted on:  Sat May 8 01:47:09 2010  
Priority: 5 - NormalStatus: None
Privacy: PublicAssigned to: Dmitry K. <nephro>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Sat Aug 6 19:02:55 2011, comment #5:

nephro, can you take a look at this patch to see if it is useful to have or not ?

Iurii Chernyi <crab>
Project Member
Fri May 21 06:06:41 2010, comment #4:

Put the inline definition in the header file (full patch).
The previously posted patch is obsolete.

(file #9187)

FAAB <faabumc>
Project Member
Fri May 21 05:15:52 2010, comment #3:

This is the new version of the patch.

It basically a new implementation:
the AI definition in WML can now define a sort_order that allows the game to sort the list of available AIs before display.

The "default" AI algorithm is now the AI in the list having the highest sort_order (set to 0 if not present).

This patch only cares of the selection of the AI in the game creation list. Setting the "default" AI when droiding a side will be cared in a second step.

(file #9185, file #9186)

FAAB <faabumc>
Project Member
Thu May 20 03:58:35 2010, comment #2:

My implementation may have been oriented by my next idea that was having a faction AI that would fallback on the era AI.
However, I should have not let me influence by it as this is not in the scope of the current patch and there is no evidence that the current implementation of the patch will help anyhow to implement that idea.

So I will work on reduce the footprint of the patch by following your guidance of storing only the AI id and make no change in the get_default_ai_parameters.

In the meantime, I put in attachment the era I use to test the patch (select "Default+Nightmares" era in the game creation dialog). When turning a side to AI controller, the "default AI with curse formula" should pop-up in the AI selection widget (after the patch is applied).

(file #9179)

FAAB <faabumc>
Project Member
Wed May 19 18:35:14 2010, comment #1:

patch needs changes;

you must not touch default_config_ and configuration::get_default_ai_parameters() at all, since it is 'default fallback values for ai parameters, which are supposed to be always present, regardless of UMC'

note that you do not need to store 'config era_default_config_', since you store all the era AI configs anyway; just store the id of the default configuration and use it configuration::get_default_ai_algorithm()

also (not required, but will be a good thing to allow me to test quickly), please provide a separate attach with the test era.

Iurii Chernyi <crab>
Project Member
Sat May 8 01:47:09 2010, original submission:

If an AI has been developed for an era, it is likely that the owner intends to have that AI used by default when playing the era.
For example, when creating a game and allocating a slot to a computer player, the AI algorithm should then be set to the AI coming along the era.

To implement this, I have created a use_as_default property to be set in the [ai] key inside the [era]. When set to true (default=false) the era AI will be selected by default when allocating a slot in a game to a computer player.

NB: the droid command will still affect the standard default AI to the side. This case will be taken care of, a soon as the implementation in the patch is validated.

NB-2: the wiki has to be updated to list the new use_as_default property of the [ai] key. This will be done if the patch is accepted. That might require the creation of a entry for [ai] inside [era] tag description as currently only [ai] inside [side] is documented.

FAAB <faabumc>
Project Member


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #9187:  patch-era-ai-use-sort-order-2.diff added by faabumc (4kB - text/x-patch - Put the inline definition in the header file)
file #9185:  Nightmares_of_Meloen.tar.gz added by faabumc (799kB - application/x-gzip - New patch with modified era to test it)
file #9186:  patch-era-ai-use-sort-order.diff added by faabumc (4kB - text/x-patch - New patch with modified era to test it)
file #9179:  Nightmares_of_Meloen.tar.gz added by faabumc (799kB - application/x-gzip - UMC era defining a customized default AI)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by crab (Posted a comment)
  • -unavailable- added by boucman (Updated the item)
  • -unavailable- added by faabumc (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Aug 6 19:02:55 2011crabStatusIn Progress=>None
      Assigned tocrab=>nephro
    Fri May 21 06:06:41 2010faabumcAttached File-=>Added patch-era-ai-use-sort-order-2.diff, #9187
    Fri May 21 05:15:52 2010faabumcAttached File-=>Added Nightmares_of_Meloen.tar.gz, #9185
      Attached File-=>Added patch-era-ai-use-sort-order.diff, #9186
    Thu May 20 03:58:35 2010faabumcAttached File-=>Added Nightmares_of_Meloen.tar.gz, #9179
    Wed May 19 18:35:14 2010crabStatusNone=>In Progress
    Sat May 8 19:18:35 2010boucmanAssigned toNone=>crab
    Sat May 8 01:47:09 2010faabumcAttached File-=>Added patch-era-ai-use-as-default.diff, #9134
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup