Potential Buildings

[quote=“Soron, post:59, topic:913”]Kevin tidied up the code a little (mainly updated it to the current version, since LazyCat’s code was written for something like 0.3 - lots of behind-the-scenes changes since then). His update is available here: https://github.com/kevingranade/Cataclysm-DDA/tree/z-level-kludge

Still needs a bit of work before it’s ready for mainline, though. It sounded like Kevin wants to see it possible to interact with other z-levels, such as sniping zombies from an upstairs window. I know that I want to see monsters actually drop when they’re supposed, before I’ll consider merging it.[/quote]

It sound cool to shoot zombies from the roof, but how are you going to balance such huge advantage? Flying zombies?

I originally wanted to show ground level map instead of “airholes” on upper levels, but I don’t think it looks good, it looks like you are on the ground floor, plus having to manage and update two maps in the same time will most likely slow down the game significantly or would need serious changes in the code to avoid it. Lots of trouble for just one gameplay element, I don’t think it’s worth it. I’d rather concentrate to pull as much gameplay as possible from just having upper levels. Like jumping from balcony to balcony, from roof to roof, jumping of the skyscraper with a parachute or glider, jumping through 10th floor window in the pool, and stuff like that.

I wouldn’t suggest jumping over a hundred feet into a pool.

[quote=“Austupaio, post:60, topic:913”]Sorry for the likely silly question.

How exactly do you put these buildings together and then render them in-game for testing?

I’d be interested in submitting some buildings myself.[/quote]

You can make it in notepad, but you have to write a legend describing what tile is each symbol supposed to be. Here is example:

fill_background(this, t_pavement);

"\n\
|-+------------------+-|\n\
|     .  . 7 .  .      |\n\
|     .  .   .  .      |\n\
|#    .  .....  .     #|\n\
|#    .         .     #|\n\
|#    .         .     #|\n\
|#    .         .     #|\n\
|#    .         .     #|\n\
|#     .       .      #|\n\
|#      .     .       #|\n\
|......................|\n\
|#      .     .       #|\n\
|#     .       .      #|\n\
|#    .         .     #|\n\
|#    .         .     #|\n\
|#    .         .     #|\n\
|#    .         .     #|\n\
|#    .  .....  .     #|\n\
|     .  .   .  .      |\n\
|     .  . 7 .  .      |\n\
|-+------------------+-|\n\
\n\n",

mapf::basic_bind(". 7 # | - +", t_pavement_y, t_backboard, t_bench, t_chainfence_v, t_chainfence_h, t_chaingate_l),

Does that make sense? You can find the list with all the tile and their names, like “t_pavement”, in mapdata.h file you can download from git.

Great, thanks. I’ll look it into it.

Awww hell, I’m putting a 2x2x3 office tower in game but poop hit the fan. I have to define all 16 building tiles separately so that rotation at the 1st floor carries over to the parking garage below and the offices above. I’m going to shoot for an easy fix by keeping all tiles above and below the entrance tile as unique (so that the other building tiles can take reference from it) but I have no idea if it will work. It would also cause ugly things to happen if two identical office towers spawned next to each other.

[quote=“Austupaio, post:64, topic:913”][/quote]
I’ll get around to posting a detailed guide at some point, like the github setup one. I’d love to stumble on lots of buildings I’m not familiar with.

What is actually the problem? Don’t you have to define each tile separately in any case? Why would rotation need to be “carried” instead of to just use the same rotation for all the floors?

I'm going to shoot for an easy fix by keeping all tiles above and below the entrance tile as unique (so that the other building tiles can take reference from it) but I have no idea if it will work. It would also cause ugly things to happen if two identical office towers spawned next to each other.

Why would anything happen if two identical office towers spawned next to each other? What ugly thing would happen?

I’m compiling so I have a bit, when a map is being created it will simply create a matrix like

. . . >
. . V .
RRRR

[lot][lot][lot][house]
[lot][lot][house][lot]
[road][road][road][road]

