I understand math very very well, yes i realize that 12! = 479001600 but that\'s actually irrelevant here.
A computer works on a base 2 number system represented in 0s and 1s. So for example an 8 bit or 1 byte number representing
1 would be 00000001
2 would be 00000010
3 would be 00000011
and so on.
1 byte cannot store 256 \"symbols\", \"numbers\" or any other way you want to say it. it is only capable of representing a number between 0 and 255 if it is unsigned, and -128 to 127 if its signed.
Heres an explanation of integer data types in a computer https://en.wikipedia.org/wiki/Integer_%28computer_science%29
1 byte does NOT have 256 digits it has 256 possible combinations of 8 bits, it can only store a maximum of 2 \"symbols\" the way you talk about it because depending on the third place the other two cannot pass 5. To be able to store
\"000001600 0000000000000000000 0000000000000000000 0000000000000000000 001 00 200 70 0\" in that representation it would take probably 3-4 64 bit integers which would be a total of 24-32 bytes, which btw you can store it in alot less than that,
So that brings me to the next part
multitude of different block types to begin with which from looking at the id
they do not expend more than 3 numbers at the moment for the type of block in use, anything else is more of a property alocated to the type, and this will only aplly to selling and bying usaly or what some fucntions do
those 3 \"numbers\" you speak of takes up most of if not more than one byte
, then you still have orientation, and health.
witch i did add into my estaments, youve must have read over them
depending on how many orientations you need and how many health points you want you may need more than one byte just to store this
Ok now to how you can actually store the ranges that you\'re saying
1. You may or may not need to store the id of each individual block, honestly I wouldn’t, I’d just store the ID of the ship as a whole. If you did want 9 digits it would take 29-30 bits which gives you a maximum count of between 536,870,912 and 1,073,741,824
2. The coordinates in computer graphics are normally single precision floating point numbers which take up 32 bits each and there is one for X, Y, Z but if this is a voxel engine we can actually infer the location based on the position within a chunk and the position of the ship as a whole and don’t need to store it directly.
3. If you have no more than let’s say 3-500 different types of objects in the game you can store the id for it in 9 bits which has a range of 0-511
4. Now the orientation, we don’t need every possible orientation so we\'ll just go with a reasonable number of 8 which would take 3 bits giving us 0-7 as the range of numbers
5. The health if you want 0-200 range on that it would take 8 bits if your fine with 0-127 then you could do it in 7 bits
6. Armor if you\'re wanting a maximum of 99 which is almost complete armor then you would need 7 bits again but we can actually infer the amount of armor from the block type so we don’t really need to store this either
7. For all the optional \"flags\" things like visibility, activated, etc. you could use 1 bit per thing like this 1 bit gives you either 0 or 1 which can be represented as false or true.
8. All the other properties of a block like, price, weight, power, light, guns and other various things wouldn’t be stored per block. Some of it would be inferred in code or settings, and other would be stored at the global level or ship level not per block.
Now, if you add all that up you get between
28 bits if you don’t store the id, or position, using a health range of 0-200 and have a flag for visibility and activated. Now 28 bits = 3.5 Bytes of data which is far less than you storing it the way you where as a long number but is still 3.5 bytes
On the other hand if you store everything then you would have 155 bits. 155 bits = 19.375 bytes of data, which again is far less than what it would take to store it your way but is far more than 1 byte and still very inefficient.
Now you can pack all of that down into less than 28 bits by using various things like RLE on each chunk and various other things again I’ve never built an engine like this but I understand the premise of a voxel engine but I do understand quite well how a computer\'s memory works and how numbers are represented.