Making Space Monsters Cooler

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderators: Oberlus, Committer

Post Reply
Message
Author
User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: Making Space Monsters Cooler

#61 Post by eleazar »

OK, i got some of this stuff working and in SVN.

Gaian and Computronium Moon specials get a guardian, and solar trees reproduce.

I'm stuck on merging/growing the krill swarms however.
What's supposed to happen:
  • 2 or 3 krill_1 in the same system will create a krill_2 and then destroy themselves
    krill_1 in a system with asteroids have a 50% chance of creating a krill_2
    krill_1 have a 75% chance of moving

Code: Select all

effectsgroups = [
    	EffectsGroup
            scope = And [
		        System
		        Contains Source 
		        Number low = 2 high = 3 DesignHasHull name = "SH_KRILL_1_BODY"
            ]
            stackinggroup = "KRILL_1_ACTION_STACK"
            effects = [
		        CreateShip "SM_KRILL_2"
		        Destroy
		    ]
	    EffectsGroup
            scope = And [
                Source
		        ContainedBy Contains Planet type = Asteroids
            ]
            activation = Random probability = 0.5
            stackinggroup = "KRILL_1_ACTION_STACK"
            effects = [
		        CreateShip "SM_KRILL_2"
		        Destroy
		    ]

        EffectsGroup
            scope = And [
                Fleet
                Stationary
                Contains Source
            ]
            activation = Random probability = 0.75
            stackinggroup = "KRILL_1_ACTION_STACK"
            effects = SetDestination destination = And [
                System
                WithinStarlaneJumps 1 Source
                Not Contains Source
            ]
    ]       
Other questions that don't seem to be addressed by the effects wiki:
  • Can i merge monsters of the same type into a fleet? How?

    Can i make a sitrep message from an effects group? How?

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

Re: Making Space Monsters Cooler

#62 Post by Geoff the Medio »

eleazar wrote:krill_1 in a system with asteroids have a 50% chance of creating a krill_2

Code: Select all

EffectsGroup
    scope = And [
        Source
        ContainedBy Contains Planet type = Asteroids
    ]
    activation = Random probability = 0.5
    stackinggroup = "KRILL_1_ACTION_STACK"
    effects = [
        CreateShip "SM_KRILL_2"
        Destroy
    ]
What happens if you use that effectsgroup? It seems like it could work...
2 or 3 krill_1 in the same system will create a krill_2 and then destroy themselves

Code: Select all

EffectsGroup
    scope = And [
        System
        Contains Source 
        Number low = 2 high = 3 DesignHasHull name = "SH_KRILL_1_BODY"
    ]
    stackinggroup = "KRILL_1_ACTION_STACK"
    effects = [
        CreateShip "SM_KRILL_2"
        Destroy
    ]
That's probably not going to work as intended for several reasons...

1) Number matches things if the number of objects matching the subcondition is equal or more than low, and less than high. In this case, if you want to match 2 or 3, you'd want low = 2 high = 4. (This is a bit confusing...)

2) Number matches anything if the specified number of objects match the subcondition. The objects matching the subcondition are not necessarily the same objects being matched by Number... In this case, you're matching Systems that contain the source object, if there exist exactly 2 ships with the hull SH_KRILL_1_BODY in the universe. What I think you'd want to do is

Code: Select all

scope = And [
    System
    Contains Source 
    Number low = 2 high = 4 And [
        Ship
        ContainedBy And [
            System
            Contains Source
        ]
        DesignHasHull name = "SH_KRILL_1_BODY"
    ]
]
which matches the system that contains the source object if there is also 2 or 3 ships that have the indicated hull in the system that contains the source object.

3) Scope selects a System that contains the source object. You then use a Destroy effect, which will attempt to delete the system. I think you intended to delete the ships. What you'll need to do is create another effectsgroup that will match the ships themselves, and have the Destroy effect in that, but not the CreateShip effect. This means you can't really use a random chance for this sort of effect, as when one effectsgroup's random is true won't match when the other effectsgroup's random is true.
Can i merge monsters of the same type into a fleet? How?
No.
Can i make a sitrep message from an effects group? How?
Yes, there is an effect for that. It's discussed on this thread: viewtopic.php?p=46904#p46904

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: Making Space Monsters Cooler

#63 Post by eleazar »

OK, thanks... working on it.

I don't know how hard it would be, but error messages more specific that

Code: Select all

8/27/11 5:45:26 PM	[0x0-0x17b47b3].org.freeorion.FreeOrion[77310]	error at or after the indicated point on line 580:
8/27/11 5:45:26 PM	[0x0-0x17b47b3].org.freeorion.FreeOrion[77310]	Special
8/27/11 5:45:26 PM	[0x0-0x17b47b3].org.freeorion.FreeOrion[77310]	^
... would really help bug-fixing
What happens if you use that effectsgroup? It seems like it could work...
My bad, looks like that part really works. It's hard to get the interactions i want to observer, thus the desire for sitrep messages to tell me that something actually happened.