When it comes time to actually create each tile/building it opens it with
"tile name", t_north, t_east, t_south, t_west, and t_above (I think)
So when it is time to rotate the tile to face the road it can only ask if the road is north, south, east, west, or above.
This is easy when the building is only 1 tile big but when it 3x3, for example, you open each tile individually and t_north doesn’t point to a rotated building it simply points to the name of the tile. So a 3x3,
ooo
ooo
oOo
[office][office][office]
[office][office][office]
[office][office_entrance][office]
If you tell the entire building to rotate because the road leading up to the building is on the east side it will look like.
ooo
ooO
ooo
[office][office][office]
[office][office][office_entrance]
[office][office][office]
Now each tile has to individually determine where it is by asking what kinds of tiles are surrounding it.
If you are below/above and asked what is below/above you, you only hear “office” not “office rotated 270 degrees.”

If you end up with two identical buildings next to each other you get
oooooo
oooooO
oOoooo
[office][office][office][office][office][office]
[office][office][office][office][office][office_entrance]
[office][office_entrance][office][office][office][office]
If the tiles can only see the 4 tiles to its NESW then it is not possible to determine where it exactly is between the two buildings.

The long term solution would be to convert everything into having its own tile,
oooooo
oooooO
oOoooo
[office1][office2][office3][office3][office6][office9]
[office4][office5][office6][office2][office5][office_entrance]
[office7][office_entrance][office9][office1][office4][office7]
This way office 1 always knows that it will have office2 and office 4 at a 90 degree angle so it can determine its rotation off of that.
Why don’t we do it like this? Because it would be a hell of a lot of work to change and it can be solved by making enough different buildings that having 2 spawn next to each other is extremely rare in such a large map. I’ve never actually seen it happen but it is inevitable with the code.

Office Tower Floor 1
My torch of clairvoyance doesn’t provide enough light for color resolution but you can see the general floor plan. Elevators and emergency stairs in the core that travel all the way up and down the building.

Office Tower Floor 2
This one isn’t actually on Z+1 just yet… but you get the idea.

Office Tower Parking B1
The vehicle elevators of course don’t work but this means that the vehicles wouldn’t have been able to escape either. :smiley:
Yup, demolition derby and vehicle parts in the basement. Squint I’ll be sure to add a door to the west stairs.

These aren’t properly stacked yet and the basement still uses outside pavement/sidewalk tiles yet but you can comment on general design.

It would be awesome if the team could code vehicles to work on those elevators. There could be a lot of spawns for cars in the parking garage but also be literally PACKED full of zombies (aside from the elevators and stair shafts). Like, every other tile inhabited by a Z.

If you end up with two identical buildings next to each other you get oooooo oooooO oOoooo [office][office][office][office][office][office] [office][office][office][office][office][office_entrance] [office][office_entrance][office][office][office][office] If the tiles can only see the 4 tiles to its NESW then it is not possible to determine where it exactly is between the two buildings.

The code that picks location for the starting tile should make sure there are no other buildings that close nearby.

The long term solution would be to convert everything into having its own tile, oooooo oooooO oOoooo [office1][office2][office3][office3][office6][office9] [office4][office5][office6][office2][office5][office_entrance] [office7][office_entrance][office9][office1][office4][office7] This way office 1 always knows that it will have office2 and office 4 at a 90 degree angle so it can determine its rotation off of that. Why don't we do it like this? Because it would be a hell of a lot of work to change and it can be solved by making enough different buildings that having 2 spawn next to each other is extremely rare in such a large map. I've never actually seen it happen but it is inevitable with the code.

Exactly. I thought it was already like that. There need not to be any changes in the old code, you just start doing it properly and define each tile separately, and I’ll make the code that arranges the tiles around starting tile according to it’s rotation, ok? Just make a simple one for example so I have something to wok with.

Office Tower Floor 1

Looks good.

It may not be that easy, when we get to row houses/ apartments/ condos then you’ll start to have multi-tile buildings that should/can be adjacent to “identical” type buildings. So, it’ll either have to be addressed with the fix below or on a case-by-case basis.

