Ludeon Forums

RimWorld => Ideas => Topic started by: Mufflamingo on January 12, 2016, 07:43:13 AM

Title: Second floors?
Post by: Mufflamingo on January 12, 2016, 07:43:13 AM
As the title says, is it possible to have upper floors?
Title: Re: Second floors?
Post by: MarcTheMerc on January 12, 2016, 12:38:57 PM
Short answer no, long answer noooooooooooooooooooooooooooooooooooooooooo.

However it is possible but would take alot of work for z levels and the every tile of the map would have to be rendered for every floor. Also ai pathing would need overhauling.
Title: Re: Second floors?
Post by: Fluffy (l2032) on January 13, 2016, 03:14:01 AM
not going to happen.

Besides just not being the point (this isn't dwarf fortress, no matter how much some of us would like it to be), it's a huge increase in requirements for an already heavily overworked pathfinding system. Keep in mind that every z-level adds basically a whole new map, the number of squares in a normal map is x * y, with z levels it'd be x * y * z; a nearly quadratic increase in number of squares, and thus the difficulty of pathfinding.

On a more practical note, the game is built in unity engine, which uses vectors of length three a lot internally, these are x,y,z coordinates. You might think that makes it easy to do z-levels, but the game actually uses the z coordinate for 'normal' height/size calculations of buildings, pawns, etc. Changing all that so it would work with z levels is pretty much a fundamental rewrite of huge parts of the game.
Title: Re: Second floors?
Post by: jzero on January 15, 2016, 03:34:56 PM
I think besides all the reasons the guy before me mentioned one of the reasons this game can't handle that compared to dwarf fortress is that in dwarf fortress the graphics (at least the default one anyway) is VERY simple and so it isn't that hard to render.
Where as in Rimworld the graphics are pretty good and it would literally take about as long as it takes to load your map when you start the game EVERY time you went up or down a z-level. and in addition to that the gunplay wouldn't really work unless the whole view thing only shows the second floors of buildings. It wouldn't make sense if once a colonist shot, the bullet disappeared, and you went down a level to see what happened. While this would be great and all, it just won't happen
Title: Re: Second floors?
Post by: Headshotkill on January 20, 2016, 03:11:49 AM
Quote from: pothangaena on January 12, 2016, 07:43:13 AM
As the title says, is it possible to have upper floors?

I think when you start asking for multiple Z-levels, it's time to try out Dwarf Fortress, Rimworld acts as a wonderfull tutorial for it.
Title: Re: Second floors?
Post by: Fluffy (l2032) on January 20, 2016, 08:30:35 AM
Quote from: jzero on January 15, 2016, 03:34:56 PM
I think besides all the reasons the guy before me mentioned one of the reasons this game can't handle that compared to dwarf fortress is that in dwarf fortress the graphics (at least the default one anyway) is VERY simple and so it isn't that hard to render.
Where as in Rimworld the graphics are pretty good and it would literally take about as long as it takes to load your map when you start the game EVERY time you went up or down a z-level. and in addition to that the gunplay wouldn't really work unless the whole view thing only shows the second floors of buildings. It wouldn't make sense if once a colonist shot, the bullet disappeared, and you went down a level to see what happened. While this would be great and all, it just won't happen
Actually, graphics aren't really the issue.

There's two reasons this is not going to happen;
The existing code is just not set up to deal with z-levels. It would require pretty much a complete rewrite of large parts of the code.
Pathfinding complexity would increase exponentially. You're going from a plane (x * y) to a cube ( x * y * z ). I know you're not suggesting more that two levels, but if z-levels were to be done you might as well do it properly. In that case, assuming a map size of 150 * 150, you're looking at a 22.500 cell map. Each z level adds another 22.500, so in a very naive calculation the complexity of pathfinding is increased nz-fold, where nz is the number of z levels. I'm sure there's tricks to be done to decrease this somewhat, but if you realise that pathfinding is already the most complex part of the game, you'll pretty soon realise that z-levels are not really feasible without a massive paradigm shift in the game the works.

TLDR;
Not gonna happen, Ty might as well code a new game instead.
Title: Re: Second floors?
Post by: blub01 on January 22, 2016, 05:48:29 AM
one thing I'm always wondering, why is it so hard to do z-levels in rimworld, when minecraft for example has them, and actually has more stuff loaded in than rimworld on high render distances. I mean, one chunk contains 16*16*256 blocks, and you can have a render distance of 12 chunks. I don't remember if that means a square with a side length of 24 chunks (or 12), or if it's an approximate circle, but that is way more than rimworld does in any case. so again, why is it an issue for rimworld? also, the problem with only being able to view single layers could be solved by ditching the top-down view for a first person camera.
Title: Re: Second floors?
Post by: Fluffy (l2032) on January 22, 2016, 08:11:58 AM
It's not rendering that's the main issue, it's pathfinding and finding items.

Adding z-levels exponentially increases the complexity of both. While finding items can be to some extent trivialized by keeping lists of item locations, z-levels would increase the amount and size of such lists. Pathfinding is a bigger issue, as it is much more dynamic. Z-levels just add many more options in how to get from A to B. There's plenty of optimization tricks that can (and are) done, but the net result remains; z-levels make things much harder - unless some major simplifications are used (e.g. dwarf fortress counts z levels as being 1 'distance' away, regardless of the path that dwarves actually have to take to get there).

I'm not big on minecraft, but my understanding is that there's not that many AI entities walking around on the map, and those that do mostly either wander or follow (attack) the player, both of which are fairly trivial. Compare that with RimWorld where there can be quite a few pawns (colonists, visitors, raids and animals) each of whom try to first find a job to do. Finding a job usually requires several checks; a) can I reach it? b) are the materials I need available? c) how do I get there?. The first two are highly optimized but can still be quite resource hungry, the third is the pathfinding problem, and takes the most time. Then take into account that each of these pawns goes through this every time it tries to find something to do, and you're hopefully starting to see the problem.
Title: Re: Second floors?
Post by: Ectoplasm on January 22, 2016, 09:19:57 AM
Somewhere out there's a darkened room. A room which last saw sunlight over a decade ago. The door hinges are rusted stiff, and creak from lack of use, the bottom of the door jams barely one fifth open. The floor is littered with empty energy drink cans. Old copies of MS-DOS monthly are strewn across the floor, and in one corner is a stack of very well used Sears Lingerie Catalogs, the stack reaches almost to the ceiling.

