I have a conceptual question: In the case of Tile Map, each block has the information from the enemies who are going about it. But what if some of these enemies are far greater than the block? I have to have the same element in each of the information blocks? And updating the position must clear each block? If I have large and small enemies, it means that each block will have a list of enemies?

Now, in the case of Voxel Map: In Minecraft, for example, its character and most enemies x and z dimensions is smaller than one block, but its height (y) is greater than one block. This means that these elements will record information in two blocks? and in the case of a "Gast," which is much larger?

I'm using Google Translate, so sorry if my english is very bad. Thanks in advance.


1 Answer 1


Using Minecraft again, as an example:

It's not true that each block contains a list. All non-block objects are likely contained in a single list, or perhaps one list per chunk to help with occlusion. For simplicity's sake, we'll ignore chunks for now.

There are two kinds of entity I'll call blocks and objects.

  • Blocks are just a numbers indicating what kind of block it is, contained in a three dimensional array.
  • Objects are things like enemies, and they have a position that does not correspond to the positions allowed by the block array.

If a block moves, like the sand block when it falls, the block is actually removed from the array (set to zero) and an object entity that looks like it is created in its place so that it can move fluidly. When it lands, the object is destroyed and the block where it landed is set to the sand block number.

Since objects aren't constrained by the block array system, they can have rotations and positions independent of blocks. However, objects are more expensive than blocks to simulate because they have extra information associated with them.

An simple example in code might look like

struct Object
    float3 Postion;
    float4 Rotation;
    int Model;

enum Block

Block[,,] Blocks;
Object[] Objects;

So you only have two collision cases:

  • \$\begingroup\$ But these objects do not have their positions associated to a block, or an index in the array blocks? How to detect collision between enemies, for example? A scan is performed at all the enemies that are in the chunk? If not, and check is performed on more next block does not mean that more next blocks have the information that one or more enemies are stepping on it? \$\endgroup\$ Sep 10, 2015 at 16:38
  • \$\begingroup\$ You'll need two methods, see edit. \$\endgroup\$
    – jzx
    Sep 11, 2015 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .