duplicate ai goals

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
vghetto
Posts: 166
Joined: November 2nd, 2019, 5:12 pm

duplicate ai goals

Post by vghetto »

Hi,

If a goal is defined for a side, then it will appear twice in the debug game inspector. anyone knows why?
And will this affect modify_ai action=delete goal?

Edit: How do I delete a goal anyway, what is the correct path?

I have [goal] name=protect_unit and the following didn't work.

Code: Select all

[modify_ai]
    side=8
    action=delete
    path=goal[protect_unit]
[/modify_ai]
Edit2: forgot to add id=protect_unit. that fixed it.
Last edited by vghetto on February 4th, 2020, 6:51 am, edited 1 time in total.

vghetto
Posts: 166
Joined: November 2nd, 2019, 5:12 pm

Re: duplicate ai goals

Post by vghetto »

I was working on my code and a modify_ai call straightened it out and removed the duplicates.
This might be a bug in wesnoth. You can try to reproduce it with Heir To the Throne. Start the first scenario on the hard difficulty and check the orcs goal. This is wesnoth 1.14.9 debian sid package.
httt.png

mattsc
Posts: 1166
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: duplicate ai goals

Post by mattsc »

Thanks for reporting this. I have confirmed that this happens for me as well in 1.14.11+dev (but not in 1.15.2+dev).

I also confirmed that the goal is actually duplicated, as opposed to simply being shown twice in the inspector. It seems to be present twice in the AI configuration table already, rather than the goal being created twice from a single config entry. It does not happen if a scenario is started as a test scenario. I also noticed that the cpp engine appears twice in the inspector as well, which might or might not be related.

I don't know what is causing this yet, and I do not have time to investigate right now. I'm just writing the above down in case somebody else might know what may be causing this. If not, I'll investigate more at some point.

vghetto
Posts: 166
Joined: November 2nd, 2019, 5:12 pm

Re: duplicate ai goals

Post by vghetto »

I noticed that the goals get duplicated if they were defined inside the [side] tags. They won't get duplicated if defined via [modify_ai]

User avatar
Celtic_Minstrel
Developer
Posts: 1654
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: duplicate ai goals

Post by Celtic_Minstrel »

Sadly, I don't have any idea what could cause this. Almost feels as though the [ai] tag is being parsed twice? But that doesn't make any sense. Did you ever get a chance to investigate this, mattsc?
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

vghetto
Posts: 166
Joined: November 2nd, 2019, 5:12 pm

Re: duplicate ai goals

Post by vghetto »

This doesn't seem to be applicable to goals only. The same thing is happening with the aspect facets.

This snipet defines aggression, passive_leader and avoid inside [side] and later on changes them with [modify_side]
Changes are done to the WML_Guide addon.

Code: Select all

        [side]
                type=Revenant
                name= _ "Darth Syntax"
                id=darth
                facing=sw
                side=2
                controller=ai
                user_team_name= _ "Bad Guys"
                # The enemy's gold goes up a lot as the level goes up.
                {GOLD 80 140 200}
                [ai]
                        aggression=0.2
                        passive_leader=yes
                        [avoid]
                                [and]
                                x=3
                                y=6
                                radius=10
                                [/and]
                        [/avoid]
                [/ai]
        [/side]

        [event]
                name=turn 6
                [modify_side]
                        side=2
                        [ai]
                                aggression=0.8
                                passive_leader=no
                                [avoid]
                                        [and]
                                        x=20
                                        y=1
                                        radius=2
                                        [/and]
                                [/avoid]
                        [/ai]
                [/modify_side]
        [/event]

Code: Select all

[aspect]
	engine="cpp"
	id="aggression"
	invalidate_on_gamestate_change=no
	invalidate_on_minor_gamestate_change=no
	invalidate_on_tod_change=yes
	invalidate_on_turn_start=yes
	name="composite_aspect"
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=0.2
	[/facet]
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=0.2
	[/facet]
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=0.8
	[/facet]
	[default]
		engine="cpp"
		id="default_facet"
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=0.4
	[/default]
[/aspect]
[aspect]
	engine="cpp"
	id="avoid"
	invalidate_on_gamestate_change=no
	invalidate_on_minor_gamestate_change=no
	invalidate_on_tod_change=yes
	invalidate_on_turn_start=yes
	name="composite_aspect"
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		[value]
			[and]
				radius=10
				x=3
				y=6
			[/and]
		[/value]
	[/facet]
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		[value]
			[and]
				radius=10
				x=3
				y=6
			[/and]
		[/value]
	[/facet]
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		[value]
			[and]
				radius=2
				x=20
				y=1
			[/and]
		[/value]
	[/facet]
	[default]
		engine="cpp"
		id="default_facet"
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		[value]
			[not]
			[/not]
		[/value]
	[/default]
[/aspect]
[aspect]
	engine="cpp"
	id="passive_leader"
	invalidate_on_gamestate_change=no
	invalidate_on_minor_gamestate_change=no
	invalidate_on_tod_change=yes
	invalidate_on_turn_start=yes
	name="composite_aspect"
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=yes
	[/facet]
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=yes
	[/facet]
	[facet]
		engine="cpp"
		id=""
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=no
	[/facet]
	[default]
		engine="cpp"
		id="default_facet"
		invalidate_on_gamestate_change=no
		invalidate_on_minor_gamestate_change=no
		invalidate_on_tod_change=yes
		invalidate_on_turn_start=yes
		name="standard_aspect"
		value=no
	[/default]
[/aspect]

mattsc
Posts: 1166
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: duplicate ai goals

Post by mattsc »

Just noting that vghetto reported this in Issue #4887 (thanks!) and that it is fixed now.

Post Reply