Most of the basic stuff is already done since I couldn’t get the entire school to rotate properly without it. I’m not sure if I’ll finish the school this weekend but you can expect to see it next if I don’t. The separation of all of the buildings tiles wasn’t used in the old code since the buildings were randomly generated inside as opposed to hard-coded. Should be fine with both versions, just more work.

Thanks

kilozombie: Ya, I wasn’t sure whether it should be packed with zombies, have a couple of Goloum type zombies/creatures, or be sparsely populated. I guess we can see what the dev’s think.

That problem is no more with separately defined tiles, and then we will put them wall to wall on purpose when we want to create rows of apartments and such.

Most of the basic stuff is already done since I couldn't get the entire school to rotate properly without it. I'm not sure if I'll finish the school this weekend but you can expect to see it next if I don't. The separation of all of the buildings tiles wasn't used in the old code since the buildings were randomly generated inside as opposed to hard-coded. Should be fine with both versions, just more work.

You mean you already did it with separately define tiles? Give me whatever you got, it will do.

All I need is something like this, for example:

//3x3 office building, ground floor z=0
t_offcice_ground_A, t_offcice_ground_B, t_offcice_ground_C,
t_offcice_ground_D, t_offcice_ground_E, t_offcice_ground_F,
t_offcice_ground_G, t_offcice_ground_H, t_offcice_ground_I,

//3x3 office building, basement floor z=-1
t_offcice_under1_A, t_offcice_under1_B, t_offcice_under1_C,
t_offcice_under1_D, t_offcice_under1_E, t_offcice_under1_F,
t_offcice_under1_G, t_offcice_under1_H, t_offcice_under1_I,

//3x3 office building, upper floor z=+1
t_offcice_above1_A, t_offcice_above1_B, t_offcice_above1_C,
t_offcice_above1_D, t_offcice_above1_E, t_offcice_above1_F,
t_offcice_above1_G, t_offcice_above1_H, t_offcice_above1_I,

//3x3 office building, upper floor z=+2
t_offcice_above2_A, t_offcice_above2_B, t_offcice_above2_C,
t_offcice_above2_D, t_offcice_above2_E, t_offcice_above2_F,
t_offcice_above2_G, t_offcice_above2_H, t_offcice_above2_I,

…and the stuf in mapgen.cpp:

case t_offcice_ground_A:
//your graphics for top-left corner of the ground level

case t_offcice_ground_B:
//your graphics for top-centre tile of the ground level (eneterance)

.
.
.

Separating the tiles like that doesn’t make it any harder for you since you are designing each tile separately anyway, right?

Is there a way to tag a generic building with a more specific ID for things like emails? (and maybe items and mobs?)

For sarcophagi, it’s cool if they all use the same stock of text, because they’re all part of the same organization. Same with labs and military installations. But offices could cover any number of different companies, and it will be weird if all their stuff is mixed together.

Basically, if you go into a Nuka-Cola office and look at the computers you shouldn’t find RobCo emails on the terminals.

[quote=“LazyCat, post:71, topic:913”][/quote]

I’m actually still using the old coding format for the office tower, simply keeping with convention. The only time that separate tile definitions are required are for large buildings that may be built together or for pre-defined 3x3+ buildings (the school). When the school is done then there shouldn’t be much else to do with the pre-defined code excepts to handle z-levels. Its just getting around to it now.

Thanks though, I’ll let you know if I get stuck of something.

The simplest way would be to either define all buildings of that type as belonging to Shodan Corp. or to randomize it so that a given 1x1 building is devoted to a given corporation. So the cubical office could be filled with only Shodan Corp. items/computer messages one time and only Nuka-Cola stuff the next. Entire floors of the office tower can be interchanged so what is now floor 2 could be randomized to floors 3 and 6 while different floors are inserted. You can’t really tell the entire tower to be Nuka-Cola without unique Nuka-Cola floors or adding an additional variable to pass between floors (a lot of work).

