Comments (6)
Component and Entity types are currently world specific for optimization reasons, but it wouldn't affect the API to change it (WorldEntity might need to change the TypeScript definition a bit). I'm certainly open to making it easier to use entities and components in more than one world. What use-case do you have in mind?
from ape-ecs.
A couple of current use cases I have in mind:
- independent/unsynchronized simulation regions, e.g. not ticking everything all the time
- independent spatial regions, without affording for that internally with an additional coordinate or "plane" tag
Speaking of spatial sharding, what's your take on an index for collision detection?
from ape-ecs.
That makes a lot of sense. I'll make it a priority. I think I can do it without a 2.0, but it might need to be API breaking. We'll see! I'll keep you in the loop.
from ape-ecs.
Components can now be registered to multiple worlds in the portability branch.
I'll start thinking about the ability to copy and move entities between worlds in the future.
from ape-ecs.
Fantastic, for an update on where I'm at, am currently pursuing "what if I just used DOM elements literally as an ECS, what with data attributes, CSS variables, quereySelectorAll, and such"; you can see a working demo here: https://jspit.vercel.app/domgeon.html
fwiw, my approach to FOV / lighting does provide a potential use case for copy/moving between between worlds:
- there is the objective world ( in domgeon terms the "solid tile plane" ); it serves as the source of truth, where movement and interaction happens
- the lighting simulation gets calculated in the objective world ( by (re)computing
--light
CSS variables using a modified shadowcasting algorithm ) - but we don't draw the objective world, rather what we do is copy in-FOV tiles out of the objective world, into a subjective plane, after first clearing any copied light values from the prior round
- I plan to later use this same approach for AI, so that they also only see their own subjective copy of the world, sensed through LOS/FOV observations
Now, currently for domgeon, this is all just so much div.grid div.plane div.tile
elements; how would I map it onto a more formalized ECS, not sure.
And a parting thought: copying between ECSes seems to me just a lighter weight version of (de)serialzing, which ECSes are supposed to afford quite well in general; not sure what ape-ecs's current story is around loading/saving tho?
from ape-ecs.
You can run getObject on a world, entity, or component. The results can be used as the definition in createEntity/createEntities.
from ape-ecs.
Related Issues (20)
- Init System with Custom Parameters HOT 1
- utils/IdGenerator is not browser compatible HOT 1
- Using `Class.constructor.name` as identifier to register and refer to components is leading to issues with bundlers and code minification HOT 3
- WIP: Undefined system instance members if TypeScript has useDefineForClassFields activated and is transpiled with @babel/plugin-proposal-class-properties HOT 1
- Documentation of the Query class could be more clear about persist and execute
- Add a code style tool to keep the code formatting consistent. HOT 1
- fromAny seems to override fromAll? HOT 2
- Sharing Queries? HOT 1
- entity.getObject can return a circular reference HOT 2
- World Cleanup/Deletion? HOT 1
- Loading world and jumping into a given point in the system stack? HOT 6
- genPrefix doesn't do anything at all HOT 4
- System.subscribe Should Accept Components As Types HOT 1
- EntityRefs should error when invalid values are used
- Calling destroy twice has very odd effects HOT 1
- Feature Request: Support passing component class instead of string component names HOT 2
- Documentation update needed?
- Default component values are the same object?
- Better type support for Components HOT 1
- componentReserved should be exported
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 ape-ecs.