The only source of light is from a single low wattage bulb dangling precariously from thread bares wires. The distinct click click click of a mechanical keyboard denotes someone hard at work. And in the furthest, darkest corner, where daylight is eon aged memory, a huddled figure suddenly stops working. Tynan decides there and then that Z-levels and multi thread support will be in Rimworld II.

One thing at a time though, alpha 13 is due. Click Click Click.
Title: Re: Second floors?
Post by: skullywag on January 22, 2016, 12:58:03 PM
Thread was worth it just for that ^ *claps*
Title: Re: Second floors?
Post by: blub01 on January 24, 2016, 05:55:52 AM
Quote from: Fluffy (l2032) on January 22, 2016, 08:11:58 AM
It's not rendering that's the main issue, it's pathfinding and finding items.

Adding z-levels exponentially increases the complexity of both. While finding items can be to some extent trivialized by keeping lists of item locations, z-levels would increase the amount and size of such lists. Pathfinding is a bigger issue, as it is much more dynamic. Z-levels just add many more options in how to get from A to B. There's plenty of optimization tricks that can (and are) done, but the net result remains; z-levels make things much harder - unless some major simplifications are used (e.g. dwarf fortress counts z levels as being 1 'distance' away, regardless of the path that dwarves actually have to take to get there).

I'm not big on minecraft, but my understanding is that there's not that many AI entities walking around on the map, and those that do mostly either wander or follow (attack) the player, both of which are fairly trivial. Compare that with RimWorld where there can be quite a few pawns (colonists, visitors, raids and animals) each of whom try to first find a job to do. Finding a job usually requires several checks; a) can I reach it? b) are the materials I need available? c) how do I get there?. The first two are highly optimized but can still be quite resource hungry, the third is the pathfinding problem, and takes the most time. Then take into account that each of these pawns goes through this every time it tries to find something to do, and you're hopefully starting to see the problem.

yes, finding a job might be tough on the cpu, especially for the more complicated ones, but these checks don't happen that often for pawns. and pathfinding ought to be much simpler when there aren't that many places where you can go from one level to the next. just keep a list of them, and select the closest one that leads to the intended level. that should reduce pathfinding to mostly 2d again, right? also, I'm pretty sure there can be quite a few mobs around in minecraft, maybe like 30 or so at least. so until you get to 40+ tribal raids, that should work, right?
Title: Re: Second floors?
Post by: Fluffy (l2032) on January 27, 2016, 04:21:01 AM
Finding jobs happens more often than you think, especially when pawns are currently idle.
There's typically 3 colonists and several dozen animals on the map from the start. Late-game colonies can theoretically have hundreds of colonists (though 20~ might be more reasonable), and raids can start going into the hundreds.
Optimizations are certainly possible, but the simple fact remains that the quantity of available paths just increases dramatically.
All that aside, the changes to the code would be _very_ dramatic.
Title: Re: Second floors?
Post by: killer117 on January 27, 2016, 05:18:44 AM
i dont really see the point. i ussually ave the problem of loads of building space and empty rooms and nothing to do except turn them into storage rooms. tbh id prefer content over Z lvls. give me some stuff to build so i need the space in an upper floor, but until then, ive got too much space as is.
Title: Re: Second floors?
Post by: LouisTBR on January 27, 2016, 06:42:03 AM
Great idea. HUGE ask. You see, although it seems like a really good addition to the game, there are some underlying factors that make it nearly impossible:

