[A16][WIP] Persistent Worlds [7.1.17 AEST][Features updated]

Started by scuba156, December 21, 2016, 10:01:42 AM

Previous topic - Next topic

scuba156

I've been a bit unwell for a few days so things slowed down a bit but will get back into it later today.

I haven't posted any updates so far but the next update will have, at least, the following changes:

-Old maps are now saved into a separate file per map
-Each map file has the modIds and modNames of the world
-Added playLogHandler and playSettings Handler
-old maps are loaded when visiting old bases
-a few other other things I've probably forgotten

Helixien

Let me just say that I love this idea and the mod! I always wanted to make multiple colonies and factions on one planet!

Just a simple idea for the future, since you want to implement that buildings turn into ruins over time, when starting a new game with an exisitng world, let us choose how much time has passed since the last colony. for example 2 days will make no changes, but say 100 years and the colony is abandoned and when say, the player chooses, 1000 years, the base is just a ruin.

scuba156

Quote from: Helixien on January 09, 2017, 08:05:18 AM
Let me just say that I love this idea and the mod! I always wanted to make multiple colonies and factions on one planet!

Just a simple idea for the future, since you want to implement that buildings turn into ruins over time, when starting a new game with an exisitng world, let us choose how much time has passed since the last colony. for example 2 days will make no changes, but say 100 years and the colony is abandoned and when say, the player chooses, 1000 years, the base is just a ruin.
Thanks!

That's a great idea, and it will be easy to implement. I'll add it to my list of things to do!

scuba156

Quote from: scuba156 on January 09, 2017, 02:43:23 AM
I've been a bit unwell for a few days so things slowed down a bit but will get back into it later today.

I haven't posted any updates so far but the next update will have, at least, the following changes:

-Old maps are now saved into a separate file per map
-Each map file has the modIds and modNames of the world
-Added playLogHandler and playSettings Handler
-old maps are loaded when visiting old bases
-a few other other things I've probably forgotten
Just an update on the above. I was hoping to have this out already but I ran into a few hiccups last night (was working on it till 5am) and will continue on it tonight.

When I was working on map loading, I wasn't able to get any 'thing' to spawn other than placed floors and the roofgrid. After an hour or so of scratching my head, I did the thing I should of done first, check if the data is actually being saved correctly, which is isn't. D'oh.

Compressible map things weren't being saved, but at least I know where to start when I get back into it next.

scuba156

So, fun story.

Was working on the issue above, of getting the list of 'things' in a map to save. I was getting null reference errors, Invalid cast exceptions, and a few more weird things that would take too long to explain, when everything seemed like it should work. Just over 2 hours of racking my brain trying to understand what was going wrong, rereading my code and comparing to source, thinking that maybe its impossible to do without having hundreds of detours (which would be dreadful to write them all, and break so much mod compatibility), until i realized I had left a single line in there that was re-initializing parts of the map :(

So much time wasted, and I still have a few errors to deal with but at least I know the reason for these ones. I probably wont be able to get an update out tonight because of this but I can at least move on now.

scuba156

This is starting to feel like a blog. Hopefully someone out there is reading it and finding it interesting.

As I thought, I wasn't able to finish it up in time to be able to push an update out. I progressed on some things and regressed on others. Maps now load perfectly when attacking your old base. Everything loads into the map, including buildings and pawns, your pawns from the caravan are spawned on the edge of the map as usual and the maps owning faction pawns are enemies.

I have not tested a map that has been taken over by a new faction because, as I mentioned, some things have regressed and that is map saving. Currently it seems that loading/saving a map using Map.ExposeData will reference some things like PlayerColony faction and the mapUI (looking for the colonistBar), which do not exist until after pawn selection and the game is in play mode respectively.

I originally had map load/save happen just after selecting a world to load, but the needed references don't exist yet which creates a lot of exception messages which is not good, even though it saves the map. So now I have to find a good spot to handle the maps, or find some way around the above errors.

Seeker89

Have no fear... I am reading this...

I wondering though, wasn't something like this in the game at some point?

scuba156

Quote from: Seeker89 on January 11, 2017, 02:13:57 PM
Have no fear... I am reading this...

I wondering though, wasn't something like this in the game at some point?
Glad to hear someone is :)

I'm not sure if it was in there, I only joined the RimWorld colony in late A15.

I didn't work on this yesterday. I worked on and released Mod List Backup. It let me have a break from this mod and will also be useful when loading different worlds.

BlackSmokeDMax

Quote from: Seeker89 on January 11, 2017, 02:13:57 PM
Have no fear... I am reading this...

I wondering though, wasn't something like this in the game at some point?

Think it was back in Alpha 13 (not positive on that # though) and previous that you used to first generate a world. Then you would generate a colony on that world. So back then you could easily generate multiple colonies per world. Of course there was nothing in there at the time like in A16 where the world was actually more alive with factions. Everything was static at the time, so there really wasn't a lot of point in actually generating multiple colonies on the same planet. IIRC, it was also nothing like DF where you could actually go back and try to re-inhabit a colony that failed.

Nomsayinbrah

Wow, actually a really great idea.. really nice constant updates

(Sorry if this has been said already) but what if your colony dies (with ur base)
will there be a possibility of someone else living inside ur base when you return to it? or would that be too hard to implement?

scuba156

Quote from: Nomsayinbrah on January 13, 2017, 04:40:06 AM
Wow, actually a really great idea.. really nice constant updates

(Sorry if this has been said already) but what if your colony dies (with ur base)
will there be a possibility of someone else living inside ur base when you return to it? or would that be too hard to implement?
That's the plan! :) If your colony dies during a raid or something, that base now belongs to that faction. If your base was abandoned then their may be visitors when you return.

My other mod is finished, and I will be returning to work on this one. Current thoughts are that I might scrap how I load/save maps, and parse through the map data manually instead of using the built in method. This will give me better control but also make it harder to update for future patches.

scuba156

Sorry for the lack of updates. This mod is definetly not dead and I'm still doing small bits of work to it at times.

I've changed parts of it so that map saving is done using Linq rather than using RimWorlds Scribe methods. This allows me to manipulate the map without having to deal with RimWorld wanting to resolve refs. RimWorlds current saving/loading method is a whole lot of spaghetti code that I hope to see improvements on in future RimWorld releases which would make this easier.

Currently map saving and loading is working, including building and pawns, but there are a lot of errors as things have some old references that need to be changed. I will push an update once some of this has been fixed.

Senio

Quote from: scuba156 on January 20, 2017, 09:26:40 PM
Sorry for the lack of updates. This mod is definetly not dead and I'm still doing small bits of work to it at times.

I've changed parts of it so that map saving is done using Linq rather than using RimWorlds Scribe methods. This allows me to manipulate the map without having to deal with RimWorld wanting to resolve refs. RimWorlds current saving/loading method is a whole lot of spaghetti code that I hope to see improvements on in future RimWorld releases which would make this easier.

Currently map saving and loading is working, including building and pawns, but there are a lot of errors as things have some old references that need to be changed. I will push an update once some of this has been fixed.

Good job
Waiting this mod  ;D

Techgenius

Your work is commendable, I hated how the development decided to cut out world generation like it used to be, I loved reusing my worlds, now.. having to generate a new world each time is so annoying, but hey, persistent worlds fixed this, incredible work!

rdz1122

What a great idea; I love the idea of revisiting an old base, especially if it has been taken over.  I was hoping that I could "gift" my abandoned base as I leave the planet (seems such a waste), but this is just about as good!