Jump to content

Multiple objects in a block

Recommended Posts

I really wish the game woudl allow you to place multiple items in a single voxel block.


For example two ladders, one on each side, in a corner.  Though that would not be very useful it describes exactly what I want to achieve.


Better examples would be to be able to put a switch and a ladder into a single voxel.  On different sides of the voxel of course, so you could have a ladder going up to the roof in the corner of the room and use the other side of that corner for small things like switches.


The game would have a concept of which "sides" of a voxel a single item or block would claim.  A light bulb, switch or plate for example would claim only one side. "Corner fences" would claim two sides.  Those catwalks with railings on two sides and a bottom would claim 3 sides.  And so on.


This opens up another posibility:  Currently blocks give support either on All sides (most normal blocks), No Sides (such as a blade trap and other blocks that you cannot build on top of), or only vertically (glue support is zero with vertical support in tact, eg hay bales).  If TFP would make it so that an item could claim one or more sides of a voxel, it could also be made to also provide support on only some sides.  This would mean that a block can't provide support on a side that doesn't exist.



Link to post
Share on other sites
2 hours ago, Tahaan said:

The game would have a concept of which "sides" of a voxel a single item or block would claim.  A light bulb, switch or plate for example would claim only one side. "Corner fences" would claim two sides.  Those catwalks with railings on two sides and a bottom would claim 3 sides.  And so on.

Sure, you could do that in theory, basically each block then contain 6 (each side) or even 7 (each side + center) blocks.

But then comes into play, how do you determine which specific block only occupies half the voxel and so another block could be placed on the opposite site. But the other block needs to be another block that only requires half a voxel of space. And does this half block block half a voxel, so the opposite site is still free, but the left and right side is not? Finally you come to the conclusion that instead of adding lots of extra exceptions to "sides" of a voxel, basically is the same than dividing each block into 3x3x3 "subblocks", a ladder would than probably only consume 3x3x1 on one side, so still 3x3x2 free. A switch may even just take the center subblock of one side. So you could even have a 2 ladders facing each other and 2 switches on their side, but you can not place a ladder on each side, because the edges would overlap.


So and now the final question: Why does somebody probably not "easily" enhance the number of voxels by a factor of 27 or add lots of corner-case-code that is potentially very susceptible for any kind of bugs?


Edited by Liesel Weppen (see edit history)
Link to post
Share on other sites

I don't really understand the issues you are trying to describe Liesel but I imagine that there are two things preventing this


Firstly it would be a change that touches the core of the voxel world framework.  So it would not be trivial to implement.


Secondly each "voxel" implies a certain amount of work for the game engine to get it to render correctly, collide correctly, allow pathing over and through, and so on.  If there can be up to 6 blocks in a single voxel it means that the game engine would need to in theory do that work 6 times per voxel, for all possible items in the voxel.  Perhaps not exactly 6 times but in some way or form the game would have more to deal with than it does now, so it would have a performance impact.


About which items can occupy the same voxel space at the same time - it would depend on the sides they occupy.  Two items cannot both try to claim the "north" or "top" or "bottom".  But if one item is orientated to claim the top and another claims the bottom then they can both go into the same voxel.

As a bonus It would instantly resolve the issue of building corners for cages with bars.  Or even cubes!

Link to post
Share on other sites

Yep, it would be lot of more work to do, and also need a lot more memory. And as i said the corner cases are hard to handle, because you can not place every block on a surface of a voxel. You want a ladder on both sides, so ladder needs to have another flag, that says it can "share" a voxel, but you should not be able to place two concrete blocks on each side of a voxel. And this simple solution wouldn't even fix your cage corner problem, because it would only allow two elements on the opposite side. Placing items on the next side would make bars overlap. Probably it'll look fine with ladders, but may also cause problems with climbing ladders, because then there are two ladders you could actually climb. For your cage corner problem it would be much easier to add corner-bars as an alternative block shape to the bars, just like it is done with different block geometries like slope, half slop, corner, etc.


So yes, possible in theory but it would make the game even more hardware demanding and it's hard to implement (definitiely a core change in the whole voxel engine) and still heavy error prone.

Link to post
Share on other sites

The solution would address exactly that issue.

Every block needs to have a property that indicates which sides of the voxel it claims.  Including concrete blocks in your example, which will claim all 6 sides.  So they cannot share because they can only be placed in a block where all the sides are free.


But I agree - the more finely grained the world is, the more objects that can be in it, the more work the computer needs to do.  So this will definitely have a performance impact.  


But I dream of such things being possible if TFP could optimise it enough.

Edited by Tahaan (see edit history)
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...