[quote=“acidia, post:73, topic:913”]I’m actually still using the old coding format for the office tower, simply keeping with convention. The only time that separate tile definitions are required are for large buildings that may be built together or for pre-defined 3x3+ buildings (the school). When the school is done then there shouldn’t be much else to do with the pre-defined code excepts to handle z-levels. Its just getting around to it now.

Thanks though, I’ll let you know if I get stuck of something.[/quote]

So you are designing/drawing each tile separately? How did you then decide to solve the problems you were talking about?

I’ve looked at the code. There is actually no need to define separated tiles or to limit building sizes in terms of overmap tiles. Thus I realize I can make it so you can draw the whole building as a single map no matter how big it is, and there would need to be only a single overmap tile defined per z-level, again no matter how many tiles the building actually covers.

[quote=“LazyCat, post:75, topic:913”]So you are designing/drawing each tile separately? How did you then decide to solve the problems you were talking about?

I’ve looked at the code. There is actually no need to define separated tiles or to limit building sizes in terms of overmap tiles. Thus I realize I can make it so you can draw the whole building as a single map no matter how big it is, and there would need to be only a single overmap tile defined per z-level, again no matter how many tiles the building actually covers.[/quote]

For the tower, I may simply keep the tile that was in the sw corner (entrance) for each level as a separate/unique tile, all the other tiles rotate based on its location. I typically just sketch the buildings in notepad and split the map into 24x24 sections. It only really takes an additional ~10 min to do a map in tiles verse one map but for 3x3 buildings a single map might be useful for rotation. Probably isn’t worth the work to have a limitless map size. Procedural generation using tiles will be used for the mall/military base/sprawling structures.

For game balance, I really like the idea of underground parking ramps with non-functioning elevators. That way you can give players a large stock of auto parts without just handing them a vehicle. They’ll have to chop up cars, lug the parts up stairs, and then reassemble their own custom deathmobile.

[quote=“acidia, post:76, topic:913”][quote=“LazyCat, post:75, topic:913”]So you are designing/drawing each tile separately? How did you then decide to solve the problems you were talking about?

I’ve looked at the code. There is actually no need to define separated tiles or to limit building sizes in terms of overmap tiles. Thus I realize I can make it so you can draw the whole building as a single map no matter how big it is, and there would need to be only a single overmap tile defined per z-level, again no matter how many tiles the building actually covers.[/quote]

For the tower, I may simply keep the tile that was in the sw corner (entrance) for each level as a separate/unique tile, all the other tiles rotate based on its location. I typically just sketch the buildings in notepad and split the map into 24x24 sections. It only really takes an additional ~10 min to do a map in tiles verse one map but for 3x3 buildings a single map might be useful for rotation. Probably isn’t worth the work to have a limitless map size. Procedural generation using tiles will be used for the mall/military base/sprawling structures.[/quote]

Can you upload somewhere those whole maps please? Together with their legend, I mean this thing:
mapf::basic_bind(". 7 # | - +", t_pavement_y, t_backboard, t_bench, t_chainfence_v, t_chainfence_h, t_chaingate_l)

I think randomisation was way too much effort considering results. Houses suck with all the wrong placement of doors and windows, and you still can easily recognise 3 basic types there are. It would be much better to make 10 predefined houses, it would feel more random and could be designed much better.

Maybe parking garage elevators would only work in buildings with no cars in their parking garages?

So you could, theoretically, do some cool stuff with the elevator, but you couldn’t get a quick ride.

[quote=“kilozombie, post:79, topic:913”]Maybe parking garage elevators would only work in buildings with no cars in their parking garages?

So you could, theoretically, do some cool stuff with the elevator, but you couldn’t get a quick ride.[/quote]
Y’know, not everyone is eager to mess around with the vehicle interface from the start. A working, if damaged, Car is a pretty nice prize in the midgame and can give new players both an incentive to learn-2-vehicle as well as provide them an example/starting point for constructing their deathmobile, if they want to do so.