Artificial Planet - r6423 (Source Code repository)

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Post Reply
Message
Author
User avatar
Cluesen
Space Floater
Posts: 42
Joined: Mon May 20, 2013 4:40 pm

Artificial Planet - r6423 (Source Code repository)

#1 Post by Cluesen »

Lines 1079 - 1982 destroy the building once it's complete.
Chances are the 'transform' effect fires before, but not guaranteed.
Seen in SVN 6416, but it's still in the code.
I suggest deleting these lines.
The beauty of travel is visiting foreign countries and meeting new people.
G.Khan
_______________________________________________________________________
All code provided is released under the CC-BY-SA 3.0 and GPL 2.0 or later licenses

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Artificial Planet - r6423 (Source Code repository)

#2 Post by Dilvish »

I take it your concern is that if the building were destroyed before the change type Effect fired, then perhaps the latter might not happen? All the building Effects get collected together before any of them execute; even if the building were destroyed before the planet type was changed that should (*edit:) not prevent the latter from happening. And we don't want to leave the planet stuck always being reset to barren making it immune to terraforming, so the building needs to be destroyed.

Did you see something happen in a game that made you think there was a problem here?
Last edited by Dilvish on Fri Sep 27, 2013 2:48 pm, edited 1 time in total.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Cluesen
Space Floater
Posts: 42
Joined: Mon May 20, 2013 4:40 pm

Re: Artificial Planet - r6423 (Source Code repository)

#3 Post by Cluesen »

Yes, happened to me that out of 5 artificial planets that finished in a turn 3 dissappeared.
After spendind 2k PP and 15 turns on each i was not amused...

[edit]
hmmm... I deleted the lines and see what you mean ...
I know these lines aren't new, but something made the transform effect fizzle for me 3 times.
My game is very advanced, turn 251, 90/100 systems colonized and theres like 1000 effects that fire every turn...
Maybe i can check with logging later.
[/edit]
The beauty of travel is visiting foreign countries and meeting new people.
G.Khan
_______________________________________________________________________
All code provided is released under the CC-BY-SA 3.0 and GPL 2.0 or later licenses

User avatar
Cluesen
Space Floater
Posts: 42
Joined: Mon May 20, 2013 4:40 pm

Re: Artificial Planet - r6423 (Source Code repository)

#4 Post by Cluesen »

This modification does the trick:

Code: Select all

BuildingType
    name = "BLD_ART_PLANET"
    description = "BLD_ART_PLANET_DESC"
    buildcost = 2000
    buildtime = 15
    location = And [
        Planet type = [Asteroids GasGiant]
        OwnedBy TheEmpire Source.Owner
        Not Contains Building "BLD_ART_PLANET"
    ]
    effectsgroups = [
        EffectsGroup
            scope = Contains Source
            activation = Not Planet type = Barren
            effects = SetPlanetType Barren

        EffectsGroup
            scope = Source
            activation = Planet type = Barren
            effects = Destroy
    ]
    icon = ""
The beauty of travel is visiting foreign countries and meeting new people.
G.Khan
_______________________________________________________________________
All code provided is released under the CC-BY-SA 3.0 and GPL 2.0 or later licenses

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Artificial Planet - r6423 (Source Code repository)

#5 Post by Dilvish »

Hmm, I suppose maybe some sanity checking is being done for each EffectsGroup, and if it can't find the Source anymore then it doesn't fire. Your solution, which effectively delays the building destruction by a turn, seems fine, but I'd like to wait for Geoff to weigh in here, about whether this could be due to sanity checking, and about the order of processing variance. If the order of processing EffectsGroups is really varying like your situation appears to indicate, then it seems to me like something we need to understand better (or at least I need to).
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Artificial Planet - r6423 (Source Code repository)

#6 Post by Geoff the Medio »

Dilvish wrote:...maybe some sanity checking is being done for each EffectsGroup, and if it can't find the Source anymore then it doesn't fire.
Not that I'm aware of. It might matter if the source object was referenced in the effect definition, but it doesn't appear to be in this case.
I'd like to wait for Geoff to weigh in here, about whether this could be due to sanity checking, and about the order of processing variance.
I don't see how it would be either. TargetSets should have pointers added in order of their object id.

User avatar
Bigjoe5
Designer and Programmer
Posts: 2058
Joined: Tue Aug 14, 2007 6:33 pm
Location: Orion

Re: Artificial Planet - r6423 (Source Code repository)

#7 Post by Bigjoe5 »

Geoff the Medio wrote:
Dilvish wrote:...maybe some sanity checking is being done for each EffectsGroup, and if it can't find the Source anymore then it doesn't fire.
Not that I'm aware of. It might matter if the source object was referenced in the effect definition, but it doesn't appear to be in this case.
I was under the impression that Destroy effects were always executed last regardless, so I don't see why even that would be a problem.
Warning: Antarans in dimensional portal are closer than they appear.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Artificial Planet - r6423 (Source Code repository)

#8 Post by Geoff the Medio »

Bigjoe5 wrote:I was under the impression that Destroy effects were always executed last...
Not actually, but for the purpose of this issue, yes. The effect itself is executed whenever the processing comes to it, but executing it just adds the object to a list of ids to destroy later. The list is processed and the objects actually destroyed in a separate step.

Post Reply