Planetbase

Planetbase

83 ratings
Creating Challenges
By martiño
How to create and upload challenges to the Workshop
   
Award
Favorite
Favorited
Unfavorite
Intro


From version 1.2, Planetbase supports the creation of Challenges, which are custom scenarios that provide specific starting conditions and objectives. They are accessible from the Challenges menu in the title screen.

When playing a challenge, milestones and achievements are disabled, the only goal is to complete the challenge's objectives.

The game includes some builtin challenges, but users can create more, and upload them to the workshop for other people to enjoy. This guide explains how to do it.
Basics
A challenge is created using a bunch of XML files. These define the initial conditions, objectives, texts and various gameplay and environment modifiers.

If you are not familiar with XML files there are plenty of resources on the internet about the topic, but the bottom line is that they are text files that define stuff, you can just download the builtin[planetbase.madrugaworks.com] or test[planetbase.madrugaworks.com] challenges and use them as starting point.

Challenge definition file

It's the main file for the challenge, this defines the starting conditions, objectives and modifiers for the challenge. It has to be named: "challenge_name_of_the_challenge.xml", as an example, if your challenge is named "Build an amazing base", the file would have to be named "challenge_build_an_amazing_base.xml".


Starting savegame

This file is optional. You can use a savegame as a starting point for your challenge. It has to be named "challenge_name_of_the_challenge_save.xml", in our previous example this file would be called "challenge_build_an_amazing_base_save.xml".


Text files

These store the text for the challenge: name of the challenge, description, objectives etc... They have the same format as the string files for Planetbase, you can download the text files from the test[planetbase.madrugaworks.com] challenge and just replace the text with your own.

You need to at least provide the English file for the challenge, which would be named: "en_name_of_the_challenge.xml", but you can provide additional files for more languages, and the game will pick them up automatically.

If the user selects a language that your challenge doesn't provide, the English files will be used.

As an example, if we wanted to provide English and Spanish files for our previous challenge, we would have to create 2 XML files named: "en_build_an_amazing_base.xml", and "es_build_an_amazing_base.xml"

