OllyG wrote:In my previous post I explained (obviuosly very poorly) how this can be done. I don't know how to write the code, but I know the required algorthim, which I could use to calculate it. Please let me know what is confusing about my post and I will try to explain better. Or if it doesn't work tell me why and I can try to correct it.
Your post was missing an image and hard to read, but is or seemed to be an overly complicated description of a simple calculation that also introduced unnecessary new terminology or possibly required unnecessary changes to how species are defined. It also appears to assume a simple ordering of planets from worst to best, which isn't applicable to the current design and is even less applicable to possible cases like there being more than one best planet type for a species. You also don't give any consideration to how this could be accomplished within the existing effects system with a minimum of code changes and what would be easiest to use for content scripters.
A better method would be to find the best planet type(s) for a species, and find which is the fewest steps from a planet's current type, and then report the next planet type in the direction of the best one. For content scripters, this could probably be set up as a referencable property for planets to be used in the SetPlanetType effect, as in
Code: Select all
SetPlanetType type = Target.NextBestPlanetTypeForSpecies
. A more flexible system would allow the scripter to specify a species for which the next best planet type is being determined, which need not be the species currently on the planet (if there even is a species on the planet).