mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2026-02-04 06:37:06 +07:00
Compare commits
13 Commits
e48bdf0511
...
f6b8844a82
| Author | SHA1 | Date | |
|---|---|---|---|
| f6b8844a82 | |||
|
|
7ce5ee924c | ||
|
|
539a62c8a8 | ||
|
|
63a7ab5c79 | ||
|
|
9a9fb1ddb9 | ||
|
|
7b44740803 | ||
|
|
b0d035c0d4 | ||
|
|
8d88d55267 | ||
|
|
b774abf63c | ||
|
|
4a018f4c40 | ||
|
|
39c20f13dd | ||
|
|
ce864b7433 | ||
|
|
04c9e4aaeb |
@@ -63,6 +63,7 @@
|
||||
- [Chunk](#chunk)
|
||||
- [Builder](#builder)
|
||||
- [Changelog](#changelog)
|
||||
- [v1.9.0](#v190)
|
||||
- [v1.8.0](#v180)
|
||||
- [v1.7.0](#v170)
|
||||
- [v1.6.0](#v160)
|
||||
@@ -1565,6 +1566,11 @@ builder_mt:destruction_policy :: id -> builder
|
||||
|
||||
## Changelog
|
||||
|
||||
### v1.9.0
|
||||
|
||||
- Performance improvements of the [`evolved.destroy`](#evolveddestroy) and [`evolved.batch_destroy`](#evolvedbatch_destroy) functions
|
||||
- Ensured deterministic chunk ordering to improve processing consistency across runs
|
||||
|
||||
### v1.8.0
|
||||
|
||||
- Added the new [`evolved.REALLOC`](#evolvedrealloc) and [`evolved.COMPMOVE`](#evolvedcompmove) fragment traits that allow customizing component storages
|
||||
|
||||
@@ -5,16 +5,11 @@
|
||||
- observers and events
|
||||
- add INDEX fragment trait
|
||||
- use compact prefix-tree for chunks
|
||||
- optional ffi component storages
|
||||
|
||||
## Thoughts
|
||||
|
||||
- We should have a way to not copy components on deferred spawn/clone
|
||||
- Not all assoc_list_remove operations need to keep order, we can have an unordered variant also
|
||||
- We still have several places where we use __lua_next without deterministic order, we should fix that
|
||||
- Having a light version of the gargabe collector can be useful for some use-cases
|
||||
- We can shrink the table pool tables on garbage collection if they are too large
|
||||
- Should we sort chunk children by fragment id?
|
||||
- Basic default component value as true looks awful, should we use something else?
|
||||
|
||||
## Known Issues
|
||||
|
||||
@@ -16,6 +16,7 @@ require 'develop.testing.system_as_query_tests'
|
||||
|
||||
require 'develop.benchmarks.clone_bmarks'
|
||||
require 'develop.benchmarks.common_bmarks'
|
||||
require 'develop.benchmarks.destroy_bmarks'
|
||||
require 'develop.benchmarks.migration_bmarks'
|
||||
require 'develop.benchmarks.process_bmarks'
|
||||
require 'develop.benchmarks.spawn_bmarks'
|
||||
|
||||
56
develop/benchmarks/destroy_bmarks.lua
Normal file
56
develop/benchmarks/destroy_bmarks.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
local evo = require 'evolved'
|
||||
local basics = require 'develop.basics'
|
||||
|
||||
evo.debug_mode(false)
|
||||
|
||||
local N = 1000
|
||||
|
||||
print '----------------------------------------'
|
||||
|
||||
basics.describe_bench(string.format('Destroy Benchmarks: Acquire and Release %d ids', N),
|
||||
function(tables)
|
||||
local id = evo.id
|
||||
local destroy = evo.destroy
|
||||
|
||||
for i = 1, N do
|
||||
tables[i] = id()
|
||||
end
|
||||
|
||||
for i = 1, N do
|
||||
destroy(tables[i])
|
||||
end
|
||||
end, function()
|
||||
return {}
|
||||
end)
|
||||
|
||||
basics.describe_bench(string.format('Destroy Benchmarks: Acquire and Release %d double ids', N),
|
||||
function(tables)
|
||||
local id = evo.id
|
||||
local destroy = evo.destroy
|
||||
|
||||
for i = 1, N, 2 do
|
||||
tables[i], tables[i + 1] = id(2)
|
||||
end
|
||||
|
||||
for i = 1, N, 2 do
|
||||
destroy(tables[i], tables[i + 1])
|
||||
end
|
||||
end, function()
|
||||
return {}
|
||||
end)
|
||||
|
||||
basics.describe_bench(string.format('Destroy Benchmarks: Acquire and Release %d triple ids', N),
|
||||
function(tables)
|
||||
local id = evo.id
|
||||
local destroy = evo.destroy
|
||||
|
||||
for i = 1, N, 3 do
|
||||
tables[i], tables[i + 1], tables[i + 2] = id(3)
|
||||
end
|
||||
|
||||
for i = 1, N, 3 do
|
||||
destroy(tables[i], tables[i + 1], tables[i + 2])
|
||||
end
|
||||
end, function()
|
||||
return {}
|
||||
end)
|
||||
@@ -2302,27 +2302,66 @@ do
|
||||
evo.set(e2, f2, 44)
|
||||
|
||||
do
|
||||
local iter, state = evo.execute(q)
|
||||
local chunk = iter(state)
|
||||
assert(chunk and chunk ~= evo.chunk(f1))
|
||||
local e1_count = 0
|
||||
local e2_count = 0
|
||||
|
||||
for _, entity_list, entity_count in evo.execute(q) do
|
||||
for i = 1, entity_count do
|
||||
if entity_list[i] == e1 then
|
||||
e1_count = e1_count + 1
|
||||
elseif entity_list[i] == e2 then
|
||||
e2_count = e2_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert(e1_count == 1)
|
||||
assert(e2_count == 1)
|
||||
end
|
||||
|
||||
evo.set(q, evo.EXCLUDES, { f2 })
|
||||
|
||||
do
|
||||
local iter, state = evo.execute(q)
|
||||
local chunk = iter(state)
|
||||
assert(chunk and chunk ~= evo.chunk(f1))
|
||||
local e1_count = 0
|
||||
local e2_count = 0
|
||||
|
||||
for chunk, entity_list, entity_count in evo.execute(q) do
|
||||
assert(not chunk:has(f2))
|
||||
|
||||
for i = 1, entity_count do
|
||||
if entity_list[i] == e1 then
|
||||
e1_count = e1_count + 1
|
||||
elseif entity_list[i] == e2 then
|
||||
e2_count = e2_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert(e1_count == 1)
|
||||
assert(e2_count == 0)
|
||||
end
|
||||
|
||||
evo.set(q, evo.INCLUDES, { f1 })
|
||||
|
||||
do
|
||||
local iter, state = evo.execute(q)
|
||||
local chunk, entity_list, entity_count = iter(state)
|
||||
assert(chunk == evo.chunk(f1))
|
||||
assert(entity_list and entity_list[1] == e1)
|
||||
assert(entity_count == 1)
|
||||
local e1_count = 0
|
||||
local e2_count = 0
|
||||
|
||||
for chunk, entity_list, entity_count in evo.execute(q) do
|
||||
assert(chunk:has(f1))
|
||||
assert(not chunk:has(f2))
|
||||
|
||||
for i = 1, entity_count do
|
||||
if entity_list[i] == e1 then
|
||||
e1_count = e1_count + 1
|
||||
elseif entity_list[i] == e2 then
|
||||
e2_count = e2_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assert(e1_count == 1)
|
||||
assert(e2_count == 0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
921
evolved.lua
921
evolved.lua
File diff suppressed because it is too large
Load Diff
34
rockspecs/evolved.lua-1.9.0-0.rockspec
Normal file
34
rockspecs/evolved.lua-1.9.0-0.rockspec
Normal file
@@ -0,0 +1,34 @@
|
||||
rockspec_format = "3.0"
|
||||
package = "evolved.lua"
|
||||
version = "1.9.0-0"
|
||||
source = {
|
||||
url = "git://github.com/BlackMATov/evolved.lua",
|
||||
tag = "v1.9.0",
|
||||
}
|
||||
description = {
|
||||
homepage = "https://github.com/BlackMATov/evolved.lua",
|
||||
summary = "Evolved ECS (Entity-Component-System) for Lua",
|
||||
detailed = [[
|
||||
`evolved.lua` is a fast and flexible ECS (Entity-Component-System) library for Lua.
|
||||
It is designed to be simple and easy to use, while providing all the features needed to create complex systems with blazing performance.
|
||||
]],
|
||||
license = "MIT",
|
||||
labels = {
|
||||
"ecs",
|
||||
"entity",
|
||||
"entities",
|
||||
"component",
|
||||
"components",
|
||||
"entity-component",
|
||||
"entity-component-system",
|
||||
},
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1",
|
||||
}
|
||||
build = {
|
||||
type = "builtin",
|
||||
modules = {
|
||||
evolved = "evolved.lua",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user