Note that the builtin challenges have no text files associated with them as the text for these is defined in the main text files for the game.
Testing challenges
To test your challenge you can put all your files in the "Documents/Planetbase/Challenges" folder (create it if it doesn't exist), the game will pick them up and the challenge will appear in the game.
Defining a challenge
This section will go over the details of how to create the XML file that defines the starting conditions and objectives for the challenge.

We will use the "challenge_mining_station_alpha.xml" file included in the builtin[planetbase.madrugaworks.com] challenges as an example.


Root node

<challenge group_id="planetbase_corp" order="1" difficulty="1">

group_id: This defines the group for the challenge, you can group several related challenges and they will appear next to each other in the game UI.

order: Order in which this challenge appears in the UI in respect to other challenges of the same group.

difficulty: Has to be in the range [1, 4], and gives the player an idea of how difficult this challenge will be.

requires: You can specify that before playing this challenge, the user would have to complete another challenge, this is useful if you want to create a campaign, that would include several levels in sequence.


Starting location

<starting_location planet_class="F" latitude="15" longitude="-12" savegame="false"/>

planet_class: This specifies the planet that will be used as a base for this challenge, all terrain, gameplay and environment characteristics are taken from this planet unless you override them in the XML (we explain how to do this in later sections).

latitude: Starting latitude, challenges always use the same landing location. Positive numbers indicate north, and negative numbers indicate south.

longitude: Starting longitude, challenges always use the same landing location. Positive numbers indicate east, and negative numbers indicate west.

savegame: Can be true or false, depending of whether a savegame file is present that will be loaded when the challenge starts.


Starting specializations

This section defines the starting colonists and bots that appear at the beginning of the challenge.
It only makes sense to define it when the challenge is not being loaded from a savegame.


Starting resources

This section defines the starting resources for the challenge.
It only makes sense to define it when the challenge is not being loaded from a savegame.
Gameplay modifiers
This section overrides various gameplay settings.

A typical section would look like this:

<gameplay_modifiers> <gameplay_modifier type="DisableColonistShips"/> <gameplay_modifier type="RestrictedTradingShips" param="Electronics,Industrial"/> </gameplay_modifiers>

The possible values are:

DisableColonistShips Disables all colonists ships DisableVisitorShips Disables all visitor ships DisableTradingShips Disables all trading ships DisableTraderTechs Prevents traders from selling techs DisableStructure Disables a particular structure param: structure name in English, with no spaces, ie: ProcessingPlant DisableComponent Disables a particular component param: component name in English, with no spaces, ie: MetalProcessor DisableNoMedicalSuppliesWarning Prevents the game from displaying the "We've run out of medical supplies warning" when there are no medical supplies DisableStructureRequirements Allows the player to build a particular structure (or all structures) from the start param: structure name in English. If no param is specified, then it applies to all structures DisableVisitorRequirements Allows visitors to come regardless of prestige DisableIntruders Disables all intruders IntruderMinPrestige Specifies the min prestige for intruders to come to the base param: amount in the range [1, 1000] ExtraIntruders Specifies extra intruders to come in every attack param: amount in the range [0, ...] RestrictedTradingShips Restricts what trading ships come to the base param: Comma separated list of ship types, allowed values are: RawMaterial, Medical, Food, Industrial, Electronics RestrictedColonistShips Restricts what colonists come inside ships param: Comma separated list of colonist types, allowed values are: Worker, Engineer, Biologist, Medic, Guard InfiniteTraderBots Allows traders to always bring bots, they usually stop when the number of bots is higher than the number of colonists ShipFrequency Modifies the frequency of all ships coming to the base param: Frequency in the range [0.1, 10] TradingShipFrequency Modifies the frequency of trading ships coming to the base param: Frequency in the range [0.1, 10] DisasterFrequency Modifies the frequency of all sandstorms, solar flares and blizzards param: Frequency in the range [0.1, 10] UnlockTech Unlocks a tech from the start param: tech name in English, with no spaces, ie: GoliathTurbine SandstormRisk Specifies the risk of sandstorms param: None, Low or High MeteorRisk Specifies the risk of meteors param: None, Low or High SolarFlareRisk Specifies the risk of solar flares param: None, Low or High BlizzardRisk Specifies the risk of blizzards param: None, Low or High ThunderstormRisk Specifies the risk of thunderstorms param: None, Low or High AtmosphereDensity Specifies whether Wind Turbines work properly or not at all in this planet param: None, Low or High LightAmount Specifies whether Solar Panels work properly or not at all in this planet param: None, Low or High DisableColonyShipRecycling Prevents the player from recycling the colony ship. DisableWorkerMining Prevents Workers from mining
Environment modifiers
They allow you to change the lighting, fog and horizon colors for the planet.

A typical section would look like this:

<environment_modifiers> <environment_modifier type="RemoveSatellites"/> <environment_modifier type="DayHours" value="8"/> <environment_modifier type="NightHours" value="16"/> <environment_modifier type="LightColorDay" value="200,200,255"/> </environment_modifiers>

The possible options are:

RemoveSatellites Removes any planets in the horizon. Day/NightHours Specifies how long days or nights are. value: Reasonable values are in the range [4, 24] FogIntensityDay/Night/Twilight Intensity of the fog during the day, night, sunrise or sunset. value: Number in the range [0, 0.1] LightColorDay/Night/Twilight Color of the directional sun light during the day, night, sunrise or sunset. value: Color ie. 255,255,255 AmbientColorDay/Night/Twilight Color of the ambient sun light during the day, night, sunrise or sunset. value: Color ie. 255,255,255 HorizonColorDay/Night/Twilight Color of the horizon (lower part of the sky) during the day, night, sunrise or sunset. value: Color ie. 255,255,255 SkyColorDay/Night/Twilight Color of the sky during the day, night, sunrise or sunset. value: Color ie. 255,255,255 EnvironmentMapIndex Changes the environment map for this challenge value: Number in the range [1, 4], indicates which planet to take the environment map from SunIndex Changes the sun for this challenge value: Number in the range [1, 4], indicates which planet to take the sun from BackdropsIndex Changes the backdrops for this challenge value: Number in the range [1, 4], indicates which planet to take the backdrops from
Terrain modifiers
These allow you to change parameters in the terrain generation algorithm to create variations of the existing planets. With the right values you can totally change how a planet looks.

See this example of the "Starport Atlantis" challenge, that uses the class D planet, but adds water and lower terrain:



The possible values are:

HeightMultiplier Multiplies the terrain height of everything, it makes mountains higher or lower. value: Number in the range [0, 2] HeightOffset Moves the whole terrain up or down, it generates more or less mountains value: Number greater than 0. Even small values will have a large effect. DistantHeightOffset Makes distant terrain higher or lower value: Number. Reasonable values are in the range [-0.1, 0.1] CraterDensity Specifies how many meteor craters there will be in the terrain. value: Number in the range [0, 1] LiquidAmount Specifies how many lakes there will be in the planet. value: Number in the range [0, 1] LiquidColor Specifies the color of the lakes. value: Color. i.e: 255,0,0 BackdropScale Scales the backdrops (the mountains behind the heightmap) in the environment value: 3D vector: ie: 2.0,2.0,2.0 TintTexture Changes the color of one of the textures, by multiplying it by another color param: Flat1, Flat2, Slope, Foundations, DetailRocks, CentralRocks, SideRocks value: Color. i.e: 255,0,0 HslTransformTexture Changes the color of one of the textures, by applying a Hue, Saturation, Lighness transform param: Flat1, Flat2, Slope or Foundations value: HSL Values. i.e: 10,5,-7
Objectives
They allow you to specify the victory conditions for the challenge. If you specify more than 1, all of them will have to be met. You can also specify no objectives for the challenge to be open ended.

A typical objectives section would look like this:

<objectives> <objective type="AccumulateResources" param="Ore" value="100"/> </objectives>

The possible types are:

AccumulateResources Accumulate a certain amount of resources. param: indicates the type of resource. value: indicates the amount. ReachPopulation Reach a certain population. value: indicates the amount. ReachBots Reach a certain number of bots. value: indicates the amount. ReachPrestige Reach a certain prestige. value: indicates the amount. ReachWelfare Reach a certain level of welfare. value: indicates the amount, in the range [0, 100] BuildStructures: Build a certain amount of structures. param: indicates the type of structure. value: indicates the amount. size: indicates the size of the structures to be built, 0 means any size, values in the range [1, 5] indicate a particular size. BuildComponents: Build a certain amount of components. param: indicates the type of component. value: indicates the amount. SurviveTime: Survive a certain amount of time value: indicates the time in game days. TimeLimit: Specifies a time limit for the challenge. value: indicates the time in game days. KeepCharacterAlive This will fail the challenge if a particular character dies. param: indicates the character name, must be exact. ReachSpecialization Reach a certain number of characters of a particular specialization. param:: indicates specialization, allowed values are: Worker, Engineer, Biologist, Medic, Guard, Carrier, Constructor, Driller. value: indicates the amount.
Creating a savegame file
One of the more interesting features of the challenge system is to use a savegame as a starting point. You can even use cheats or trainers to create the savegame you want.

To do this you need to:
  • Create a regular challenge, as explained in the previous section. Make sure you set the "savegame" attribute in the start location node to "false" to start with.
  • Play your own challenge, and save the game normally.
  • Take your savegame from the saves folder (Documents/Planetbase/Saves), rename it to challenge_name_of_the _challenge_save.xml and put it in the same folder as the challenge.
  • Change the "savegame" attribute in the start location node to "true".
  • Play the challenge again. You can keep on saving the game and replacing the savegame file if you need to make tweaks to it.
Campaigns
Campaigns are a sets of challenges that have to be played in order.

Each challenge will usually belong to the same group, and later challenges will use the "requires" attribute in the root node to specify which other challenge has to be played first.

You can have a look at how this works in the builtin[planetbase.madrugaworks.com] challenges.
Uploading to the Steam Workshop
Once you've tested the challenge on your machine, you can upload it to the workshop for other people to enjoy, by using the Workshop Uploader, see instructions here:
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=2053037162
86 Comments
ChristoLife 8 Oct, 2022 @ 7:20am 
Hello Martino,
I loved playing Dawn of Man, I think I've exceeded 4000 hours of play. I also played a lot with mods like Flatland.
I've just tested Planetbase, great game too ! Even if it's old, it's a good game, and at least with my old computer it works well.

Great job by the creator ;-)

