Comments (4)
I guess regarding DLL or any data structure thereof, having an onAddedNode/onRemoveNode hook would be required if nodes are going to be reused, since a given System would have to listen to those hooks in order to initialize/reset a given node.
After all, the data structures are not mean't to be updated directly, but through the Game. Which is why NodeLists add/remove methods are internal.
A doubly-linked list i guess is the most versatile. After all, even a RenderingSystem could still benefit greatly with a doubly-linked list, since one could listen to the NodeList's onRemoveNode(node:RenderNode) trigger to handle removing of Object3D nodes easily within a singly-linked list rendering engine (eg. Alternativa3D, as it doesn't know what the "previous" Object3D would be (a3d only has a next:Object3D pointer), while a doubly-linked list system would allow for such a quick removal that wasn't even supported by the engine itself (eg. node.previous.obj.next = node.next.obj) ). onAddNode() can be used to reset a given node values in various other systems.
from ash.
Thank you for your thoughts. It will take a while to digest them all. Here's my take on the two direct questions you ask.
Q1 - Yes, the only time we need to protect the removed node is during the list iteration. As you say, the system could be responsible for locking and unlocking the list, but that would require developers using the library to know more about the inner workings of Ash, and to remember to lock lists when iterating. That's why I prefer the framework doing a conservative lock during game update.
Q2 - The nodeAdded and nodeRemoved signals are used in systems to do one-off actions on nodes, like adding display objects to the display list in the render node of the Asteroids example. They're not used by the family because the family manages the objects in the list directly. i.e. if a node is added or removed, it is added or removed by the family, so the family doesn't need to use the signal.
from ash.
Anyway, here's the Haxe branch folder with the data structure generics. It's called HashDS. Not complete, obviously.
https://github.com/Glidias/Ash/tree/master/hx/hashds
One thing i dislike about Generics is the potential code bloat just to support strict-typing. Thus, a dynamic fall-back should always be considered. Same with inlining. But both practices are useful in cases where one wishes to avoid duplicating typed code.
Anyway, in my wip modification port of Ash to Haxe (I call it HashDS), here's a wiki considering paradigms on how hashing/storage of Family ownerships can be done within Ash/HashDS.
https://github.com/Glidias/Ash/wiki/HAsh-DS-exploration-notes
from ash.
Anyway, I deleted the Ash fork and created a completely new repo instead for the Haxe port/modification.
Here it is, presenting HashDS:
https://github.com/Glidias/HashDS
from ash.
Related Issues (20)
- Should we enable developers to extend Ash to use more sophisticated rules for adding entities to node lists? HOT 14
- System.priority can be Number HOT 2
- Add ability to get all componentes on an Entity HOT 3
- systems communication HOT 2
- Scripting solutions with ASH. HOT 1
- Entity.clone() - possible error if component registered with BaseClass HOT 1
- entity.asNode(); HOT 1
- User input events queue HOT 6
- Robotlegs Ash Extension fails with latest robotlegs HOT 1
- NodeList.forEach
- ComponentMatchingFamily.componentAddedToEntity check added component HOT 1
- Avoid Vector/Array push() method HOT 4
- Please start adding version tags HOT 5
- SignalBase.removeAll()
- EntityStateMachine and EngineStateMachine has almost same code HOT 4
- Test file names does not match the class name been tested.
- EngineStateMachine changing states during Engine update HOT 1
- Removing entity that was removed before causes entity list change. HOT 2
- ASDoc
- Clear Next/Previous when removing Entity from EntityList HOT 4
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 ash.