Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental Z-Levels Mod(Ready) #7974

Merged
merged 14 commits into from Jun 28, 2014

Conversation

Projects
None yet
10 participants
@Frost-wood
Copy link
Contributor

commented Jun 15, 2014

Since I want to add a second floor to the Rivtech facility, I need to get positive Z-levels working.

After diving into the code(including that huge if statement in mapgen.cpp), I think, I know what needs to be done to get it working, since a lot of the base is already there.
Implement a "SEEZ", that tells us how far up and down the player can look at most(and by extension, how many of the up/down slices should be loaded into map)

Extend map to store SEEZ times more submaps
transparency_cache etc. can stay the same for now - visibility calculations will ONLY happen on current z-level
implement special submap type that is homogeneously one terrain(e.g. only air, or only rock):DONE-empty z-levels filled with sky
rewrite anything that changes the player's z-level to do map::shift with the new z-level instead
optional: don't shift the map on every z-level, shift it only on every N z-levels
expand creature to have zpos()
expand the creature tracker/mon_at to be fully 3d
expand the stored traps to be fully 3d
expand map::i_at, ter_at, furn_at, get_ter, tr_at, etc etc to be fully 3d

Positive Z-levels(WIP)
Since I want to add a second floor to the Rivtech facility, I need to get positive Z-levels working, since a lot of the base is already there.

After diving into the code(including that huge if statement in mapgen.cpp), I *think*, I know what needs to be done to get it working.
@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 15, 2014

Take a look at https://github.com/CleverRaven/Cataclysm-DDA/issues?labels=Bounty+Issue for a list of what we need to get it working.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 16, 2014

Everything seems to be working as I want, so it's done and ready for review and merge.

I just wanted some positive z-levels, so I could create 2 or more story buildings, like we can do with basements. Once the base is in the master, other people(including me) can work on the list.

@Frost-wood Frost-wood changed the title Positive Z-levels(WIP) Positive Z-levels(Ready for review) Jun 16, 2014

@KA101

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2014

OK. This looks like the Faux z-levels we had from Pet-A-Kitten and that are present in Cata2. We need folks to be able to climb up holes (or at least huck a grapnel up, etc and hope for the best) and shoot/throw stuff at lower levels, as well as be able to get a good idea what's on that lower level. Not to mention having reality-bubble processing on multiple levels.

Allegory of the pancakes: Each Z-level is a pancake in the stack. If you put syrup on the top pancake in the stack, it soaks through and maple-izes lower pancakes. When you cut out a forkful (affecting part of every pancake in the stack), you can look and see multiple exposed z-levels at once. If you feel like it, you could spread butter/jam/etc on any given pancake, affecting that pancake whilst not affecting other pancakes. And despite the fact that you're only paying attention to that one pancake whilst spreading the spread, all the pancakes are nevertheless cooling, and are likely at differing--but similar--temperatures. Likewise, we need all z-levels to be monitored simultaneously, no matter what the character happens to doing or where xe is.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 17, 2014

I agree that the positive z-levels work the same as the underground z-levels, in that they don't effect other z levels. However, underground faux z levels are in the game, so I was hoping that positive z-levels would be added in the same way for now.

I have seen the issue list to get z-levels working, and I understand what needs to happen, however someone has to start somewhere and I'm not going to be able to do this alone.

To implement a SEEZ, there first has to be something to see, to implement cross-z level ranged firing there has to be something to fire from and underground z-levels aren't the best to test these things because a lot of underground is solid rock.

My theory is once this is merged, and 3-d buildings are added, people will work on the 3-d issues naturally, as adding the stuff outlined in the bounty issue will seem less intimidating.

@Frost-wood Frost-wood changed the title Positive Z-levels(Ready for review) Positive Z-levels(Ready) Jun 17, 2014

@Lain-

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2014

I agree with Frost wood there, even if it's not much, having a small groundwork for zlevel will encourage other to take a shot at it to.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2014

I agree with @lain and the author of the PR.

@vache

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2014

I would suggest, as part of this PR, to submit at least one building that takes advantage of positive z levels. Apartment/office/hotel towers are all buildings where it would make sense, or just add a simple two story home.

