Ghost destroyed blocks

    diremage

    Tech Wizard
    Joined
    Oct 26, 2016
    Messages
    93
    Reaction score
    53
    Proposing a new boolean block property, isDestroyed. This property allows blocks to be marked as destroyed by damage without removing them from play. Weapon fire should pass through isDestroyed blocks, and they should be invisible in Flight mode but visible (perhaps semi-transparent red) in Build mode. This will have a number of wide-ranging benefits as outlined below.

    * Marking a boolean is significantly faster than removing blocks from play. There should be a noticeable performance boost during combat as the damage/cleanup phase will be simplified. Simply mark the block as isDestroyed rather than deleting them.

    * Given sufficient blocks in inventory, ships can have a Repair All button in build mode and have block repairs done in a single click.

    * Heal beams can restore damaged blocks, finally lending a use for this tool.

    * Other benefits?
     

    jayman38

    Precentor-Primus, pro-tempore
    Joined
    Jul 13, 2014
    Messages
    2,518
    Reaction score
    787
    • Purchased!
    • Thinking Positive
    • Legacy Citizen 4
    Which blocks would this affect? All of them? (This important for selecting which bit in the 24-bit block info area is used.)
    Which bit out of the 24-bit block info area should be used? (If approved, this suggestion could be a vital impetus toward 32-bit block info data layouts.)

    As long as we have a 24-bit info area for each block, I would instead recommend that blocks and entire chunks be listed in a SQL data table per entity with their coordinates. As long as a block is listed in that database as either a standalone block or a member of an entire destroyed chunk, it is "isDestroyed".
     

    diremage

    Tech Wizard
    Joined
    Oct 26, 2016
    Messages
    93
    Reaction score
    53
    Where would I go to find out what the current 24-bit info area is? The obvious candidate, depending on how it's stored, would be the sign bit (transition from int to unsigned int, for example).
     

    diremage

    Tech Wizard
    Joined
    Oct 26, 2016
    Messages
    93
    Reaction score
    53
    Thanks Crusade!

    What strikes me is that there's ten full bits for block ID, which presumably determines what type of block (eg grey hull 1/4 slab). Is there enough room in the block registry to reserve the LSB as "isDestroyed" and make do with only 512 unique block types?

    According to the ID list - StarMade Wiki ID list, there are blocks that go all the way up to the 900-range of the 1024. We might only be using 512 total blocks but they are all over the place. There are also very close to 512 blocks currently in use and the planned dev of systems and weapons might push us over (Excel says the list has 459 rows including headers, but some of the tables are 2 or 3 columns wide).

    So let's flip that around for a minute. If we pushed for 32-bit blocks, what would the remaining 7 bits be used for? Reserved for future use? It would basically increase the ram req. by 33%.

    We could have a "basic" block with ID's up to 256 and a reserved bit for each of is32BitBlock and isDestroyed, and then only use 32-bit blocks for expanded blocks up to 2048 ID size (or however high we want to go).

    We could even strip out the 4 orientation bits, two of the HP bits, and 4 of the ID bits, and have a TINY 16-bit block which would REDUCE the size in memory by 33%, and use those for hull whole cubes. The homogenous cubes don't really need orientation anyway; they look the same no matter how they face. Add a "BiggerBlock" bit and a "isDestroyed" bit at the LSD and you've got a range of 16, 24 and 32-bit block sizes that optimize game size in RAM and on server HDD.

    Don't know if the performance gains justify the additional work, though. Looks like blocks have already been simplified once.

    bit offsets.png
     
    Last edited:
    Joined
    Feb 27, 2014
    Messages
    1,074
    Reaction score
    504
    • Purchased!
    • Legacy Citizen 4
    • Top Forum Contributor
    Certiantly sounds interesting.
    I think a large part of the performance impact comes from the number of faces that need to be rendered, thus turning blocks texture off etc will still show the faces behind it,
     

    madman Captain

    Self-appointet Overlord of the Scaffold
    Joined
    Jan 11, 2015
    Messages
    263
    Reaction score
    491
    • Purchased!
    • Community Content - Bronze 2
    • Legacy Citizen 5
    Will this maybe include that rails physical ghosted but still remain the connection you know doors and turrets not detatching if rails and dockers destroyed.