Pathing: Pathing is already a tedious affair to get it working, and with the addition of second floors it will need double the programming
Visuals: Rimworld is top-down view, which will make two levels a bit odd. You could counter this with a Sims-like 'Up Floor' button, but that would be annoying to constantly use

Raids: Raids would be completely pointless, as you could just hide all your colonists upstairs and wait for the raiders to get bored and leave

Access: Staircases? They would take up loads of space. Elevators? Good luck programming them to work properly

See what I mean? You are by far not the first person to suggest such addition. Again, great idea, HUGE ask on the developer's half.
Title: Re: Second floors?
Post by: blub01 on January 27, 2016, 11:03:56 AM
Quote from: Louisthebadassrimworlder on January 27, 2016, 06:42:03 AM
Raids: Raids would be completely pointless, as you could just hide all your colonists upstairs and wait for the raiders to get bored and leave

until the raiders burn the wall supporting the upstairs.
Title: Re: Second floors?
Post by: StorymasterQ on January 27, 2016, 07:41:06 PM
Quote from: blub01 on January 27, 2016, 11:03:56 AM
Quote from: Louisthebadassrimworlder on January 27, 2016, 06:42:03 AM
Raids: Raids would be completely pointless, as you could just hide all your colonists upstairs and wait for the raiders to get bored and leave

until the raiders burn the wall supporting the upstairs.

JET FUEL CAN'T MELT STEEL BEAMS!

(cough)

...

(chirp)

...

No one?
Title: Re: Second floors?
Post by: jzero on January 27, 2016, 11:20:12 PM
Quote from: StorymasterQ on January 27, 2016, 07:41:06 PM
Quote from: blub01 on January 27, 2016, 11:03:56 AM
Quote from: Louisthebadassrimworlder on January 27, 2016, 06:42:03 AM
Raids: Raids would be completely pointless, as you could just hide all your colonists upstairs and wait for the raiders to get bored and leave

until the raiders burn the wall supporting the upstairs.

JET FUEL CAN'T MELT STEEL BEAMS!

(cough)

...

(chirp)

...

No one?

*slowly pats head*

shhhhh lets just all continue ignoring that
Title: Re: Second floors?
Post by: _Shadowcat_ on January 28, 2016, 08:41:27 PM
Quote from: Fluffy (l2032) on January 20, 2016, 08:30:35 AM
Actually, graphics aren't really the issue.

There's two reasons this is not going to happen;
The existing code is just not set up to deal with z-levels. It would require pretty much a complete rewrite of large parts of the code.
Pathfinding complexity would increase exponentially. You're going from a plane (x * y) to a cube ( x * y * z ). I know you're not suggesting more that two levels, but if z-levels were to be done you might as well do it properly. In that case, assuming a map size of 150 * 150, you're looking at a 22.500 cell map. Each z level adds another 22.500, so in a very naive calculation the complexity of pathfinding is increased nz-fold, where nz is the number of z levels. I'm sure there's tricks to be done to decrease this somewhat, but if you realise that pathfinding is already the most complex part of the game, you'll pretty soon realise that z-levels are not really feasible without a massive paradigm shift in the game the works.

TLDR;
Not gonna happen, Ty might as well code a new game instead.
The problem is that colonists don't move in X*Y*Z they move in X*Y (or Y*Z because unity is weird if I remember correctly), trying to tell it to go up ramps would probably break the program. So just simply cheat the method. The first block here would have to be what project type the game is in unity, if it's 2D then SoL as 2D removes the third vector and we'd have to get more cheaty but not impossibly so. If it's 3D with a top down camera then it's even easier (relatively, the 2D would probably be simpler but I've worked more with 3D). For Z-levels simply add a third vector to every item and a 'stair' tile. When a colonist receives a vector that denotes its target on the second floor the colonist will pathfind to a stair, the stair will then move the colonist up or down respective of the Z level to the coordinates of the stair tile above or below. The pathfinder then only has to find another X*Y.

So breaking it down, different Z coordinate triggers the pathfinder to target a "Z level manipulation device" then path from the next level's matching coordinates of the Z level manipulator to the target. Cutting a X*Y*Z pathfind into 2 X*Y path finds.

Now the real limiting fun would be adjusting things like shooting from different heights, roofs which are currently non-physical objects, mountain generation accounting for two levels and floor collapsing. Heat transfer as well.

If unity is running 2D then the game instance would have to run two maps seperated by an impassable scroll border. The stairs would have to move the colonists to [current coordinates + (difference in distance from that maps relative zero to the next map over relative zero)] and anything in the first map would have to be marked with a quasi-Z level 1 and anything from the second map would have to be marked with a quasi-Z level 2.

2D interaction between levels with shooting/temperature would be a very large nightmare of coordinate manipulation and math.

The processing demands wouldn't be too challenging, most natural structures don't extend above 1 Z-level it seems so the only thing being loaded will be natural stone walls and air, possibly ruins if tynan put in such a thing.


Tl;dr I don't see it as impossible I just see it as any other major addition to a game would be.