I was wondering if it was possible to add "events" in challenges like with Dawn of Man?
Like :
<event>
<condition type="TimeElapsed" timer="GameTime" value="20.0d"/>
<actions>
<action type="ShowMessage" title="A gift" text="A gift from Krypton corp"/>
<action type="Spawn" entity_type="Meal" placement="StartLocationCircular" radius="50" amount="10"/>
<action type="Spawn" entity_type="MedicalSupplies" placement="StartLocationCircular" radius="40" amount="10"/>
</actions>
</event>
Thanks

Thanks for your help
and again great games!
What will be the next game?
Rubik 19 Dec, 2021 @ 4:34pm 
Thanks for all the useful information. I'm curious if you know how to remove the clouds from the background atmosphere. I tried creating a custom challenge on an M class world with the atmosphere density set to None, but there were clouds blocking the view of space. I tried setting all of the FogIntensity, SkyColor, and HorizonColor values to zero. That seems to make the clouds a little more transparent, but they are still there. When playing the default M class world in the standard game, the sky is completely clear, so there must be a way to do it. However, I can't find any tag values beyond the ones I mentioned that seem like they could affect cloud cover.
Base Invaders 3 Jul, 2021 @ 12:13pm 
https://gofile.io/d/9h1IGT
This will bring you to a workshop uploader folder
Engineer In A Box 14 May, 2020 @ 9:36am 
I actually found your challenge editor after my first attempt to make a challenge failed, but I ended up deciding to make a challenge manually because installing it seemed to be too complicated for me. I still managed to make a challenge manually though.
_provector 12 May, 2020 @ 7:43am 
Try using the challenge editor (you can find it on nexus mod and github). If you need exact naming and id's you can look into the source code on github. I pulled them from original game code.
Engineer In A Box 11 May, 2020 @ 8:06pm 
Could you please add ids for starting resources and colonists, as well as formatting for those sections of the XML file? I want to make a godmode challenge with less starting colonists than usual to make an easier godmode challenge. Thank you!
martiño  [author] 4 Jan, 2020 @ 12:22pm 
This means you are typing the wrong password.
Base Invaders 4 Jan, 2020 @ 6:59am 
Redirecting stderr to 'C:\Users\EKandMK\Desktop\WorkshopUploader\bin\logs\stderr.txt'
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[ 0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.
Logging in user 'friendlyengineer' to Steam Public ...
FAILED login with result code Invalid Password
ERROR! Not logged on.

can't upload my challange due to the above error message
_provector 20 Nov, 2019 @ 7:54am 
The_Yatagarasu 9 Sep, 2019 @ 8:52am 
And the first colonists?