Second floors?

Started by Mufflamingo, January 12, 2016, 07:43:13 AM

Previous topic - Next topic

StorymasterQ

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?
I like how this game can result in quotes that would be quite unnerving when said in public, out of context. - Myself

The dubious quotes list is now public. See it here

jzero

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
Actual cannibal shia labeouf.

_Shadowcat_

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.