Nebula collapse and CreatePlanet

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

Moderators: Oberlus, Committer

Message
Author
User avatar
Sloth
Content Scripter
Posts: 685
Joined: Sat Mar 17, 2007 12:28 am

Re: Nebula collapse and CreatePlanet

#16 Post by Sloth »

Thanks Geoff. I did a quick test and got it to work.

The result is quite nice.

Code: Select all

EffectsGroup
            scope = And [
                System
                Object id = Source.SystemID
            ]
            activation = And [
                Size high = 3
                Random probability = 0.5
            ]
            effects = [
		CreatePlanet type = asteroids planetsize = asteroids name = "NEW_ASTEROIDS_NAME"
            ]

        EffectsGroup
            scope = And [
                System
                Object id = Source.SystemID
            ]
            activation = And [
                Size high = 3
                Random probability = 0.5
            ]
            effects = [
		CreatePlanet type = barren planetsize = small name = "NEW_PLANET_NAME"
            ]

        EffectsGroup
            scope = And [
                System
                Object id = Source.SystemID
            ]
            activation = And [
                Size high = 3
                Random probability = 0.5
            ]
            effects = [
		CreatePlanet type = asteroids planetsize = asteroids name = "NEW_ASTEROIDS_NAME"
            ]
became:

Code: Select all

EffectsGroup
            scope = And [
                System
                Object id = Source.SystemID
            ]
            activation = And [
                Size high = 50
            ]
            effects = [
                If condition = Random probability = 0.5
		effects = CreatePlanet type = asteroids planetsize = asteroids name = "NEW_ASTEROIDS_NAME"
                If condition = Random probability = 0.5
		effects = CreatePlanet type = barren planetsize = small name = "NEW_PLANET_NAME"
                If condition = Random probability = 0.5
		effects = CreatePlanet type = asteroids planetsize = asteroids name = "NEW_ASTEROIDS_NAME"
            ]
I will try to include some more possibilities and then create a new pull request.
All released under the GNU GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0 licences.

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

Re: Nebula collapse and CreatePlanet

#17 Post by Dilvish »

Geoff the Medio wrote:Other than the meter-effect restriction (though the problem with them remains), this should work now:
Sounds very good. I'm a bit under the weather right now and my brain seems to object to working much, so could you do me the favor of explaining the reasoning for the meter-effect restriction? If you are expecting the restriction to stick around long term then we should probably add some kind of error check for it into the Effect::Conditional constructor.
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: Nebula collapse and CreatePlanet

#18 Post by Geoff the Medio »

Dilvish wrote:...explaining the reasoning for the meter-effect restriction?
Meter accounting handles meter-modifying effects separately from other effects. The If/Else effect is not (at least presently) a meter-modifying effect, even if it contains one. Consequently, accounting doesn't properly handle any meter-modifications done within an If/Else effect execution.

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

Re: Nebula collapse and CreatePlanet

#19 Post by Dilvish »

Geoff the Medio wrote:Meter accounting handles meter-modifying effects separately from other effects. The If/Else effect is not (at least presently) a meter-modifying effect, even if it contains one. Consequently, accounting doesn't properly handle any meter-modifications done within an If/Else effect execution.
Ok, so at least theoretically, we could, for example, make another conditional effect, Meter_If, which would do the same thing but for meter effects, and it could be accounted for properly. That's obviously not a great sounding name, and there might be some other better solution, but it sounds like some sort of solution should be possible, at least.
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
Sloth
Content Scripter
Posts: 685
Joined: Sat Mar 17, 2007 12:28 am

Re: Nebula collapse and CreatePlanet

#20 Post by Sloth »

I've created a pull request for an updated version. Besides the scripting update it includes functional changes:

1. Added some more variations to the nebula collaps (tiny and inferno planets, gas giants).
2. Raised the size threshold for the collapse a little (because it was hard for a player to keep track of the nebula just before it becomes important).
All released under the GNU GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0 licences.

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

Re: Nebula collapse and CreatePlanet

#21 Post by Geoff the Medio »

Dilvish wrote:...make another conditional effect, Meter_If, which would do the same thing but for meter effects, and it could be accounted for properly.
Probably not necessary or really very helpful... the problem is more so in the wrapping code that checks if things are meter effects, and if so, does some extra stuff at different times. The SetMeter effect itself doesn't do much different as far as I recall.
That's obviously not a great sounding name, and there might be some other better solution, but it sounds like some sort of solution should be possible, at least.
In the FOCS script, it could probably still be written If/Else in that case.

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

Re: Nebula collapse and CreatePlanet

#22 Post by Geoff the Medio »

Geoff the Medio wrote:...this should work now:

Code: Select all

        EffectsGroup
            scope = Planet
            effects = If condition = Planet type = [Terran Desert Tundra Swamp]
                effects = SetPlanetSize planetsize = Huge
                else = SetPlanetSize planetsize = Tiny
I've also added support for things like this:

Code: Select all

effects = SetPlanetSize planetsize = OneOf(Tiny, Huge, Target.PlanetSize, Huge, Huge)
It will randomly pick, at execution time, one of the values in the list. Duplicates can be used to adjust the probabilities. Should work as well for strings, numbers, object types, planet types, star types...

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

Re: Nebula collapse and CreatePlanet

#23 Post by MatGB »

Ooh, like that, been seeing a few weirdnesses with some of the natives that set planet size recently, I've put it on my long term list of things to tweak, that'll make it a lot easier to balance some of those effects.
Mat Bowles

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

Post Reply