RimWorld

RimWorld

World Presets
76 Comments
Reel 19 hours ago 
@тетеря, блин
Yep
тетеря, блин 21 hours ago 
does it work with «My Little Planet»? in case you know.
Wolf von Isles 9 Jul @ 12:22pm 
how does this even work? there is a save option and absolutely nothing else. It's nice to know the file path for the presets but are they supposed to go somewhere?
Cultanis 19 Jun @ 11:26pm 
I'm pretty sure this is incompatible with World Tech Level, mod is working after removing it.
Meyst 5 Jun @ 5:50am 
FYI: Not compatible with Rimworld Exploration Mode.
Generating a world from the preset would straight up crash to main menu after world generation, and loading an exact preset would make the world void (and remove most pawns).

Still a great mod, thank you for it!
qux 29 May @ 6:11am 
Hi,
The XML files don't support the MayRequire tag. Do you have any idea why?

I'm trying to add traits from mods to pawns.

<li MayRequire="VanillaExpanded.VMemesE">
<def>VME_Elder</def>
</li>

They should only load if the mod is present, but even if it isn't present, the game loads the <li>, and I get error messages.
Azravos  [author] 28 May @ 6:17am 
IssaRino: I just tried several load/save cycles with worldpresets and worldedit combined and the game started up fine with colonists landing in pods successfull as per usual. So I'm unsure as to what could cause your problem. You could try to enable "development mode" in game options and see if the dev log screen offers a clue as to what is happening (one of the white icons that appear on top-middle of the screen when development mode is enabled)
IssaRino 28 May @ 1:28am 
I have been solely using WorldPreset for save/load. It's fine if you'd don't know, I appreciate the work you've put into the mod and helping out. I'll be checking it out on my own time as well in case it's a problem from my side, which is most likely the case. Do let me know if you find out something though, cheers.
Azravos  [author] 27 May @ 10:48pm 
IssaRino: Sorry no, unless it's something that has happened in the last month or so (I haven't played RimWorld for quite awhile).

I also use WorldEdit, in fact it was the sole reason that i made this mod. Because the template save/load function of worldedit did not work as well and it kinda seemed like it started the simulation a bit before save/load which caused some weird quirks.

If I have some time later this week I'll check if WorldPresets has been broken due to a RimWorld patch or WorldEdit change or something. But I'm abit doubtful. Are you sure you're actually using WorldPresets save/load and not WorldEdit's save/load (template)?
IssaRino 27 May @ 2:48pm 
Hi, so I've been working on a world with WorldEdit along side your mod. But, whenever I start a game, the colonists don't spawn in. Like the world still there, and it's not in an end-game state. I've tried it without any mods except for World Preset. Do you know what might cause this?
Azravos  [author] 26 May @ 11:42pm 
qux: Regarding the mod conflict. Yeah I try not to get too much involved in conflict solving. Because If I did, I'm afraid I'd probably not get to do anything else but solving conflicts. Due to the nature of how mods just either overrides or appends to existing RimWorld functions. Conflicts are pretty much unavoidable.
Azravos  [author] 26 May @ 11:39pm 
qux: Ah, I wasn't aware you could do that. I'll update it as soon as I'm able.
qux 26 May @ 1:30pm 
There is possibly an incompatibility with World Tech Level :

[WorldTechLevel v1.1.4] Detected potential conflict: The mod "World Presets" (azravos.worldpresets) adds a destructive patch that will likely override or break some functionality of WorldTechLevel.
Patch method: static System.Boolean WorldPresets.Patches.Page_CreateWorldParams_Patch::CanDoNext(System.Boolean __result, RimWorld.Page_CreateWorldParams __instance, System.String& ___seedString, System.Single& ___planetCoverage, RimWorld.Planet.OverallRainfall& ___rainfall, RimWorld.Planet.OverallTemperature& ___temperature, RimWorld.Planet.OverallPopulation& ___population)
Target method: virtual System.Boolean RimWorld.Page_CreateWorldParams::CanDoNext()
UnityEngine.StackTraceUtility:ExtractStackTrace ()
qux 26 May @ 11:52am 
Hi, could you add this in your about.xml ?