And SitRep messages called from the effects don't seem to work. My custom notifications received no error messages (eventually) but never appeared in the sitrep, nor when i colonized an ancient ruins planet.

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

Re: Making Space Monsters Cooler

#64 Post by Geoff the Medio »

eleazar wrote:What do you think about using a similar system for specials?
It would be fairly easy to add spawn rate, spawn limit, and location conditions for planet specials. specials.txt and planet_specials.txt could probably then be combined into one file, with spawning determined by those fields instead of which file the definition is in.
eleazar wrote:I don't know how hard it would be, but error messages more specific [...] would really help bug-fixing
It's probably possible, but probably somewhat complicated to set up, or at least time-consuming to figure out or implement. A trick to getting things working is to add change in small steps starting from something that works, so you can isolate what's causing the problem.
And SitRep messages called from the effects don't seem to work. My custom notifications received no error messages (eventually) but never appeared in the sitrep, nor when i colonized an ancient ruins planet.
The ancient ruins effectsgroups require Xenological Restoration to be researched first, I think. Adding this to the effects of the cultural archives produces sitrep messages each turn for me:

Code: Select all

                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_SHIP"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "text" data = "SD_DRAGON_TOOTH"
                    ]
                    empire = Source.Owner

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: Making Space Monsters Cooler

#65 Post by eleazar »

Geoff the Medio wrote:
eleazar wrote:What do you think about using a similar system for specials?
It would be fairly easy to add spawn rate, spawn limit, and location conditions for planet specials. specials.txt and planet_specials.txt could probably then be combined into one file, with spawning determined by those fields instead of which file the definition is in.
That would be handy. Putting in Gaian planets with a big hefty guardian ship made me realize that you really don't want these to appear in or next to your home system. I managed to make the gaian self-destruct if it is close to an inhabited planet before turn 1, but that feels kludgy, and more too the point control of which specials are common/uncommon becomes important when we start introducing more powerful specials.
Geoff the Medio wrote:
eleazar wrote:And SitRep messages called from the effects don't seem to work. My custom notifications received no error messages (eventually) but never appeared in the sitrep, nor when i colonized an ancient ruins planet.
The ancient ruins effectsgroups require Xenological Restoration to be researched first...
Yep, my bad. Ancient ruins sitreps work. But mine still don't.

Do i need to refer to the system in a more convoluted way? This is from the effects of a monster hull.

Code: Select all

effects = [
		        CreateShip "SM_KRILL_2"
		        Destroy
		        GenerateSitRepMessage
                    message = "EFFECT_MONSTER_SPAWNING"
                    parameters = [
                        tag = "monster" data = "SM_KRILL_2"
                        tag = "system" data = System
                    ]
                    empire = Source.Owner
		    ]
Eng stringtable:

Code: Select all

EFFECT_MONSTER_SPAWNING
A %monster% was spawned in %system%!

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

Re: Making Space Monsters Cooler

#66 Post by Bigjoe5 »

eleazar wrote:

Code: Select all

