2024-04-23 15:10:49 +00:00
|
|
|
--!optimize 2
|
|
|
|
--!native
|
|
|
|
|
|
|
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
2024-04-24 15:32:07 +00:00
|
|
|
|
2025-06-25 11:31:25 +00:00
|
|
|
local jecs = require(ReplicatedStorage.Lib:Clone())
|
|
|
|
local mirror = require(ReplicatedStorage.mirror:Clone())
|
|
|
|
local mcs = mirror.world()
|
|
|
|
local ecs = jecs.world()
|
2024-04-23 15:10:49 +00:00
|
|
|
|
2024-04-30 23:09:15 +00:00
|
|
|
local D1 = ecs:component()
|
|
|
|
local D2 = ecs:component()
|
|
|
|
local D3 = ecs:component()
|
|
|
|
local D4 = ecs:component()
|
|
|
|
local D5 = ecs:component()
|
|
|
|
local D6 = ecs:component()
|
|
|
|
local D7 = ecs:component()
|
|
|
|
local D8 = ecs:component()
|
2024-04-24 15:32:07 +00:00
|
|
|
|
2025-06-25 11:31:25 +00:00
|
|
|
local E1 = mcs:component()
|
|
|
|
local E2 = mcs:component()
|
|
|
|
local E3 = mcs:component()
|
|
|
|
local E4 = mcs:component()
|
|
|
|
local E5 = mcs:component()
|
|
|
|
local E6 = mcs:component()
|
|
|
|
local E7 = mcs:component()
|
|
|
|
local E8 = mcs:component()
|
2024-04-25 05:26:38 +00:00
|
|
|
|
2024-07-15 18:29:06 +00:00
|
|
|
local function flip()
|
2025-08-31 01:38:06 +00:00
|
|
|
return math.random() >= 0.3
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
|
|
|
|
2024-10-12 20:18:11 +00:00
|
|
|
local N = 2 ^ 16 - 2
|
2024-04-25 14:26:30 +00:00
|
|
|
|
2024-07-15 18:29:06 +00:00
|
|
|
for i = 1, N do
|
2024-04-23 15:10:49 +00:00
|
|
|
local entity = ecs:entity()
|
2024-04-25 05:26:38 +00:00
|
|
|
local m = mcs:entity()
|
2024-04-23 15:10:49 +00:00
|
|
|
|
2024-09-26 13:40:50 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:add(entity, entity)
|
|
|
|
mcs:add(m, m)
|
2024-09-26 13:40:50 +00:00
|
|
|
end
|
2024-07-15 18:29:06 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:set(entity, D1, true)
|
|
|
|
mcs:set(m, E1, true)
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2024-07-15 18:29:06 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:set(entity, D2, true)
|
|
|
|
mcs:set(m, E2, true)
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2024-07-15 18:29:06 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:set(entity, D3, true)
|
|
|
|
mcs:set(m, E3, true)
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2024-07-15 18:29:06 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:set(entity, D4, true)
|
|
|
|
mcs:set(m, E4, true)
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2024-07-15 18:29:06 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:set(entity, D5, true)
|
|
|
|
mcs:set(m, E5, true)
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2024-07-15 18:29:06 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:set(entity, D6, true)
|
|
|
|
mcs:set(m, E6, true)
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2024-07-15 18:29:06 +00:00
|
|
|
if flip() then
|
2025-08-31 01:38:06 +00:00
|
|
|
ecs:set(entity, D7, true)
|
|
|
|
mcs:set(m, E7, true)
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2025-08-31 01:38:06 +00:00
|
|
|
if flip() then
|
|
|
|
ecs:set(entity, D8, true)
|
|
|
|
mcs:set(m, E8, true)
|
2024-04-25 14:26:30 +00:00
|
|
|
end
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
|
|
|
|
2024-09-26 13:40:50 +00:00
|
|
|
local count = 0
|
|
|
|
|
|
|
|
for _, archetype in ecs:query(D2, D4, D6, D8):archetypes() do
|
2024-10-12 20:18:11 +00:00
|
|
|
count += #archetype.entities
|
2024-04-23 15:10:49 +00:00
|
|
|
end
|
2024-09-26 13:40:50 +00:00
|
|
|
|
2025-08-31 01:38:06 +00:00
|
|
|
|
|
|
|
local mq = mcs:query(E2, E4, E6, E8):cached()
|
|
|
|
local jq = ecs:query(D2, D4, D6, D8):cached()
|
|
|
|
|
|
|
|
print(count, #jq:archetypes())
|
2024-04-23 15:10:49 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
ParameterGenerator = function()
|
|
|
|
return
|
2024-07-15 18:29:06 +00:00
|
|
|
end,
|
2024-04-23 15:10:49 +00:00
|
|
|
|
|
|
|
Functions = {
|
2025-06-25 11:31:25 +00:00
|
|
|
-- Matter = function()
|
|
|
|
-- for entityId, firstComponent in newWorld:query(A2, A4, A6, A8) do
|
|
|
|
-- end
|
|
|
|
-- end,
|
|
|
|
|
|
|
|
-- ECR = function()
|
|
|
|
-- for entityId, firstComponent in registry2:view(B2, B4, B6, B8) do
|
|
|
|
-- end
|
|
|
|
-- end,
|
|
|
|
--
|
|
|
|
Mirror = function()
|
2025-08-31 01:38:06 +00:00
|
|
|
for entityId, firstComponent in mq do
|
2024-10-12 20:18:11 +00:00
|
|
|
end
|
|
|
|
end,
|
2024-09-26 13:40:50 +00:00
|
|
|
|
2024-07-15 18:29:06 +00:00
|
|
|
Jecs = function()
|
2025-08-31 01:38:06 +00:00
|
|
|
for entityId, firstComponent in jq do
|
2024-10-12 20:18:11 +00:00
|
|
|
end
|
2024-04-25 14:26:30 +00:00
|
|
|
end,
|
2024-04-23 15:10:49 +00:00
|
|
|
},
|
|
|
|
}
|