<loadBefore>
<li>FunkyShit.Mods.WorldEdit</li>
</loadBefore>
Psyckosama 17 May @ 8:28pm 
Okay, what mod order do I use to get this working with Worldedit?
Username 18 Apr @ 3:04am 
Roads don't show when I place them, it says they are there but I can't see them.

This issue appeared after installing this
Rct.Iturriaga 6 Feb @ 11:20pm 
@Poindexter thx!
Poindexter1985 27 Dec, 2024 @ 5:15pm 
Just a compatibility note: this mod appears to be incompatible with Progression: Storytellers by ferny (https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3361425712) . That mod seems to modify the new game setup screens in a way that prevents the World Preset selection screen from ever appearing.

I was just banging my head against the wall, thinking I must be an idiot because I couldn't figure out how to load the presets I saved. Thought I'd share the info to save others from that same frustration.
irrelevantredundancy 17 Nov, 2024 @ 4:13pm 
@ Azravos

Update: I have moved this mod to my main steam account.

I was wondering what was going on. I was looking at my mod list notes and then looking for this in the inactive list so I could enable it, but it wasn't there. I couldn't figure out why they weren't there. No worries, it's just one of those great "see I knew I wasn't imagining things" moments.
Azravos  [author] 11 Nov, 2024 @ 1:07pm 
Darknote: You're probably using a mod that isn't compatible with World Presets. You could try and enable dev mode in game options. That will let you see any errors being generated.
Darknote 6 Nov, 2024 @ 8:18am 
This mod does not seem to work? I load preset, it remembers just faction names, I have to select the same settings once more, and when I click next (after clicking Generate Planet), it takes me back to the main menu...
Reel 21 Oct, 2024 @ 10:27am 
Will do. I've also just noticed that this mod saves SiteMaps & VE Outposts from previous playthroughs, which is absolutely awesome.

The Outposts won't work, but you'll still be able to visit the sitemaps as if they were there in the previous playthrough.

(Outposts will have the pawns from previous playthroughs stored, but you won't be able to control them as packing it up will create a bugged caravan, even after recruiting said pawn with DevMode. Honestly, I wouldn't bother trying to fix it, just a funny interaction I noticed.)
Azravos  [author] 21 Oct, 2024 @ 9:31am 
Reel: I did add the mods you mentioned (including vanilla extended). Generated some planets of different sizes and different parameters and saved them as presets. They all loaded without errors.

Ah, yeah, that's gonna be a bit of a problem then. A tip for the future is to always start a game on the planet you've generated as well and then save it as a game save. Since WP allows saving a preset from an active game now (with the player faction being removed when such a preset is loaded) there is less of a risk of losing what you've made. (Because you could always just fallback to loading that saved game instead and then save a preset from that).
Reel 21 Oct, 2024 @ 9:24am 
I'm not exactly sure how I can do that, when I try to load the older saves it just locks me back out into the preset selection screen. I did try removing ReGrowth Worldgen to fix my small planet save, but it only loaded the vanilla-size version
(I think it overwritten that save, despite a lot of the world-details and name locations being the same in the RWS file V_V)

Forgot to mention but thanks a lot for the quick fix!
Azravos  [author] 21 Oct, 2024 @ 9:15am 
Reel: You could try to re-save the planets and see if that helps. Seeing as before today my mod did not include the GameComponent for my little planet in the worldpreset files which is now required to be there to enable loading a planet with a different planet size than the default one.

The fact that you're getting a problem with a vanilla size though is weird. Could be that the mods you mentioned have their own Game.components that contains worldgen info the mods need for the planet to be able to generate properly. I dunno.
Reel 21 Oct, 2024 @ 8:53am 
The Good: It works excellent with My Little Planet now. I should be able to work with this, saving & loading a tiny planet works consistently.
It even works when I design the planet on a 40 modlist, and then switch over to my 840+ modlist. No issues whatsoever on new planet saves.