empire = Source.Owner
This may or may not be the cause of your problem. If you want to receive the sitrep message yourself, you should put "AnyEmpire" (I think that's it, at least...), or "1", since you as the player will probably be empire 1 when you're testing it. Also, you should probably make a building or tech to set the stealth of everything in the universe to 0, so you can actually see what's going on.
Warning: Antarans in dimensional portal are closer than they appear.

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

Re: Making Space Monsters Cooler

#67 Post by Geoff the Medio »

eleazar wrote:Do i need to refer to the system in a more convoluted way? This is from the effects of a monster hull.

Code: Select all

effects = [
		        CreateShip "SM_KRILL_2"
		        Destroy
		        GenerateSitRepMessage
                    message = "EFFECT_MONSTER_SPAWNING"
                    parameters = [
                        tag = "monster" data = "SM_KRILL_2"
                        tag = "system" data = System
                    ]
                    empire = Source.Owner
		    ]
Eng stringtable:

Code: Select all

EFFECT_MONSTER_SPAWNING
A %monster% was spawned in %system%!
Yes; you need to give it the ID number of the system to refer to in the SitRep message.

System isn't a reference to an object ID number... it's just some text (that elsewhere might be a valid condition, but a condition isn't expect here; an integer object ID is). So, when the code that generates the sitrep text tries to interpret it, it fails, and you end up with ERROR in the in-game sitrep (in my tests by adding to cultural archives) because it can't tell what object you're referring to.

What you need to do is refer to some object relevant to the effectsgroup you're writing, and get its ID number by referencing that property. If the target object is a system, you could probably just do Target.ID or Target.SystemID - I think both should work for a system. An alternative to keep in mind is to refer to the Source object, as in Source.ID or Source.SystemID.

You can't use %monster% though. This isn't a valid tag for substitution, so the text generation doesn't know what to do with the data text you (otherwise correctly) provided. For now, you probably want to use a %text% tag, which tells the sitrep generator to look up the specified stringtable entry and substitute it into the template string. Think won't make a clickable link, but will look OK.

The valid tags are (currently):

"text" - look up data as a stringtable entry and substitute. stringtable entry name is surrounded by quotes.
"tech" - link to the tech with the specified name. Name is surrounded by quotes.
"buildingtype" - link to building type. Name can be written in quotes, or can be referenced as in Target.BuildingType
"special" - link to special, name written in quotes.
"shiphull" - link to ship hull, name written in quotes.
"shippart" - link to ship part, name written in quotes.
"species" - link to species. Name can be written in quotes, or can be referenced as in Target.Species
"planet" - find a planet with the specified ID and make a clickable link to it. ID is specified by reference, like Target.ID (if a planet).
"system" - link to system with specified ID
"ship" - link to ship
"fleet" - link to fleet
"building" - link to building
"empire" - link to empire with the specified ID. ID is specified by reference, like Target.Owner
"shipdesign" - link to shipdesign with the specified ID. ID is specified by reference, like Target.DesignID (if a ship).

I'll need to think about making a %predefinedshipdesign% tag. It would also be good to have a way to specify more than one of a particular type of tag, which is currently impossible.
Bigjoe5 wrote:
eleazar wrote:

Code: Select all

empire = Source.Owner
This may or may not be the cause of your problem. If you want to receive the sitrep message yourself, you should put "AnyEmpire" (I think that's it, at least...), or "1"
That won't work. AnyEmpire can only be used in OwnedBy conditions.

Bigjoe5 brings up a good point though... there's no good way to specify which empires would receive such a sitrep message in general, when it's not just the owner of the target or source objects. Is there a good default behaviour that could be used when no empire ID is specified? Perhaps any empire that has visibility of the target object?

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: Making Space Monsters Cooler

#68 Post by eleazar »

Geoff the Medio wrote:
Bigjoe5 wrote:
eleazar wrote:

Code: Select all

empire = Source.Owner
This may or may not be the cause of your problem. If you want to receive the sitrep message yourself, you should put "AnyEmpire" (I think that's it, at least...), or "1"
That won't work. AnyEmpire can only be used in OwnedBy conditions.

Bigjoe5 brings up a good point though... there's no good way to specify which empires would receive such a sitrep message in general, when it's not just the owner of the target or source objects. Is there a good default behaviour that could be used when no empire ID is specified? Perhaps any empire that has visibility of the target object?
So, an i correct in understanding that there is currently no way for me to receive messages about monsters?
It won't let me omit the "empire =" line

Giving the message to those who have visibility sounds like a good default:
"A wormhole portal has appeared in the X system!"
Though it would probably be useful to be able to send messages to all empires:
"Tremors are felt through the very fabric of space and time. It seems that someone is building a time machine!" (tech victory alert)
ALSO:
many, maybe all of the monsters created by the effects have a health of 0, while the corresponding monsters spawned at the beginning of the game have their proper health.
Geoff in this post wrote:What you'll need to do is create another effectsgroup that will match the ships themselves, and have the Destroy effect in that, but not the CreateShip effect
Sorry, since trying to grok the scope that matched the ships makes my head spin futilely, i don't see how to adjust it to just match the ships.
On the plus side, i think that's the last thing i don't know how to do-- the rest of the stuff i want to do is straightforward iteration and polishing.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: Making Space Monsters Cooler

#69 Post by eleazar »

Well, looks like i got it part-way going. It works to reproduce when there are 2 small krill, but the following only seems to delete one of the small krill.

Code: Select all

EffectsGroup
            scope = And [
                DesignHasHull name = "SH_KRILL_1_BODY"
                Number low = 2 high = 3 And [
                    Ship
                    ContainedBy And [
                        System
                        Contains Source
                    ]
                    DesignHasHull name = "SH_KRILL_1_BODY"
                ]
            ]
            effects = Destroy
:arrow: Also i'm pretty sure now that all monsters created with effects have zero health.

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

Re: Making Space Monsters Cooler

#70 Post by Geoff the Medio »

eleazar wrote:It works to reproduce when there are 2 small krill, but the following only seems to delete one of the small krill.
Hmm... that looks like it should delete all ships in the universe that have the hull krill 1 body, if there are two ships in the source object's system that have that same hull. Not sure why it would only delete one of them...

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

Re: Making Space Monsters Cooler

#71 Post by Bigjoe5 »

eleazar wrote:Well, looks like i got it part-way going. It works to reproduce when there are 2 small krill, but the following only seems to delete one of the small krill.

Code: Select all

EffectsGroup
            scope = And [
                DesignHasHull name = "SH_KRILL_1_BODY"
                Number low = 2 high = 3 And [
                    Ship
                    ContainedBy And [
                        System
                        Contains Source
                    ]
                    DesignHasHull name = "SH_KRILL_1_BODY"
                ]
            ]
            effects = Destroy
:arrow: Also i'm pretty sure now that all monsters created with effects have zero health.
For your scope condition, I think you should be using something like:

Code: Select all

scope = And [
    Number low = 2 high = 999 And [
        ContainedBy Contains Source
        Ship
        DesignHasHull name = "SH_KRILL_1_BODY"   
    ]
    NumberOf 2 And [
        ContainedBy And [
            System
            Contains Source
        ]
        Ship
        DesignHasHull name = "SH_KRILL_1_BODY"
    ]
]
The NumberOf condition matches a specified number of the objects that are matched by the subcondition, whereas Number matches objects if there are an appropriate number of objects that match the subcondition in the universe. In other words, it doesn't match the objects within the subcondition - it just checks every object in the universe to see if there are enough objects that match that condition. If it's false, no objects will be matched for the scope. If its true, the scope will be whatever it would have been if the Number condition was not present. The Observatory building is a current example of the use of NumberOf.

The above scope condition should match exactly 2 ships with the hull "SH_KRILL_1_BODY" which are contained by the system which contains the source object, and which exist in the same universe as between 2 and 999 ships with the hull "SH_KRILL_1_BODY" in the same system as the source object.

Also, the following should do the same thing and should be faster, as far as I can tell, but Geoff can tell me if that's not correct:

Code: Select all

scope = And [
    Number low = 2 high = 999 And [
        ContainedBy Contains Source
        DesignHasHull name = "SH_KRILL_1_BODY"
    ]
    NumberOf 2 And [
        ContainedBy Contains Source
        DesignHasHull name = "SH_KRILL_1_BODY"
    ]
]
This leaves out ContainedBy System and Ship, so rather than checking all objects in the universe to see if they are contained by a system, then checking to see if they are contained by the same system that contains the source object, it just checks to see if they are contained by the same object as the source object, which should be a system anyway. Likewise, instead of checking objects to see if they are ships, then running another check on all ships, it should just check all objects once to see if they have the appropriate ship design (which means only ships will be matched by default).
Warning: Antarans in dimensional portal are closer than they appear.

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

Re: Making Space Monsters Cooler

#72 Post by Geoff the Medio »

eleazar wrote:So, an i correct in understanding that there is currently no way for me to receive messages about monsters?
It won't let me omit the "empire =" line
As Bigjoe5 noted, you could put a constant number in for empire =, "like empire = 1". I think you'd be empire 0 in a single player game, though, so try that as well.
Giving the message to those who have visibility sounds like a good default:
"A wormhole portal has appeared in the X system!"
Though it would probably be useful to be able to send messages to all empires:
"Tremors are felt through the very fabric of space and time. It seems that someone is building a time machine!" (tech victory alert)
Another alternative is to add an empire affiliation parameter to the GenerateSitRepMessage effect, which would let you specify whether how to use the empire ID specified with empire =. It could be just that empire, that empire's allies or enemies (when this is implemented), or any empire (ignoring the specified id). That wouldn't have the option to just show it to empires that can see the target object, though... Maybe that could be the behaviour if the affiliation and empire ID are omitted? That might be confusing though...

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: Making Space Monsters Cooler

#73 Post by eleazar »

Bigjoe5 wrote:For your scope condition, I think you should be using something like:
Yep, thanks, they both work for the deleting effects group.

User avatar
eleazar
Design & Graphics Lead Emeritus
Posts: 3858
Joined: Sat Sep 23, 2006 7:09 pm
Location: USA — midwest

Re: Making Space Monsters Cooler

#74 Post by eleazar »

I was worried that these monster effects were slowing things down.
On a 500 star galaxy it takes 4 min 45 seconds to calculate a turn This is with 0 AIs. If i commented out all the monster effects, it took the same amount of time, so at least it's not the monster's fault that FO is so slow.

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

Re: Making Space Monsters Cooler

#75 Post by Geoff the Medio »

eleazar wrote:On a 500 star galaxy it takes 4 min 45 seconds to calculate a turn
Are there any lines with "time:" in them in the server or client log? That is indicating how many milliseconds doing the described calculation takes. It can be useful for testing what arrangement of conditions is actually fastest, or isolating what is causing slowdown. For some effects-related stuff though, it only shows a line if the time taken is greater than 2 ms.

Post Reply