Ludeon Forums

RimWorld => Mods => Topic started by: The_Apothecary on July 16, 2015, 10:51:14 AM

Title: [Mod Request] Ruins, ruins and more ruins!
Post by: The_Apothecary on July 16, 2015, 10:51:14 AM
This is a pretty simple request, I hope that it isn't too major and is something that a modder would be willing to take up.

As you are all aware of the ruins that you can find dotted around on your embark location and are usually fairly simple and rather uninteresting. Often just a square or rectangle room with nothing much going on. However, that's where I want it to change.

Rather than only occasionally having an "Ancient Evil" I was hoping that perhaps we could flesh it out a little bit more? Maybe some more intricate ruins. So for instance rather than JUST seeing the common walls and floor with their usual design, we could perhaps see something a little like what players make.

For instance a ruined version of this image:

(http://theabsolutemag.com/wp-content/uploads/2013/10/steamworkshop_webupload_previewfile_183032873_preview-976x610.jpg)

With the removal of key things such as the solar panels, and perhaps leaving the turrets active only made to shoot at your colonists as you approach the desolute ruin. Collapsing a few of the walls and perhaps caving in a few of the dug out homes!

I would like to see ruins that look like someone was here before! Not just walls and a floor! Perhaps special events associated with a handful of the ruins?

How I imagine this could be done, would be to set it so that on the generation of the embark zone a pre-made ruin is loaded up from a large selection that could be contributed by players and the modding community. One of these said ruins is loaded and installed into a location on the embark map so you can either see it on your screen as you set your colonists to do their chores and work, or perhaps it is located somewhere in the mountains you embarked upon? Just waiting to be discovered?

Perhaps people could find ruined ships? Maybe old colonies? A raider's hideout? Or perhaps something more sinister? Maybe something friendly too? Perhaps an abandoned trade station, mining town or what have you?

Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Alistaire on July 16, 2015, 11:08:13 AM
The reason ruins are only rectangles is because Tynan didn't have time / hasn't spend time writing a more advanced ruins generator.

Looking at other games you can see it's possible, but if you dive into such a challenge it should instantly become clear it's not an easy thing to
add. If you can write a random dungeon generator which works inside and outside of caves, doesn't go through other random dungeons and
gets restricted in some way so it doesn't span the whole map nor consists of just a single room, you're a genius and should instantly switch
careers. For the rest of us, it's a lot of trial and error with a very limited feedback because your life is literally not long enough to iterate
through every possible map layout.

Your idea of collecting a player-made bunch of ruins means there first of all should exist a format in which to save ruin files. If a player builds
his/her base into a rock (as your screenshot demonstrates), should the rock walls be saved too? Should this structure only be generated in the
exact map layout presented in the screenshot? Which walls and floors should always be preserved and which should not? Should some walls
only be built under roofs? These are all questions a ruin maker would have to ask with each wall in his/her map layout, making it a tedious
process very prone to errors which would result in weird map generation.
Along with that, how would you turn them into ruins? Explosions would damage other parts of them map, and if you were to save which walls
wouldn't be affected by explosions that'd be another layer of data every ruin would have to have inside of it.
Let's say you're able to get all this information, what file would you save it in? XML files would be very inefficient for this kinda information.
Should anything about it be human readable?

As you can see, random generation is the more sane option for ruin creators (although it might be worse for the code creator). Generating
large amounts of interesting structures is not easy, making this request a pretty heavy challenge for any modder out there. I bet there's
some people out there who want to take it on, but at this Alpha stage of the game such mods might not be the best thing to make (Alpha 12
will include animal breeding, something people have requested mods for for a while) and Tynan ought to work on it himself when he got the
time.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Sempie on July 17, 2015, 02:59:03 AM
While Alistaires point is absolutely correct, there's a relatively easy way to implement prebuild ruins, if the dataformat-problem is solved.

Let's say a prebuild ruin is 40x50 blocks large. Now simply search an open tile of the map with the min size of 40x50 where no rock, water is found. If there's mud, replace the mud with dirt.

This way is very limited, but at least a way to implement interisting stuff.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: paragonid on July 17, 2015, 03:51:10 AM
Some maps could be abandon cities where the whole map is a ruin.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Enjoyment on July 17, 2015, 04:59:38 AM
As long as there isn't deeper repair system (with material cost and non-working damaged structures), I don't personally see much sense in creating such mod (I'm not saying I CAN do it though). And since every new map could generate these ruins every time you create new game in different way, there'll be a great chance to find one that will be too OP... IMHO
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Sempie on July 17, 2015, 05:48:30 AM
Not at all!
Of course, the creation must have some limiter, else there would be a chance to spam turrents all over the map or something. However, the solution isn't that hard.

An example:
   Numbers are placeholders.
   Lets say the ruincreator got 15.000 points to spent in ruinparts.
   There's a "pricelist" which declares the cost of points for every part, like a wall could cost 3 points, a stove 150, a turrent 4.000 and whatever,...
   
   First step, rooms:
      Like XXXX points are reserved for walls.
      There's a min of 2 rooms and a max of 9 rooms.
      Now the creator starts with a first room with a random size, like 3x11. max size of a room is ( reserved points for rooms / 2 ) / costs to border this.
      A new room cannot be set within 3 tiles away from another room.
      When there are 5 rooms, there's a 60% chance that the next room will use all the points left.
      Now we got a first room area, this area will be surroundet by walls where every tile has only a 85% chance of spawning a wall.
      Every side of the room has a 40% chance of spawning one wall at a random tile thats no corner.
   
   Second step, tables:
      XXXX points are reserved for craftingtables, where a stove costs 200, a furnance 700 and so on.
      Now a random room with no table inside is choosen and a table will be placed inside at a wall with the users-spot inside the room.
      When the points left are smaller than the cheapest table or there are no more free rooms, this step is done. spare points are left for other things.
   
   Third step, furniture:
      This one is tricky, but the mechanic should work simmilar to the second. I won't get into that too deep.
      
   Fourth step, energy:
      If there are energy consuming things, than a randomly choosen powersupply will be set.
      and a random of 1-3 battarys will be set randomly outside the rooms.
      Now everything gets wired on the shortest way, where every tile of cable got a 90% chance of spawning a cable.
   
   Last step, defense:
      The points spend are not equal in every scenario. One time the creator might spend 15k, one time maybe only 3k.
      Depending on the ruins value, there will be set more or less turrents. Higher value means more turrents. Lets say there's one turrent for every 3k of points spent.
      These turrents must not need energy, so the user really has to destroy them before he can take the ruin.
      
      
   This is really just a raw concept and lacks of details and would not work if implementet in exactly that way. However, its an idea of how to deal with ruins.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: The_Apothecary on July 17, 2015, 06:01:50 AM
Sempie has it figured out exactly the way I want it, is there anyone that would be willing to try and make this mod? It would be interesting and it would be fun to see implemented.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Sempie on July 17, 2015, 06:19:44 AM
Well, I'm a programmer but never moddet a game before. This weekend I'll start working on my first mod https://ludeon.com/forums/index.php?topic=12666.0 (https://ludeon.com/forums/index.php?topic=12666.0).

Depending on how good process is and if have fun modding, I might do that in future (speaking of at least months).
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Sempie on July 17, 2015, 06:24:00 AM
I tend to learn such things relatively fast. While doing this, I'll keep in mind to do this ruin project later, if modding is fun. However, you might workout a more detailed concept so I, or whoever will do this project, can focus on coding without the timeeating design stuff.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Alistaire on July 17, 2015, 10:06:37 AM
@Sempie

If you're going to do this, you might want to post the results in Mod requests for vanilla (https://ludeon.com/forums/index.php?topic=13182.0) too. Tynan might implement it if it's good enough.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: The_Apothecary on July 17, 2015, 05:09:59 PM
How would you like it to look Sempie?
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Sempie on July 20, 2015, 08:10:13 AM
However you like.
I already got some raw algorithms up for area_selection and room_cration.
This is the fun-part for me.
They're raw and first tests will show which mistakes where made or which strange things will occure that I've never thought about.

However, things like "selecting the suitable wall_material for that biome"(this one is pretty easy, thou...) or simply the balancing-stuff(this one is pretty grinding) is not the fun-part for me.

I could take some suggestions on how much stuff should cost the creator.
Also, I'll have fun writing the functions to find the suitable spawningpoint for turrents, but I have no idea which parameter I'd should consider. For example, the turrent will be useless if surroundet by walls. To mention this specific situation is simple, but there are endless other. What to consider while placing the turrents, the batteries(if there are some),... should I make (damaged) defensive-walls?

You might got the Idea of what kind of help I could take.
Title: Re: [Mod Request] Ruins, ruins and more ruins!
Post by: Sempie on July 21, 2015, 11:38:25 AM
Started to work on code now, got to grin a little while reading this one:

if (allDefsListForReading[i].costList != null)

Seemingly, I wasn't the first who thought about the costList.