The Bad: My previous world files are no longer able to be loaded, including the ones in Vanilla scale.

The Cause: I believe it's related either to "ReGrowth: World Generation (Continued)" or "ReGrowth: Core" (The BiomesKit related stuff. It could also be a local problem on my end, which can be fixed by simply remaking the planets.)
Hopefully other players won't run into the same issue, I can also provide the RWS file if you'd like to take a look.

LOG: https://gist.github.com/HugsLibRecordKeeper/f31bef85187d7d236470a404b7e15476
Azravos  [author] 21 Oct, 2024 @ 8:03am 
Reel: There, changes uploaded.

It should now both correctly read new preset saved with my little planet. As well as resetting the static variable before loading so as to not crash presets that have been saved without using my little planet.

Let me know if it still doesn't work.
Reel 21 Oct, 2024 @ 7:31am 
Excellent, I've been following up on the conversation here. Hopefully everything goes well!

On an unrelated note, I tested this mod with Save our Ship 2 and I believe it appears to be working perfectly.

I do still need to test this in an actual playthrough, but this means that planetary travel between two saved planets is possible and will not only restore TPS for longer-term playthroughs, but also save the previous planet that the player has travelled from.

Once I'm finished designing my planet mods, it should be able to offer the player a diverse pool of planets to travel to, much like many of the other space travel games like No Man's Sky & Starfield.
Azravos  [author] 21 Oct, 2024 @ 6:59am 
Reel: I think the way I'll solve this for now is to make a list of gamecomponents that are the only gamecomponents that WP save/loads from. For which my little planet component is the first (and hopefully the only) one.

I'll post here when the changes are done.
Azravos  [author] 20 Oct, 2024 @ 11:18am 
Ignis: ah, thanks for clarifying.
ignis 20 Oct, 2024 @ 9:42am 
> What would happen in your mod if you simply remove static from subcount?

It is used in a static harmony method to patch a static field in another static method. Would need to wrap it into instance, and then keep that instance... You guessed it, in a static field.

> GameComponent should do game-state and WorldComponent does world stuff

There is simply no state to be used for MLP. I have to create that state, and I need it before the world is created, because I need to patch into world constructor.
Azravos  [author] 20 Oct, 2024 @ 9:33am 
Ignis: I'm though curious. What would happen in your mod if you simply remove static from subcount?
Azravos  [author] 20 Oct, 2024 @ 9:31am 
Ignis: Yeah I know I'm really arguing semantics here. And even trying to set some kind of "rule" that GameComponent should do game-state and WorldComponent does world stuff is not fool proof as modders could always opt to do something else with them. Or it's simply not possible due to how the game uses them/works.

I'm just trying to solve this dynamically without having to resort to "if mod x installed then do y" or if component is typeof x component then do y. As I'm afraid that if I go down that hole more will probably follow.

I'll have to do some more thinking and see if there is another angle.
ignis 20 Oct, 2024 @ 9:00am 
I guess I could reset subcount whenit is no longer used, but it would be a problem in another scenario: yo ugenerated a world, you don't like it and go back to change settings. And it would be reset.

The thing is that my mod IS modding the game, not world. It mods how the game generates the world. When my mod is doing its stuff, the world does not yet exist.
Azravos  [author] 20 Oct, 2024 @ 8:38am 
Continued:

I could ofc use reflection and check if your mod is present and then reset the subcount manually before loading the preset. But like I said I'd rather not go down that road.

But the bigger problem is the GameComponent/WorldComponent one.
Hence why I was thinking that since your mod is actually modding the World and is not a Game state thing. It would (semantically) make more sense that it's component is a WorldComponent. But yeah if that is not possible due to how worldgen works then I'm not sure how I could solve this problem.

And ofc modders could also abuse WorldComponent and save gamestate data there too so there is no guarantee that the logic of WorldComponent will only contain world/worldgen settings.
Azravos  [author] 20 Oct, 2024 @ 8:29am 
Continued:
But I haven't tried modding world-gen like you yet so I ofc don't know the challenges you face in making your mod work either.

As for the static subcount variable problem. It comes down to this:
Let’s say I have your mod installed and I previously either loaded or generated a new world that sets the static subcount variable to 6. Now let’s say you wish to load a preset that was not saved with your mod present.

So the preset file in this case does not contain a <subcount> value at all meaning that the previously used subcount value in the game will be the value that your mod uses when the preset loads. But the planet inside of is of standard size, this means that the loaded preset will crash.

All used GameComponents and WorldComponents is re-created for each load. But that since you’re using a static variable that means that it doesn’t matter. The static variable value will not be reset. And thus the wrong subcount will be used.
Azravos  [author] 20 Oct, 2024 @ 8:28am 
So to the problem, imagine seeing these components inside a savefile:
<savegame>
<game>
<components>
//game components
<li Class="ModStuffs.MyZombieApocalypse">
<currentZombiePopulationLeft>432443</currentZombiePopulationLeft>
<ticksUntilNextHordeAttack>321</ticksUntilNextHordeAttack>
</li>
<li Class="MyLittlePlanet.RulesOverrider">
<subcount>6</subcount>
</li>
</components>
</game>
<world>
<components>
//World components here
</components>
//world data, settlements, factions, etc
</world>
</savegame>

Looking at the above how can I (using code) know which components are setting game state values? Without writing a if(component is MyZombieApocalypse)” then do x. I can’t right? Which is not something I’m very keen to do because It could be a never ending stream of having to add those to my mods.
ignis 20 Oct, 2024 @ 7:28am 
I've used GameComponent because at the point the mod works (it needs to be initialized on Page_CreateWorldParams), world itself is not yet created, and WorldComponent needs World instance to already exist.

I am not sure why it is a problem to change a static variable? "subcount" is not read outside of the world creation stage anyway, it is just a temporary storage used for PlanetShapeGenerator.subdivisionsCount which is changed using reflection, and that field is also static.
Reel 20 Oct, 2024 @ 3:37am 
Thanks for the extensive explanation, I'll go and let the MLP author know.

I figured that it would be possible since it worked locally, unfortunate that it's an issue on their end, rather than yours.

Hopefully they'll be able to quickly implement this WorldComponent fix without rewriting/breaking the entire mod & it's compatibility.
Azravos  [author] 20 Oct, 2024 @ 1:21am 
Continued:
Another problem that I noticed is that "My little planet" subcount field is a static variable. Making it impossible (at least without using a "if mod.x installed" thing and then reflection) to reset it's value. It really should've been an instanced variable so that when the mods component is re-created by the game the value would automatically reset back to the default "standard planet size" value.

The mod maker of "My little planet" ideally should have made it's component a WorldComponent instead of a GameComponent. This would make "My little planet" automatically work with world presets. As it already saves/loads World.components. And that is also the only way my mod can possibly differentiate between components used for world/worldgen and components used for a game in-progress.

So unfortunately I can't really help you with this. Sorry :(. You'll have to ask the "My little planet" mod maker to make these changes if you want it to work with world presets.
Azravos  [author] 20 Oct, 2024 @ 12:56am 
Reel: After having spent a few hours coding, testing and looking for different solutions on this. I've come to the conclusion that I can't really make my mod save/load Game.components as part of the preset.

Reason being that Game.components can be part of anything in an actually running game. Which could potentially cause a new game to become unplayable.

