mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Update Matter's time
This commit is contained in:
parent
11f27909d2
commit
73147f3fef
3 changed files with 24 additions and 30 deletions
|
@ -53,11 +53,10 @@ local E8 = mcs:entity()
|
||||||
local registry2 = ecr.registry()
|
local registry2 = ecr.registry()
|
||||||
|
|
||||||
local function flip()
|
local function flip()
|
||||||
return math.random() >= 0.15
|
return math.random() >= 0.25
|
||||||
end
|
end
|
||||||
|
|
||||||
local common = 0
|
local N = 2^16-2
|
||||||
local N = 5000
|
|
||||||
local archetypes = {}
|
local archetypes = {}
|
||||||
|
|
||||||
local hm = 0
|
local hm = 0
|
||||||
|
@ -68,6 +67,12 @@ for i = 1, N do
|
||||||
local entity = ecs:entity()
|
local entity = ecs:entity()
|
||||||
local m = mcs:entity()
|
local m = mcs:entity()
|
||||||
|
|
||||||
|
if flip() then
|
||||||
|
registry2:set(id, B1, {value = true})
|
||||||
|
ecs:set(entity, D1, { value = true})
|
||||||
|
newWorld:insert(n, A1({value = true}))
|
||||||
|
mcs:set(m, E1, { value = 2})
|
||||||
|
end
|
||||||
if flip() then
|
if flip() then
|
||||||
combination ..= "B"
|
combination ..= "B"
|
||||||
registry2:set(id, B2, {value = true})
|
registry2:set(id, B2, {value = true})
|
||||||
|
@ -121,15 +126,7 @@ for i = 1, N do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if #combination == 7 then
|
|
||||||
combination = "A" .. combination
|
|
||||||
common += 1
|
|
||||||
registry2:set(id, B1, {value = true})
|
|
||||||
ecs:set(entity, D1, { value = true})
|
|
||||||
newWorld:insert(n, A1({value = true}))
|
|
||||||
mcs:set(m, E1, { value = 2})
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
if combination:find("BCDF") then
|
if combination:find("BCDF") then
|
||||||
if not archetypes[combination] then
|
if not archetypes[combination] then
|
||||||
|
@ -148,21 +145,13 @@ local green = rgb.green
|
||||||
|
|
||||||
local WALL = gray(" │ ")
|
local WALL = gray(" │ ")
|
||||||
|
|
||||||
local numberOfArchetypes = 0
|
local count = 0
|
||||||
for _ in archetypes do
|
|
||||||
numberOfArchetypes += 1
|
|
||||||
end
|
|
||||||
print(common)
|
|
||||||
|
|
||||||
print(
|
for _, archetype in ecs:query(D2, D4, D6, D8):archetypes() do
|
||||||
"N entities "..yellow(N)
|
count += #archetype.entities
|
||||||
..WALL
|
end
|
||||||
.."with common components: "
|
|
||||||
..yellow(tostring(common).."/"..tostring(N)).." "
|
print(count)
|
||||||
..yellow("("..string.format("%.2f", (common / (2^16 - 2)* 100)).."%)")
|
|
||||||
..WALL
|
|
||||||
..yellow("Total Archetypes: "..numberOfArchetypes)
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ParameterGenerator = function()
|
ParameterGenerator = function()
|
||||||
|
@ -170,14 +159,19 @@ return {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
Functions = {
|
Functions = {
|
||||||
Mirror = function()
|
Matter = function()
|
||||||
for entityId, firstComponent in mcs:query(E1, E2, E3, E4) do
|
for entityId, firstComponent in newWorld:query(A2, A4, A6, A8) do
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
ECR = function()
|
||||||
|
for entityId, firstComponent in registry2:view(B2, B4, B6, B8) do
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
Jecs = function()
|
Jecs = function()
|
||||||
for entityId, firstComponent in ecs:query(D1, D2, D3, D4) do
|
for entityId, firstComponent in ecs:query(D2, D4, D6, D8) do
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
BIN
image-3.png
BIN
image-3.png
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 61 KiB |
|
@ -1815,7 +1815,7 @@ export type World = {
|
||||||
component: <T>(self: World) -> Entity<T>,
|
component: <T>(self: World) -> Entity<T>,
|
||||||
--- Gets the target of an relationship. For example, when a user calls
|
--- Gets the target of an relationship. For example, when a user calls
|
||||||
--- `world:target(id, ChildOf(parent), 0)`, you will obtain the parent entity.
|
--- `world:target(id, ChildOf(parent), 0)`, you will obtain the parent entity.
|
||||||
target: (self: World, id: Entity, relation: Entity, nth: number) -> Entity?,
|
target: (self: World, id: Entity, relation: Entity, index: number?) -> Entity?,
|
||||||
--- Deletes an entity and all it's related components and relationships.
|
--- Deletes an entity and all it's related components and relationships.
|
||||||
delete: (self: World, id: Entity) -> (),
|
delete: (self: World, id: Entity) -> (),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue