SitRep states destruction of own ship by own mines

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.
Message
Author
User avatar
coCoKNIght
Space Squid
Posts: 67
Joined: Sun Jun 06, 2010 6:04 pm
Location: Basel, Switzerland

SitRep states destruction of own ship by own mines

#1 Post by coCoKNIght »

After pressing Turn, I noticed that an Outpost Base was ready, so I ordered it to colonize. After turn processing was complete, SitRep stated that he Outpost Base had been destroyed by my own mines, and the Outpost Base doesn't appear on the System anymore, but the target planet still indicates colonization is in progress. See attached screenshot.

v 0.4.5 f203162
Attachments
fo-sitrep-killed-by-own-mines.png
fo-sitrep-killed-by-own-mines.png (369.91 KiB) Viewed 1337 times

User avatar
coCoKNIght
Space Squid
Posts: 67
Joined: Sun Jun 06, 2010 6:04 pm
Location: Basel, Switzerland

Re: SitRep states destruction of own ship by own mines

#2 Post by coCoKNIght »

...And after pressing Turn again, the colony was not established, so the Ship really was destroyed by own mines...

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: SitRep states destruction of own ship by own mines

#3 Post by MatGB »

Weird. The Fortress also has mines and there have been a few glitches so my first guess is that the Fortress special is the problem not the mines code, but it could be either. I'm away for a few days, hopefully Sloth or someone can have a look, do you have a savegame?
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Vezzra
Release Manager, Design
Posts: 5489
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: SitRep states destruction of own ship by own mines

#4 Post by Vezzra »

It's definitely the fortress mines that did this, not your own mines. Look at the damage amount - fortress mines do 3 damage. The mine techs do 2, 6 and 14 damage.

This is the effectsgroup of the fortress special responsible for the mine effect:

Code: Select all

        EffectsGroup
            scope = And [
                Ship
                ContainedBy And [
                    System 
                    Contains And [
                        Source
                        Not OwnerHasTech name = "DEF_SYST_DEF_MINE_2"
                    ]
                ]
                Or [
                    OwnedBy affiliation = EnemyOf empire = Source.Owner
                    Unowned
                ]
            ]
            effects = SetStructure value = Value - 3
As the planet with the fortress special is currently unowned, the question here is what's the result of the "OwnedBy affiliation = EnemyOf empire = Source.Owner" condition? The owner is "no specific empire" - are empires considered enemies of that "owner" or not? If yes, that would explain the observed behavior.

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

Re: SitRep states destruction of own ship by own mines

#5 Post by Geoff the Medio »

Vezzra wrote:...the question here is what's the result of the "OwnedBy affiliation = EnemyOf empire = Source.Owner" condition? The owner is "no specific empire" - are empires considered enemies of that "owner" or not?
From here

Code: Select all

            case AFFIL_ENEMY: {
                if (m_empire_id == ALL_EMPIRES)
                    return true;
So every object is owned by an enemy of all/no empire.

User avatar
Vezzra
Release Manager, Design
Posts: 5489
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: SitRep states destruction of own ship by own mines

#6 Post by Vezzra »

That means all ships and monsters will suffer mine damage from a fortress special on an unowned planet. Shall we consider this as intended behavior or do we want to fix that? My personal preference would be the former.

However, now that I think of it, in one of my last test games there was a fortress guarded by a sentinel that definitely didn't suffer mine damage, which it theoretically should. Are space monsters considered ships?

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

Re: SitRep states destruction of own ship by own mines

#7 Post by Geoff the Medio »

Vezzra wrote:That means all ships and monsters will suffer mine damage from a fortress special on an unowned planet. Shall we consider this as intended behavior or do we want to fix that? My personal preference would be the former.
The fortress mine damage script scope is

Code: Select all

            scope = And [
                Ship
                ContainedBy And [
                    System 
                    Contains And [
                        Source
                        Not OwnerHasTech name = "DEF_SYST_DEF_MINE_2"
                    ]
                ]
                Or [
                    OwnedBy affiliation = EnemyOf empire = Source.Owner
                    Unowned
                ]
            ]
So it will act on unowned ships regardless of who owns the planet (unless the owner empire has the system defense mines 2 tech).
Are space monsters considered ships?
Yes. Or rather no, they ARE ships, not "are considered to be" ships.

User avatar
Vezzra
Release Manager, Design
Posts: 5489
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: SitRep states destruction of own ship by own mines

#8 Post by Vezzra »

Geoff the Medio wrote:
Are space monsters considered ships?
Yes. Or rather no, they ARE ships, not "are considered to be" ships.
Well, yeah, I know, internally they are ships. What I was wondering if in FOCS the condition "Ship" also matches monsters, or only non-monster ships. Because, if "Ship" matches monsters too, then why was that sentinel in my test game not damaged every round?

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

Re: SitRep states destruction of own ship by own mines

#9 Post by Dilvish »

Vezzra wrote:What I was wondering if in FOCS the condition "Ship" also matches monsters, or only non-monster ships. Because, if "Ship" matches monsters too, then why was that sentinel in my test game not damaged every round?
I was pretty sure the FOCS Ship condition matched monsters, and just reviewed the code to be sure-- it certainly looks to me like it does match. I just made a testgame, and verified that a Sentinel in a system with a Fortress was losing 3 SP per turn, so at least on my system it seems to be applying just fine. Are you really sure that the Sentinel in your test game was *not* getting damaged every round?

This does highlight that we should probably adjust the Fortress script so that it doesn't kill its own Sentinel.
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
Vezzra
Release Manager, Design
Posts: 5489
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: SitRep states destruction of own ship by own mines

#10 Post by Vezzra »

Dilvish wrote:Are you really sure that the Sentinel in your test game was *not* getting damaged every round?
Hm, now that you mention it... not 100%. I probably assumed that because I played this game well past turn 200, and the sentinel was still there.
This does highlight that we should probably adjust the Fortress script so that it doesn't kill its own Sentinel.
Yep, at least when unowned, it shouldn't affect monsters, or at least no immobile monsters.

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

Re: SitRep states destruction of own ship by own mines

#11 Post by Geoff the Medio »

Vezzra wrote:
This does highlight that we should probably adjust the Fortress script so that it doesn't kill its own Sentinel.
Yep, at least when unowned, it shouldn't affect monsters, or at least no immobile monsters.
Might make some sense for it to act on "allied" ships, if it's abandoned and possibly malfunctioning...

User avatar
coCoKNIght
Space Squid
Posts: 67
Joined: Sun Jun 06, 2010 6:04 pm
Location: Basel, Switzerland

Re: SitRep states destruction of own ship by own mines

#12 Post by coCoKNIght »

Ah okay, I didn't know this special puts mines on the system.
It's the first time I come across this special. When I started to read the rather long description I went like 'blah, blah, okay owning this planet gives a lot of defense bonuses' :wink:
I'd attach the save game but the most I can compress it (tar.xz) is to 1.7MB.
When the Outpost Base is built and you colonize right away, the planet with the fortress will be owned next turn.
If you press Turn and then colonize while the turn is being processed, you should get the same result as in the screenshot of the first post.
So I guess everything is working as expected except that maybe 'Cancel Colonization' should not be displayed and it would help to know who's mines are at work.

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

Re: SitRep states destruction of own ship by own mines

#13 Post by Dilvish »

Vezzra wrote:I probably assumed that because I played this game well past turn 200, and the sentinel was still there.
Ah, ok-- well, two relevant things-- it would take until ~ Turn 280 for the Sentinel to be killed by the mines even if working right, it looks like to me, but also, I think that the way it had been written an unowned monster would never actually be destroyed by the mines. Effects that reduce damage won't ever actually destroy an object by themselves, and the extra effect that does destroy the ships didn't have the extra language to apply to unowned monsters.

I think I've fixed this all now for the Fortress mines, but taking a glance at the various Mines techs it looks to me like there's a few places where they need to be fixed up, particularly regarding having the Destroy effects apply to unowned monsters. I'm hoping someone else will be willing to look through them more closely though to actually take care of that and test it out.

Geoff the Medio wrote:
Vezzra wrote:
This does highlight that we should probably adjust the Fortress script so that it doesn't kill its own Sentinel.
Yep, at least when unowned, it shouldn't affect monsters, or at least no immobile monsters.
Might make some sense for it to act on "allied" ships, if it's abandoned and possibly malfunctioning...
In some scenarios that might make sense. But at least in the main scenario here, the Fortress makes its own Sentinel to guard it, and it would defeat the purpose of it for the Fortress to kill it off. The exclusion could be more narrow so that other monsters could still be killed-- I would have no argument against that if someone wants to add those extra details to the main fix I just put in.
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
coCoKNIght
Space Squid
Posts: 67
Joined: Sun Jun 06, 2010 6:04 pm
Location: Basel, Switzerland

Re: SitRep states destruction of own ship by own mines

#14 Post by coCoKNIght »

Btw. In this game I have Mines 3. So this would make 14dmg, together with 3dmg from the fortress, the orange trooper should receive 17dmg, right? It's loosing 5 hull points a turn however...

wheals
Space Squid
Posts: 88
Joined: Sun Mar 24, 2013 3:56 pm

Re: SitRep states destruction of own ship by own mines

#15 Post by wheals »

Dilvish wrote:Effects that reduce damage won't ever actually destroy an object by themselves, and the extra effect that does destroy the ships didn't have the extra language to apply to unowned monsters.

I think I've fixed this all now for the Fortress mines, but taking a glance at the various Mines techs it looks to me like there's a few places where they need to be fixed up, particularly regarding having the Destroy effects apply to unowned monsters. I'm hoping someone else will be willing to look through them more closely though to actually take care of that and test it out.
Perhaps the simplest fix would be for effects that push the Structure below 0 to destroy it as well, and then the existing Destroy effects could be removed as well?
All my code and content provided herein or on GitHub is released under the GPL 2.0 and/or CC-BY-SA 3.0, as appropriate.

Post Reply