@acidia

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2014

Sooo...? Tonight I can shoot Frost-wood the second floor of the office tower that's been sitting around since last summer (I hope I still have it) to see how well it works.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 17, 2014

If you have it I will merge into this pr, it would be appreciated, as I have been looking forward to 3d buildings for a long time.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 17, 2014

I was thinking of doing the motel, as I am working on the Rivtech pr, and the z-levels on the motel are practically the same.
I was thinking of doing 3-D buildings as soon as I saw multi-tile buildings were jsonified, so on a whim I put a upward stair and traveled to the next z-level, and found that the z-level code was more robust than I thought. I have not coded since 2005 when I was in college for computer programming, but apparently its all coming back.
I have a few theories on how to get the next items on the list done, but I require 3-D buildings in which to test and implement them.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2014

You can implement whatever you like in your own working branches. By all means, test and implement your theories. If they work, you may end up with a paycheck from us. :-)

But you don't get to use mainline as your testbed. You want your implementation merged, it had best address at least one of the core issues Kevin linked.

@CIB

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2014

This isn't really at all related to the actual engine-changes for z-levels(i.e. having multiple z-levels loaded into the reality bubble at once and all that stuff). It just extends the current z-level implementation to "above ground". I don't see the harm.

Note: I also don't see the benefit. This doesn't get us any closer toward the desired z-level features. I'm just saying, it's pretty much an orthogonal feature at this point, and if that somehow improves the experience, why not?

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2014

@acidia & @Frost-wood : That's great!

@CIB: I say the office tower would greatly improve the experience.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 18, 2014

An alternate that would be workable would be to declare by fiat that all
upper floors are irrevocably boarded up until you can see the proper
scenery out of them. The 'you see open space' outside windows, regardless
of what should be displaying is too incomplete a feature to merge.

@vache

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2014

I would say that's even more incomplete. What happens if you blow up an outside wall on the second floor with an implementation like that? Also that creates an issue of having to modify a design to fit an awkward constraint, then having to modify the design again in the future to remove that constraint.

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Jun 18, 2014

Yeah this is way too hacky and feels really fake in situ.

@vache

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2014

I fear if we continue to take an "all-or-nothing" approach to z-levels, we are going to continue to have nothing for a very very long time.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 18, 2014

It's not all or nothing, it's just that the 'ultimate' payoff of enabling
upper levels is pretty far off. This is starting at the wrong end, we need
to enable some of the underlying stuff like having a 'reality sphere'
instead of a 'reality circle' first, get inter-level interaction, then we
can enable upper levels.
I don't think a solution where you can have upper levels but not
meaningfully interact with the outside gets us any closer to the ultimate
goal of having working inter-level interaction. I've spent a LOT of time
thinking about this, and there simply is not a quick solution to this
problem.

Added 3-D version of Motel
Added 3-D version of Office Tower(empty) thanks to acidia

@Frost-wood Frost-wood changed the title Positive Z-levels(Ready) Positive Z-levels(...) Jun 19, 2014

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2014

