Comments (7)
All the operations [add and delete] now happens always the next submit operation. Today I am going to commit another fix/change of behavior to be sure that everything is in-line with this, however deleting items next iteration has been there for quite a while now.
from svelto.ecs.
is this still happening?
from svelto.ecs.
It still happens. At the same time, the delete operation is performed first. At this point, the add operation has not been performed, so the group cannot be found. I hope my broken English has been made clear...
from svelto.ecs.
Can I see your code? My understanding is that on the same frame you do two operations on the same entity which is something I reckon should never happen
from svelto.ecs.
You're right. We haven't used it in the project yet, but we do some pre-research based on survival example. This may be rare in real project. However, we believe that extreme cases are still possible, especially in the case of multi-thread. Maybe it would be better if the engine solved it. Anyway, this is my personal opinion :)
Here's our test code,
void BuildRandomIsland(IFleetComponent fleet, int islandCount)
{
var point = fleet.points[fleet.pointIdx];
var info = new UnmovableInfo
{
position = point
};
for (int i = 0; i < islandCount; i++)
{
var data = this._islandDatas[Random.Range(0, this._islandDatas.Length - 1)];
info.position.x += Random.Range(-MAX_RANDOM_RANGE, MAX_RANDOM_RANGE);
info.position.z += Random.Range(-MAX_RANDOM_RANGE, MAX_RANDOM_RANGE);
info.rotation.y = Random.Range(-MAX_RANDOM_RANGE, MAX_RANDOM_RANGE);
string key = _actorFactory.Build(data, ref info, ECSGroups.ActiveEnemies);
this._islands.Enqueue(key);
}
}
void ClearUnusedIsland()
{
while (this._islands.Count > MAX_QUEUE_COUNT)
{
var key = this._islands.Dequeue();
_actorFactory.Remove<UnmovableEntityDescriptor>(key, ECSGroups.ActiveEnemies);
}
}
from svelto.ecs.
OK. It's unusual, obviously removing the excess in this case is weird. I can fix the problem, but it would make the building of the entities much slower.
For multithreading it's a different problem. the EnginesRoots are not thread safe, so if you want to add and remove from other threads, you will need at least to create your specialized Entity Scheduler in such away adding and remove is thread safe inside a specific thread.
I don't think massive parallelism is ever needed to add and remove entities, I suggest use synchronization points instead.
This is in theory tho, as in practice I never added and removed entities from other threads, although the next example I want to develop will be totally multithreaded so I can investigate more cases.
Please let me know what you think about all of this. Currently your code would crash by design, but I would need a pretty strong argument to fix it as it would make build entities slower.
from svelto.ecs.
Understand. I think we can avoid these problems in the project.
from svelto.ecs.
Related Issues (20)
- Multiple FindGroups Issue HOT 3
- Performance improvement for `NB<T>` HOT 5
- IReactOnDisposeEx doesn't run at all HOT 1
- Errors in readme HOT 1
- [3.5.0-pre] Filter.Add behavior changed, throws exeption HOT 1
- [3.5.0-pre] Group compound warning triggers for Svelto base types HOT 1
- [3.5.0-pre] Key not found exception when removing the same entity multiple times HOT 1
- Preallocating after entities have been created results in corrupting the entity reference table. HOT 2
- NativeEGIDMultiMappers (and possibly EgidMultiMappers) optimization HOT 1
- error CS0246: The type or namespace name 'ConditionalAttribute' could not be found HOT 1
- nuget package is compiled as debug HOT 18
- is there network example? HOT 1
- ICompositionRoot.OnContextDestroyed called twice in Example2-Unity Hybrid-Survival HOT 2
- Question about why Svelto's log is default StackTraceLogType.None HOT 2
- Use `Enum.GetNames` to replace the need of a struct for `ISequenceOrder` HOT 2
- `NativeEntityFactory` cannnot create ExtendibleEntityDescriptors HOT 2
- `SortedJobifiedEnginesGroup` does not implement `IJobifiedEngine` HOT 1
- GroupHashMap throws exception when serializing entity in group using bytemask HOT 2
- QueryEntities Unlimited Components HOT 3
- test discussion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelto.ecs.