matpow2 / cuwo

Open server and utilities for Cube World
GNU General Public License v3.0
170 stars 49 forks source link

Block type, unknown 6th bit #171

Open UserXXX opened 9 years ago

UserXXX commented 9 years ago
Just to let you know: I have had a closer look at the block types to find out what exactly they do. What I figured out is that the "unknown" 6th bit seems to specify whether blocks can be broken (by bombs, huge boss monsters etc.). I did this by connecting to the server, sending a block update (cuwo.packet.Packet4Struct1) to the client, then closing / aborting the cuwo process so the client is set into his singleplayer world. Finally I tried if I could break the changed blocks using bombs (so I did no RE). I created the following table in the process, maybe you can get some useful info from it ;) Constant Type Solid Accepts color
0 Empty No No
1 Solid Yes Yes
2 Water No No
3 Flat Water (the kind of water one can walk on) Yes The sides take the specified color, top side looks like water
4 Solid (Grass) Yes Yes
5 Solid Yes Yes
6 Solid (Mountain) Yes Yes
7 Solid Yes Yes
8 Solid (Trees) Yes Yes

I don't see any differences in any of the "Solid" lines, maybe they all do the same? The types in brackets are taken from cuwo.tgen.pyx

PS: Sorry for the table layout, for some reason markdown doesn't work

matpow2 commented 9 years ago

Thanks for the info! I found the types in brackets by looking at the blocktypes generated by tgen. I'm sure some of the solid types are used for e.g. ice/snow, so if you could figure that out, that would be great!

UserXXX commented 9 years ago

I'll try my best, but it may take a while ;)

UserXXX commented 9 years ago

I have had a look at the tgen output and found the following: Constant | Usage 5 | Fields near cities and cliffs (the border of the plateaus found in e.g. "normal" lands) except in lava lands 6 | Rocks / Buildings (in cities and for quest buildings e.g. castles) / Cliffs in lava lands 7 | trunks and limbs (everything that is "wood") of trees 8 | leafs of trees, this includes the snow on the "leafes" of trees in snowy lands 9 | Sand 10 | Snow 11 | Paths between cities and streets in cities 12 | Floor in lava lands 13 | Not found 14 | Roofs of houses in cities, but only on normal houses, special buildings like the training buildings use 6 15 | Not found

All these blocks are solid and accept colors (even the "Not found" ones).

There also seems to be an at least one block high layer above the terrain that's values are not always 0, i.e. in lava lands it is a layer with value 2 which normally is water, but in this case it is rendered as air (=empty). Maybe one of the unknown 2 upper bits specifies another usage of the value than using it in the mesh renderer, I will have a closer look at this soon.

UserXXX commented 9 years ago

After having a closer look at it, I figured out that it was a bug within my code (reading over array bounds -.-), sorry for that. So there is no mysterious invisible layer above the world.

matpow2 commented 9 years ago

I've committed the new block types - let me know if you disagree with the naming! Otherwise, I'll close the issue :-) Thanks for the RE!

UserXXX commented 9 years ago

The names are good, except the LAVA_TYPE, even if it is explained in the comments, it is a little misleading. When I would be reading this, I would think of liquid lava that burns you if you get in contact with it. Something like LAVA_ROCK_TYPE would be more clear.

I've seen another interesting point when exploring the world a little, you maybe know it already: Cube World seems to have a sea level that ranges from 0 (including) down. If terrain is generated that starts below or at level 0, the empty blocks are filled with water. This water is not contained in the data arrays from tgen. You can see this in the mapviewer with seed 26880 in the chunk (32500, 32800). Around some structures, i.e. rocks breaking through the water surface, there is air generated around them.

I've got still a little question: Could you add me to the special thanks list please? :-)