Images for viewing(sky's kinda too blue, need to find a way to make it more transparent).
motel level 2
office l2

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2014

Having upper levels means player gets more stuff to explore by itself, and I see the office looks brilliant.

And then, when upper levels are in the mainline, people can use them as a surefire way to test reality spheres, interaction, targeting across z-levels and whatever have you.

@vache

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2014

I think Zireael makes a good point. The faux z-levels presented here make a nice test bed to work on the rest of the issues involved in making the levels interactive. The timeline of "make the levels interactive, then make the levels" sounds backwards to me. In addition, allowing upper levels in this form encourages people to create the structures to fill them, so that once an acceptable implementation is completed, we have lots of buildings already around.

This also makes the areas for improvement obvious to anyone playing around with them. The next step should be to get the lower level terrain rendered in place of the "sky" terrain. To do that, we need to expand the reality bubble to include at least the z-levels the player is on and those below. Then we need to refactor the lightmap to calculate in three dimensions to determine what can be seen. Then we need to refactor all the map methods to work in three dimensions. These are all things that have their tentacles deep into various places in the code, and I think the expectations for them are currently unrealistic. IMO, a more realistic solution with a higher probability of succeeding in the near-term would be to have something like this pushed, giving a groundwork. Next, someone with more knowledge of the map and reality bubble expands it so that we can load in the info from surrounding z-levels. Then someone that knows how the lightmap works (I've heard it's a monster in itself) tackles that, giving correct line of sight so we know which areas of the lower levels we need to actually render. Then someone refactors the map accessors so we know whats in the lower level to be able to render it. All of those things first need a base to go off of, and I think this is as good a base as any, and with those issues tackled, I think we have a good second blush at z-levels.

My suggestion would be to wait until 0.B releases then merge this into the experimentals, and make fully fleshing out z-levels as the focus for 0.C. The whole point of experimental versions is that they may contain unstable content or content not yet fit for stable releases. I think once something like this gets into the experimentals and people can see where things are going and what we are lacking, they will be more inclined to take a look into things and get them the way we want them. If we somehow get near to a new release and things aren't at an acceptable point, simply turn off the extra levels in omap gen and throw in a cheeky "halfway up the stairs, the way becomes blocked off" to handle stairs leading up to the content people have created in the upper levels..

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2014

vache says it far better than I have been trying. Even if you add the 3d-submaps, without my 'faux' z-levels cata will spit out debug messages, as you'll get a "tried to generate map omtype=null" error, as cata will load well nothing. You have to fill the 'sky' with some sort of terrain type. Now t_sky should be moved from trap_ledge to a flag, but that's further down the line.
...I think the main dev's minds have already been made up on this. Regardless, I'll see if I can continue on to get this PR to the ?invisible? line that devs will merge this, at least I have some buildings to test z-levels on..
It'll be just going at a slower pace than if other people were working different angles.
Further discussion, probably should be moved to the forums though, as I want to keep this for more technical issues(i.e code problems, memory leaks.. etc).

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 21, 2014

Here's another option. My main issue with merging this as-is is that I don't want people to think this is the z-level feature we've been talking about (not that there's anything wrong with this, just that it doesn't have all the features implemented).
How about any buildings that use it go into an "experimental z-levels" mod for the time being? That way developers and players that want to mess with it can enable it, and it makes it clear that it's still a work in progress.

@@ -6163,6 +6164,11 @@ void mapgen_rock(map *m, oter_id, mapgendata dat, int, float)
}