Imagine this: We are using a mod that includes a "zombiespawner" component and this component tracks how many ticks are left before a new horde of zombies will spawn on the players map. These ticks/timeleft will now be saved with the preset which will then cause the horde to maybe spawn almost immediately after starting the new game when the player isn't and cannot be ready for it. Because "World presets" loaded the ticks settings for the "zombiespawner" component from the preset file.
Azravos  [author] 19 Oct, 2024 @ 1:51am 
Reel: After disassembling "My Little Planet" I can see that the mod does indeed want to save something to the rws file. This specifically:
<li Class="WorldGenRules.RulesOverrider">
<subcount>6</subcount>
</li>

A crash most likely occurs if that data is missing leading to the game falling back to generating a new world from scratch instead of continuing with loading the actual preset.

I'll see if I can make it work. It might be a case of me just having to look for "Game.GameComponents" and save all of them seeing as WorldGenRules.RulesOverrider inherits GameComponent. Currently the only thing my save preset cares about is "World" so it doesn't really save game components.

If that fails the only thing left that I can currently think of is doing something like this in my save function:

if(mod.x installed) then do x

Which I'm not really a fan of as that could lead to me having to do that for all incompatible mods that people wishes to use. So that is really not an option.
Reel 18 Oct, 2024 @ 1:43am 
I've created my planet, however I learned the hard way that this mod does not work with the "My Little Planet" mod by Oblitus.

Initially when I tested it out, it would work. But only after you restart Rimworld it will default back to a vanilla sized planet, not saving any of the WorldEdit changes I made.

It makes zero changes to the RWS file, it only automatically reverts back to how basic world generation functions.

I can send you my RWS file & modlist over Discord if you need it.
Azravos  [author] 16 Oct, 2024 @ 2:20am 
Reel: Ah right. Well, let me know if your mod works the way you want it to with World Presets. if it does I'll add the image and description feature you requested, np.
Reel 15 Oct, 2024 @ 12:16pm 
My question about the xml was about using the RWS file to be recognized by an XML format, mostly so I don't have to guide them manually when it comes to installation.

I think users will be interested in using the hidden properties if they see my mods hit the workshop. Might need a wiki to help guide them into making planet mods.

Thanks for the response.
Azravos  [author] 14 Oct, 2024 @ 11:38pm 
Reel - Continued (due to max 1000 chars limit):
Regarding descriptions and images. It would probably not take a whole lot of coding to add those features depending on how you want it solved. E.g just adding a .png and .txt or .xml file that has the same name as the preset file which the interface during "load preset" shows is probably the easiest. While trying to bake it into the presetfile itself will probably take a bit more effort.

The bigger question however is how to make users saving a preset being able to utilize this without it just being some hidden feature.
Azravos  [author] 14 Oct, 2024 @ 11:38pm 
Reel: Hmm, well it's not something I had intended when i built the mod. But it should probably work having it as a dependency just like any other mod. Though it's ofc not something I can guarantee though. You'll just have to try and see what happens.

As for adding it as a dependency I think all you need to do is add this to your mods About.xml:
<modDependencies>
<li>
<packageId>Azravos.WorldPresets</packageId>
<displayName>World Presets</displayName>
<steamWorkshopUrl>steam://url/CommunityFilePage/3336572355</steamWorkshopUrl>
</li>
</modDependencies>

(Though you'll need to manually add "required item" to the workshop item as well, after you've uploaded the mod as that is not something steam will pick up from the about.xml automatically)
Reel 14 Oct, 2024 @ 4:59pm 
Is this mod viable to be used as a required framework? And how can I do it through XML?

I was making a bunch of Planet mods with WorldEdit2.0, but later found out that the planet system in that mod is bugged & unplayable. As a result, I have to either postpone the mod, or use this.

If so, could you add a feature that lets us write descriptions and add images? I've designed custom planet art for the mod that I'd like to use.
Azravos  [author] 5 Oct, 2024 @ 9:58am 
BK: That is currently not possible.
Azravos  [author] 5 Oct, 2024 @ 9:56am 
I have now updated the mod to allow saving a preset even during an active game. Note: This is highly experimental feature, and the (old) player faction will be removed from the game when loading such a preset to avoid getting like a gazillion errors.