RPC wrote:
Let me ask around IRC because I'm not that well versed in graphics and can only produce boxes
Thanks! For (C), if you're referring to the 'random' of vanilla Transcendence rather than the 'random' of, say, BTM, it's fairly simple. The mechanism is actually very similar to the one used to choose which stations to spawn in Eridani. I've written a tutorial below that covers pretty much everything you'd need for that, organized by depth.
As an example, in HumanSpaceMap.xml, the New Beyond topology is described as such:
Code: Select all
<NodeGroup ID="NewBeyondMainline">
<Stargate from="SE:Outbound" to="C1:Inbound"/>
<Stargate from="C1:Outbound" to="C3:Inbound"/>
<Stargate from="C3:Outbound" to="C3A:Inbound"/>
<Stargate from="C3A:Outbound" to="BA:Inbound"/>
<Stargate from="BA:Outbound" to="C4:Inbound"/>
<StargateTable>
<Group chance="50">
<Stargate from="C4:Outbound" to="C4A:Inbound"/>
<Stargate from="C4A:Outbound" to="CP:Inbound"/>
</Group>
<Stargate chance="50" from="C4:Outbound" to="CP:Inbound"/>
</StargateTable>
</NodeGroup>
The section at the end, within the 'StargateTable' tags, indicates that there ought to be a 50% chance of adding the node 'C4A' between node 'C4' and node 'CP'. 'C4' and 'C4A' are both random nodes, and 'CP' is always the Charon system.
Node 'C4' is randomly selected from five possible procedurally generated systems, specified entirely in the below code block:
Code: Select all
<Node ID="C4" x="266" y="-172">
<System
level= "3"
attributes= "humanSpace, mainline, newBeyond"
>
<Table>
<System chance="17" name="Van Maanen" UNID="&ssEarthSpaceStandard;"/>
<System chance="8" name="Moren-Lin" UNID="&ssEarthSpaceBinary;"/>
<System chance="25" name="Jotunheim" UNID="&ssEarthSpaceRedDwarf;"/>
<System chance="25" name="Hena's Star" UNID="&ssEarthSpaceAsteroids;"/>
<System chance="25" name="Ankaa" UNID="&ssEarthSpaceDesert;"/>
</Table>
</System>
</Node>
This code means that the system indicated by node 'C4' has a 17% chance of being a randomly generated standard system by the name of Van Maanen, an 8% chance of being a binary system by the name of Moren-Lin, and so on. It will always have the attributes 'humanSpace', 'mainline', and 'newBeyond', and will always be a level 3 system, regardless of which name and type is selected by the RNG. 'C4A' is specified similarly.
Node 'CP' is not an entirely procedurally generated system, and thus is specified with a link to a specific system UNID.
Code: Select all
<Node ID="CP" x="267" y="-40">
<System
name="Charon"
level= "3"
attributes= "humanSpace, mainline, newBeyond"
>
<System UNID="&ssCharonPirateFortress;"/>
</System>
<MapEffect>
<Group xOffset="-172" yOffset="-58">
<Text text= "Charon Pirates"
font= "SubTitle"
primaryColor= "0xff, 0xff, 0xff"
opacity= "20"
/>
</Group>
</MapEffect>
</Node>
The MapEffect block creates a label on the galactic map reading "Charon Pirates" placed 172px above and 58px to the left of the Charon System's point. It has no effect on the topology itself.
While I have not seen this done yet, it might be fun to mix and match handmade systems with procedurally generated systems within a single Table block. This would cause players to rely less on being guaranteed a certain set of systems while still providing interesting, custom made systems to players, and allowing for the implementation of missions that require absolute control over the system that they are carried out in. This would likely be the ideal setup for most of the systems being created in this month's mod jam, which are neither completely computer - generated nor essential components in the game's plot.
Now, I'm sure that anyone reading this is wondering what, exactly, is being referenced whenever a modder enters "&ssCharonPirateFortress;" or "&ssEarthSpaceRedDwarf;". The former is a hand - coded system specified in CharonFortress.xml, and further data on building those is specified in this
month's MMJ's template, so, to avoid duplication of work, I won't cover it unless asked. The latter is specified in StdSystems.xml. Both are covered more practically in PBL, but I'll give a cursory explanation of the latter anyways.
Code: Select all
<SystemType UNID="&ssEarthSpaceRedDwarf;"
attributes= "envAir"
backgroundID= "&rsRedDwarfSpace;"
>
<SystemGroup>
<Lookup table="RedDwarfSystem"/>
<!-- Place the two stargates -->
<Lookup table="HumanSpaceStargates"/>
<!-- Primary Station -->
<RandomLocation probability="60" locationCriteria="++lifeZone; *planet">
<RandomStation stationCriteria="*friendly; *primary; +envAir; -envAvoidsAir"/>
</RandomLocation>
<!-- Random Stations -->
<FillLocations
percentFull= "80"
stationCriteria= "!primary; !debris; +envAir; -envAvoidsAir"
percentEnemies= "75"
separateEnemies= "true"
/>
<!-- Random Debris -->
<RandomLocation probability="50" locationCriteria="++outerSystem; ++asteroids">
<Orbitals count="1d6" distance="1d8+6" angle="random">
<RandomStation stationCriteria="*debris"/>
</Orbitals>
</RandomLocation>
<FillLocations
percentFull= "50"
stationCriteria= "*debris"
/>
<!-- Void Encounters -->
<Orbitals count="1d12" distance="3d200+240" angle="random" exclusionRadius="100">
<Table>
<RandomStation chance="80" stationCriteria="*debris"/>
<RandomStation chance="18" stationCriteria="*enemy; +envAir; -envAvoidsAir" locationAttribs="void"/>
<RandomStation chance="2" stationCriteria="*friendly; !debris; !primary; +envAir; -envAvoidsAir" locationAttribs="void"/>
</Table>
</Orbitals>
</SystemGroup>
</SystemType>
What this somewhat daunting code block does is fairly simple. First, it adds "envAir" to the set of attributes initially specified. This ensures that the stations it spawns will be biased in favor of those that thrive in 'Air' type environments. It also grabs the resources image that corresponds to this system type, to use as a background when moving around the system and on the system map. It then populates the system with planets, stars, and asteroids from the RedDwarfSystem table.
After that, it picks a random station with the attributes 'friendly' and 'primary', biasing the search in favor of the attribute 'envAir', and against the attribute 'envAvoidsAir'. This has a 60 percent chance of occuring, will always occur in a planet's orbit, and almost certainly target the 'lifezone' of the system, which is the optimal distance from the star required for humans to thrive. It then fills the rest of the system with other stations(the criteria in that block is fairly self - explanatory.) After this, it has a 50% chance of spawning a group of wrecks somewhere in the system, made up of 1d8 + 6 items with the criteria "debris". After this, it populates the system with random bits of debris.
Finally, it adds various encounters to the void(the parts of the system without planets, asteroids, or other objects). There's an 80 percent chance that a random bit of debris will be spawned somewhere in the system, an 18 percent chance that an enemy station will be spawned in the void, and a 2 percent chance that a friendly station that isn't debris or a primary station will be spawned in the void.
Finally, here's the code for RedDwarfSystem, which was called in the previous section to add the planetary bodies to Jotunheim if it is selected as our C4:
Code: Select all
<RedDwarfSystem>
<Group>
<Code>
(trnCreateStarAndZones aOrbit (random (list &stStarClassM8; &stStarClassM5; &stStarClassM0;)) {
metallicComp: '(20 20 10)
organicComp: '(10 10 20)
rockyComp: '(65 50 40)
waterComp: '( 5 20 30)
})
</Code>
<AddAttribute attributes="redDwarfSystem"/>
<!-- Worlds -->
<Orbitals count="4-5" BodeDistanceStart="1d12+70" BodeDistanceEnd="1d100+740" angle="random">
<Variants>
<Table maxRadius="290">
<Lookup chance="10" table="DesertPrimary"/>
<Lookup chance="60" table="RockyPrimary"/>
<Lookup chance="30" table="IcePrimary"/>
</Table>
<Table maxRadius="480">
<Lookup chance="20" table="RockyPrimary"/>
<Lookup chance="40" table="IcePrimary"/>
<Lookup chance="40" table="GasGiantPrimary"/>
</Table>
<Table maxRadius="2000">
<Lookup chance="30" table="IcePrimary"/>
<Lookup chance="40" table="MethaneGasGiantPrimary"/>
<Lookup chance="5" table="AsteroidBelt12"/>
<Lookup chance="15" table="AsteroidBelt25"/>
<Lookup chance="10" table="AsteroidBelt50"/>
</Table>
</Variants>
</Orbitals>
<!-- Comets -->
<Orbitals count="1d4-1" scale="light-minute" distance="1d8+8" angle="random" eccentricity="1d20+70" rotation="random" exclusionRadius="100">
<Lookup table="IceComet"/>
</Orbitals>
<!-- Create ore deposits -->
<Code>
(trnCreateOreDeposits (random (list 0 0 0 1 1 1 1 2)))
</Code>
</Group>
</RedDwarfSystem>
The first section is inlined "real" code(as opposed to the markup style typically used in Tlisp, which is reminiscent of HTML) that creates a random red dwarf star(the code to create a "star" is fully covered in PBL, and will thus not be discussed here) and then generates the 'zones' of the system(like the life zone I described earlier). It then adds the attribute "redDwarfSystem" to the system being populated, followed by adding four to five planets around the system's star at distances between 1d12 + 70 and 1d100 + 740. The Variants block specifies which planets will be spawned, with maxRadius indicating that a Table block will not be accessed beyond a certain radius. Effectively, the first block will be used for planets in the inner system, the second for the midsection of the system, and the third for the outer system. In the outer system, asteroid belts may be spawned instead of planets, as you've probably already figured out.
Next, a bunch of orbitals are created with ice asteroids on them, to simulate comets in the system. Finally, another bit of code is inlined, calling a method to populate the system's asteroids with ore.