void mapgen_sky(map *m, oter_id, mapgendata dat, int, float){

This comment has been minimized.

Copy link
@kevingranade

kevingranade Jun 21, 2014

Member

dat is unused here, change "mapgen dat," to "mapgen," (just remove the parameter name) so the compiler doesn't warn about it.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2014

Kevin is OK with making it a mod

Wev.

@@ -2624,5 +2624,22 @@
]
},
"examine_action": "water_source"
},{
"type" : "terrain",
"id" : "t_sky",

This comment has been minimized.

Copy link
@kevingranade

kevingranade Jun 21, 2014

Member

One nit here, I'd prefer this be "open air" or similar, reserve "sky" for the situation where we're describing the upper boundary that we can't interact with.
A specific area where "sky" is inaccurate is if you're looking out a window and see forest or another building, but it's still accurate to call it open air.

This comment has been minimized.

Copy link
@BevapDin

BevapDin Jun 21, 2014

Contributor

Why not simply reuse t_hole, that is used in the silo and has the same properties. Sooner or later they have to be merged anyway. It's empty space in both places.

This comment has been minimized.

Copy link
@Frost-wood

Frost-wood Jun 21, 2014

Author Contributor

It's more an graphic issue-t_hole is underground and t_open_air would be above ground, and eventually it should be changed from a trap to a flag.

This comment has been minimized.

Copy link
@kevingranade

kevingranade Jun 23, 2014

Member

Also we don't want to change the behavior of the existing t_hole.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 21, 2014

Also ran across a bug, if you go upstairs, then it triggers the "way down stairs here" note for every positive z-level... for every square you can see I think.
And a fairly major issue, if you use blue for sky/open air on the overmap display, it makes the cursor invisible.
Side note, if we want railings next to sheer drops to actually provide safety, probably want to prompt to climb over them, probably by changing them to a terrain type that acts like chainlink fences.
Cyan might be a better choice for the open air color.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 21, 2014

sounds good, I work on the issues you mentioned.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2014

I don't care whether it's a mod or master as long as it gets in. +1.

@Frost-wood Frost-wood changed the title Positive Z-levels(...) Experimental Z-Levels(WIP) Jun 21, 2014

@vache

This comment has been minimized.

Copy link
Contributor

commented Jun 21, 2014

I don't know the capabilities of the mod system, but would we be able to control the number of layers created that way? Seems like if you couldn't, you'd just end up with lots of empty sky layers that way.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 21, 2014

Alright, everything has been transferred to the mod Experimental Z-Level Buildings, the issues Kevin mentioned are fixed.

If they don't use the debugger they cannot go to the new Z-levels.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 21, 2014

-vache: they will be created at map gen, but since z-levels do not really interact with each other, there will not be any performance loss. I did not notice any on my laptop..

@Frost-wood Frost-wood changed the title Experimental Z-Levels(WIP) Experimental Z-Levels Mod(Ready) Jun 21, 2014

@vache

This comment has been minimized.

Copy link
Contributor

commented Jun 22, 2014

I was more concerned with the players being able to view z levels that didn't have anything and that they wouldn't have access to. It's not really a big issue, it just sort of highlights that there's something missing though.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 23, 2014

The focus there needs to be on keeping homogenous submaps fast to process.
Supporting a dynamic number of layers might be problematic.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Jun 26, 2014

OK.

Office tower:
Speaking from experience, non-emergency stairs in an office tower generally come out in the same location as the elevators.
The parking entry is reversed: you should enter on the right and exit on the left. (It's also not mating with the road connections.)

Motels are not implemented and taking the upstair immediately dumped me back to z=0, with 7 damage to boot.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Jun 26, 2014

OK, this is NOT mergeable as-is.

I opened an old world (obviously, it did not have the mod enabled) and not only did it still have the 10 levels of "open air", every milbunker on the map had its basement moved up to z=0. Therefore, they were inaccessible.
https://www.dropbox.com/s/835ptxfh168gm1j/06252014BunkerElevated.PNG

Here's a screencap of my issue with the tower:
https://www.dropbox.com/s/5ws6h5vvz5v0n47/06252014BadRamp.PNG

@vache

This comment has been minimized.

Copy link
Contributor

commented Jun 26, 2014

The 10 levels of open air problem is why I thought making it a configuration option instead of a mod was the way to go. I don't think there is a way to control how many levels get created in a mod, but it seems like it would be easy to define that in world creation.

The bunker problem only exists because it uses the same function to draw both the upper and lower levels, and it just checks that there is no t_above to make that decision. It should be split into two separate functions and updated where necessary.

The road connection issue is one that I've been looking into a little bit, but it doesn't have any easy solutions. Either way, it's not a z-level issue.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Jun 26, 2014

Then, by all means, fix it.

As for the road-connection, so noted. Things that look glaringly Wrong can block merge even if they aren't specifically problems with the underlying feature.

@Frost-wood

This comment has been minimized.

Copy link
Contributor Author

commented Jun 26, 2014

Motels are not implemented and taking the upstair immediately dumped me back to z=0, with 7 damage to boot.
It seems the mod system isn't loading the second levels of the buildings(of the motel), which is weird. It seems the mod manager works fine, if the building isn't already added, but if it is, then it seem as though the old points are still loaded.

The bunker issue seems to be happening with the labs as well(it seems to only happen with randomly generated stuff).

Road connections I'm not certain how to fix.

This might be too much of a change to run through the mod manager system.

@kevingranade kevingranade merged commit fedd6b2 into CleverRaven:master Jun 28, 2014

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2014

screams it says merged! Might convince me to start a fresh game!

@Frost-wood Frost-wood deleted the Frost-wood:positive-z-levels branch Jun 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.