Block ID shortage solution maybe

    Blaza612

    The Dog of Dissapointment
    Joined
    Nov 16, 2013
    Messages
    787
    Reaction score
    209
    • Legacy Citizen 4
    Does "Blaza612" define every property of you? No, it is just a pointer, that is used when people are referring to you, but don't want to list up all properties of you(most of which they probably don't even know or care about). An ID has the same purpose, it is a pointer at what has the ID, so everyone interested in it knows where to look it up. The "master list"(which contains all blocks AND items right now) uses 16bit integers, and not 11bit integers for IDs.(although no currently used ID exceeds what could be stored in 11bits. In addition, 11bit integers don't 'naturally' exist in almost all current computers, so internally 16bit integers are used, whenever calculation with the ID is required)
    How exactly is that relevant to what I said? I was saying that in response to adding things to the entity ID list as you add blocks on, but the blocks would be getting their IDs from the entity list, thus not being able to get the ID in the first place. I know what they are silly. :P
     
    Joined
    Jul 21, 2013
    Messages
    2,932
    Reaction score
    460
    • Hardware Store
    How exactly is that relevant to what I said? I was saying that in response to adding things to the entity ID list as you add blocks on, but the blocks would be getting their IDs from the entity list, thus not being able to get the ID in the first place. I know what they are silly. :p
    That would technically be easy to solve. Assuming we have a Map<LocalID,GlobalID> map [translates local IDs into the global ID] and a Map<GlobalID,LocalID> reverse [does the reverse of the previous Map, has no entry for GlobalIDs not present locally]
    When placing a block[any data besides the blockID was ignored in this example]:
    place(GlobalID gid, Location loc) {
    LocalID lid=reverse.get(gid); //look up the localID associated with gid
    if(lid==null) { //if there is no entry for gid
    lid=createNewLocalID(); //generate new local ID. will generate an error if that is impossible[due to lack of free IDs or whatever]
    reverse.put(gid,lid); //map this local ID to a global ID
    map.put(lid,gid); //map the global ID to this local ID​
    }
    set(loc,lid); //changes the data in the voxel-grid at the location to the new ID.​
    }​
    The main point of worse performance still stands though, and can't really be countered, unless someone makes an example implementation and proves it. Removing an entry from this list will also be really hard, as every block on the entity will have to be checked, and we all know how large ships, planets and spacestations can get.
     

    Ithirahad

    Arana'Aethi
    Joined
    Nov 14, 2013
    Messages
    4,150
    Reaction score
    1,330
    • Purchased!
    • Top Forum Contributor
    • Legacy Citizen 8
    Yeah, now that I fully understand what he's asking for, yes, it's possible, but it's a technical nightmare and not worth the time and effort it would take to make the system work. Never mind how bug-prone it would tend to be and the fact that people would sometimes run into an annoying and unavoidable limit to block types.

    It would be a lot easier to increase the amount of data per block to 4 bytes and allocate some of that extra byte to IDs. Just one bit would double the available number of IDs, if I understand correctly.
     
    Joined
    May 8, 2015
    Messages
    117
    Reaction score
    55
    How many blocks are we able to add before reaching the limit at this point in time?
     

    therimmer96

    The Cake Network Staff Senior button unpusher
    Joined
    Jun 21, 2013
    Messages
    3,603
    Reaction score
    1,053
    • Legacy Citizen 10
    • Top Forum Contributor
    How many blocks are we able to add before reaching the limit at this point in time?
    we still have over 1000, iirc we haven't got more than 600 yet, but remember this isn't just blocks, this is things like scrap that can't be placed.
     

    Ithirahad

    Arana'Aethi
    Joined
    Nov 14, 2013
    Messages
    4,150
    Reaction score
    1,330
    • Purchased!
    • Top Forum Contributor
    • Legacy Citizen 8
    I wonder if it would be possible to make scrap 'blocks' and other unplaceables into metaitems...
     
    Joined
    May 8, 2015
    Messages
    117
    Reaction score
    55
    we still have over 1000, iirc we haven't got more than 600 yet, but remember this isn't just blocks, this is things like scrap that can't be placed.
    Interesting... I believe on the wiki there are around 650 block IDs accounted for, not counting some of the new blocks in the last few updates that haven't been catalogued. I just didn't know how many we had left.
     
    Joined
    Jul 21, 2013
    Messages
    2,932
    Reaction score
    460
    • Hardware Store
    It would be a lot easier to increase the amount of data per block to 4 bytes and allocate some of that extra byte to IDs. Just one bit would double the available number of IDs, if I understand correctly.
    Just one problem with that. 11+8=19 the smallest power of two greater than 19 is 32, and 32-19=13. 13 entire bits remain unused internally when calculating, unlike the 5 unused bits right now. You didn't even double the amount of bits for the id, but more than doubled the junk-overhead. I personally would just put 5 of the 8 bits of the additional byte into the id. the others would go into orientation and the logic-bit, so they don't have to be mingled with to fit corners and other fully-rotateable blocks. Any leftover bits could maybe be turned into meta-flags.
    I see no reason why they can't be made to stack, though.
    Simple: all metaitems[regardless of type] share 1 single id. Only the meta structure stored outside of the item itself holds the types. Or do you want to stack a logbook with your helmet and a gun? :P
     

    Lone_Puppy

    Me, myself and I.
    Joined
    Mar 12, 2015
    Messages
    1,274
    Reaction score
    529
    • Purchased!
    • Community Content - Bronze 2
    • Legacy Citizen 8
    I have often pondered the question around the limits, but thanks to this discussion you guys have had, it has given me a much better appreciation for the incredible work the Schine guys are doing.

    From what I understand after reading rasinbats idea, it's very similar to how we use the game.
    The entities we create have a core that we name (our own master ID for our own collection of entities), whether it be a ship, station and the asteroids have one too. Then there are all the different configurations/orientations of blocks that make up that entity, which would be akin to associated block_IDs, like placing a decorative computer block and calling it the Spa pool computer (BlockID_SpaPoolComputer).

    I think the idea would work, but the computer processing resources required would ramp up considerably when you want to build, check, change, destroy and compensate for interaction with other entities let alone the universe or local sector.
     
    • Like
    Reactions: Raisinbat
    Joined
    Aug 28, 2013
    Messages
    1,831
    Reaction score
    374
    • Legacy Citizen 2
    • Top Forum Contributor
    • Legacy Citizen
    In regards to physics, the only complication would be checking the correct shapes. And there we run into a problem. As each entity adds IDs to its palette, odds are each one would add different shaped blocks into different orders. Which means during physics calcs the system would have to load each ship's palette to check what shape a block is.
    We could get around this by changing all the blocks so that all shapes are in one ID (it's possible, but Schema decided not to implement it) so then the ID doesn't matter.

    As for systems, I wouldn't worry too much about system update checks, or from weapon hit checks. Currently the system has to take the ID from the hit block, look up the id in the configuration for the armor. This adds only another check to finding the armor.

    The load on the graphics will probably be the worst part about implementing something like this.
     

    Ithirahad

    Arana'Aethi
    Joined
    Nov 14, 2013
    Messages
    4,150
    Reaction score
    1,330
    • Purchased!
    • Top Forum Contributor
    • Legacy Citizen 8
    Simple: all metaitems[regardless of type] share 1 single id. Only the meta structure stored outside of the item itself holds the types. Or do you want to stack a logbook with your helmet and a gun? :p
    Can't metaitem stacks be "special" inventory entries, though? Like the multistacks, sort of, ish. The game could specially check metaitems when you try to stack them and if the types don't match the stack operation will cancel.
     
    Joined
    Jul 21, 2013
    Messages
    2,932
    Reaction score
    460
    • Hardware Store
    Can't metaitem stacks be "special" inventory entries, though? Like the multistacks, sort of, ish. The game could specially check metaitems when you try to stack them and if the types don't match the stack operation will cancel.
    Not only types have to match, each metaitem also contains their own stats[in regards to handheld weapons]. Also, have fun stacking 2 logbooks with different text-content onto each other, erasing one of them :P
     

    Blaza612

    The Dog of Dissapointment
    Joined
    Nov 16, 2013
    Messages
    787
    Reaction score
    209
    • Legacy Citizen 4
    Not only types have to match, each metaitem also contains their own stats[in regards to handheld weapons]. Also, have fun stacking 2 logbooks with different text-content onto each other, erasing one of them :p
    How exactly does the stacking system work? If I were to do stacking, I would simply have an array/list created whenever stacking happens. It wouldn't alter the metadata at all, just show them with a pretty number. :p
    [DOUBLEPOST=1446798327,1446798235][/DOUBLEPOST]
    Not only types have to match, each metaitem also contains their own stats[in regards to handheld weapons]. Also, have fun stacking 2 logbooks with different text-content onto each other, erasing one of them :p
    How exactly does the stacking system work? If I were to do stacking, I would simply have an array/list created whenever stacking happens. It wouldn't alter the metadata at all, just show them with a pretty number. :p
     
    Joined
    Jul 21, 2013
    Messages
    2,932
    Reaction score
    460
    • Hardware Store
    How exactly does the stacking system work? If I were to do stacking, I would simply have an array/list created whenever stacking happens. It wouldn't alter the metadata at all, just show them with a pretty number. :p
    That is not how it works, because if you were to split the stack, how to determine which items end up in which stack?
     

    Blaza612

    The Dog of Dissapointment
    Joined
    Nov 16, 2013
    Messages
    787
    Reaction score
    209
    • Legacy Citizen 4
    That is not how it works, because if you were to split the stack, how to determine which items end up in which stack?
    Get count of array/list, use that divided by two rounded to an int to get the max number to take away. Go through each thingy in stack, and if the max to take hasn't been reached, then add that to the new stack. Once that's done, take away the number of items from the original stack. Simple. :p
     
    Joined
    Jul 21, 2013
    Messages
    2,932
    Reaction score
    460
    • Hardware Store
    Get count of array/list, use that divided by two rounded to an int to get the max number to take away. Go through each thingy in stack, and if the max to take hasn't been reached, then add that to the new stack. Once that's done, take away the number of items from the original stack. Simple. :p
    The result of that can be fairly random, as the contents of the array might be unsorted. And if only 1 element is not the same as the others, and the player wants that specific element, in a stack of say, 500 items. Good luck searching.
     

    Blaza612

    The Dog of Dissapointment
    Joined
    Nov 16, 2013
    Messages
    787
    Reaction score
    209
    • Legacy Citizen 4
    The result of that can be fairly random, as the contents of the array might be unsorted. And if only 1 element is not the same as the others, and the player wants that specific element, in a stack of say, 500 items. Good luck searching.
    Oh right, forgot, they're meta items which have more data. Oops :p

    Although I guess that you could just copy the data from one item into a new one when you make the new ones in the new stack. And finding a specific would be a pain, maybe have a dropdown list when splitting stacks to get a specific one?
     
    Joined
    Jul 21, 2013
    Messages
    2,932
    Reaction score
    460
    • Hardware Store
    Oh right, forgot, they're meta items which have more data. Oops :p

    Although I guess that you could just copy the data from one item into a new one when you make the new ones in the new stack. And finding a specific would be a pain, maybe have a dropdown list when splitting stacks to get a specific one?
    Since handheld weapons each store their own stats[the OPgun is just a rocketlauncher with a modified damage per shot tag AFAIK], pretty much all data of all the tags has to be displayed in the dropdown. Those can be many, but the number of items in the stack will be even greater[again, 500 items stack e.g.] Have fun searching for the 1 item you wish for in a stack of 499 other random items.
    As for copying the data of one item over another, that would easily allow duping[a design metaitem is pretty much free if you have a shipyard. Put it onto a stack of say an OPgun, bam, 2 OPguns. Or (assuming only metaitems of the same type will be stackable), put an empty blueprint onto a filled blueprint → 2 filled blueprints.