Randomly Generated Unique Planets

Freeform discussion about anything related to modding Transcendence.
Post Reply
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

So I've been tweaking my mod's planet generation tables to make planets have a certain rarity factor. So far I have common, uncommon, and rare planets generated depending on their orbits (inner system, lifezone, or outer system). What I would like to do is also have some unique planets be randomly generated instead of having to create a custom system for each unique planet, but I can't figure out how to prevent the potential duplication of unique planets using my current system of planet generation. Here's an example of what I have so far....

Let's say a generated planet's orbit is in the lifezone. First, the code looks at the table "LifezonePlanets":

Code: Select all

<LifezonePlanets>
		<Table>
			<Lookup chance="60" table="CommonLifezonePlanets"/>
			<Lookup chance="30" table="UncommonLifezonePlanets"/>
			<Lookup chance="10" table="RareLifezonePlanets"/>
		</Table>
	</LifezonePlanets>
Then let's say a rare planet comes up...

Code: Select all

<RareLifezonePlanets>
		<Table>
			<Lookup chance="20" table="UltramarineWorld"/>
			<Lookup chance="18" table="UltravioletWorld"/>
			<Lookup chance="16" table="GreenWorld"/>
			<Lookup chance="14" table="TelluricWorld"/>
			<Lookup chance="12" table="TreasureWorld"/>
			<Lookup chance="12" table="WaterWorld"/>
			<Lookup chance="8" table="ShatteredWorld"/>
		</Table>
	</RareLifezonePlanets>
Then, let's say a Water World is generated...

Code: Select all

<WaterWorld>
		<Group>
			<Station type="&stWaterPlanet;"
					showOrbit="true"
				/>

			<Orbitals distance="2d6+10" angle="random">
				<Label attributes="planet,planetary"/>
			</Orbitals>

			<Orbitals distance="2d8+30" angle="random">
				<Table>
					<Null chance="50"/>
					<Group chance="35">
						<Lookup table="AsteroidMedium"/>

						<Orbitals distance="2d4+8" angle="random">
							<Label attributes="moon,planetary"/>
						</Orbitals>
					</Group>
					<Group chance="15">
						<Station type="&stCrateredPlanet;" showOrbit="true"/>

						<Orbitals distance="2d4+8" angle="random">
							<Label attributes="moon,planetary"/>
						</Orbitals>
					</Group>
				</Table>
			</Orbitals>

			<Trojan>
				<Group probability="10">
					<Orbitals count="1d4+4" distance="2d8+8" angle="random">
						<Lookup table="AsteroidSmall"/>
					</Orbitals>

					<Orbitals count="1d4" distance="2d8+8" angle="random">
						<Lookup table="AsteroidMedium"/>
					</Orbitals>

					<Orbitals count="1d3+1" distance="1d8+6" angle="random">
						<Label attributes="asteroids,trojan"/>
					</Orbitals>

				</Group>
			</Trojan>

			<AntiTrojan>
				<Group probability="10">
					<Orbitals count="1d4+4" distance="2d8+8" angle="random">
						<Lookup table="AsteroidSmall"/>
					</Orbitals>

					<Orbitals count="1d4" distance="2d8+8" angle="random">
						<Lookup table="AsteroidMedium"/>
					</Orbitals>

					<Orbitals count="1d3+1" distance="1d8+6" angle="random">
						<Label attributes="asteroids,trojan"/>
					</Orbitals>

				</Group>
			</AntiTrojan>

		</Group>
	</WaterWorld>
I figure I can either add "UniqueLifezonePlanets" to the "LifezonePlanets" table, probably giving it a chance of 1% and then create another sub-table for unique lifezone planets (though this could be problematic if...more likely when...I end up adding more than 100 unique planets), or I could add another table inside the "WaterWorld" section like this:

Code: Select all

<Table>
    <Station chance="95" type="&stWaterPlanet;" showOrbit="true" />
    <Lookup chance="5" table="UniqueWaterPlanets"/>
</table>
But either way, the question is still how to prevent those "unique" planets from being duplicated. Any thoughts on this?
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

You can't stop tables generating things IIRC.
The best way might be to log what planets spawn during system generation of every system and remove/replace them if a duplicate one shows up. If you can't make it I think I can cook one up for you to use.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

Planets are stations. Stations have an attribute to make them system-unique or game-unique.
If you place the attribute on your unique planets, the RNG should take care of all the rest.
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

Exxxcellent! :twisted: I mean, thank you. I was hoping it would be a simple solution. I'll try out the attribute thing. Of course, considering the rarity unique planets will have and the fact that I am currently testing things out with a single system, it might be a while before I have results. :)
Post Reply