No, you don’t.
Hashmap is just a “best guess” of where the slot must be located and a loop if the collision is found
This is nothing like a hashmap.
There is once again no reason for such “ECS” to even exist
Because you either allocate “struct-like” buffers or just a stream and then assign a position from a freed pool
no moving is required
Stop treating code like gospel
You should be searching for true results rather than “someone said so”
That’s also why I don’t recognize “ECS” as “ECS” because what people do is reinventing the wheel
Because you need to think in terms of memory
All data management should just be like managing an allocated stack of memory
A continuous block
Example:
local Players = game:GetService("Players")
local size = 255
local token_size = 25
local free = table.create(size ,true)
local stack = buffer.create(size * token_size)
local translate = {}::{[Player]:number}
local Player_Added = function(plr:Player):()
local id = next(free)
free[id]=nil
local key = id-1
translate[plr]=key
local pos = key*token_size
buffer.writeu32(stack,pos,1)
end
local Player_Removed = function(plr:Player):()
local id = translate[plr]+1
translate[plr]=nil
free[id]=true
end
Players.PlayerAdded:Connect(Player_Added)
Players.PlayerRemoving:Connect(Player_Removed)
for i,v in Players:GetPlayers() do
Player_Added(v)
end
That’s how REAL developers
should manage data
All this ECS is just lies