Interested in making a basic external tool, need help!

Started by yoshi45111, August 12, 2020, 10:15:53 PM

Previous topic - Next topic

yoshi45111

Hi there, I've been wanting to make some sort of external tool that could take (or even generate) seeds, run the random generator and output the name the generator has chosen for the planet from the namelist. An explanation of what I mean: 

1. I type a seed into this tool
2. It runs the algorithm
3. It gives me the name of the planet this seed created
4. I can put that same seed into the actual game and it will produce the same name


Nothing to do with terrain generation or anything else, I'm solely focused on the name generator for now.

Even as someone with admittedly very limited C# knowledge, I think I've managed to narrow down the location in the source code where the game makes this generation to a few classes:

- RimWorld.Planet/WorldGenerator
- RimWorld/NameGenerator
- Verse/GenText


I'll include an attachment of the WorldGenerator class, for reference. Not sure which one of these exactly is where the name gets defined, to my untrained eyes it looks like a web referencing different areas that I can't understand.

Any help or insight from the extremely talented modding community I know congregates here would be much appreciated, even some idea of where to look or where to go next with this idea would mean the world! Thank you  :)

Tynan

You would have to somehow setup the same context (seed) as the game and then run the exact name generation code with the same content. I think it'd be possible to do as a mod fairly straightforwardly, but doing a separate tool would be much harder to impossible and probably not worth the intended use.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

yoshi45111

Quote from: Tynan on August 13, 2020, 11:55:38 AM
You would have to somehow setup the same context (seed) as the game and then run the exact name generation code with the same content. I think it'd be possible to do as a mod fairly straightforwardly, but doing a separate tool would be much harder to impossible and probably not worth the intended use.

Thank you so much for the reply! I think I understand what you're saying. I will take a look at running it within the confines of the game, that makes sense to me. I know it's not a very high value mod and the intended use is fairly limited I'm using it mainly as a step-off point to try and learn the language the game uses  :P

yoshi45111

Alright I managed to do it! For Anyone who visits this thread, here is the pretty barebones code I created, it is very basic but accomplishes my goal. It is inserted into the WorldGeneration.cs. Simply put, whenever you generate a RimWorld world, it also writes a file to wherever you choose of 25 random seeds and the names of the Planets they produce. Hopefully plugging this seed into the game will give you the same world. It's very barebones but with a little work could be expanded to include more aspects of the random name generator, but that's beyond my skillset  :P