Comments (2)
Just in case you're still wondering, this approach to writing components should solve the problem:
import { Component, Types } from "ecsy"
class MyComponent extends Component<MyComponent> {
foo!: boolean
bar?: boolean // optional property
static schema = {
foo: { type: Types.Boolean, default: false },
bar: { type: Types.Boolean }
}
}
from ecsy.
Thx for sharing (I guess I may close this now), though actually I decided to write my own ECS implementation, and ended up with components being simple js objects, while the rest classes like Entity, System, World, - they're all replaced with different implementation having similar API. I wrote a couple posts about it here:
I honestly don't see any reasons why components should be classes, when it's basically data and doesn't (shouldn't) have any logic implementation. In my second article I feature how GPU usage / CPU usage / FPS, - all improved due to all my changes. Schemas and queries gone down to attribute access, and overall types are more straightforward.
from ecsy.
Related Issues (20)
- Expose `getEntityByName` in `World`? HOT 1
- Fix stats for ecsy-devtools HOT 1
- Adding automatic system execution order using a system graph
- TypeScript: improve ComponentConstructor type
- Improvement: TypeScript tests
- Improvement: Inferring schema types on Components HOT 3
- typescript: TypeError: c.getName is not a function
- creating a new Entity copies over any values from Custom Entity class
- Integrate version.js in the build system
- [QUESTION] Project status/outlook HOT 9
- Is there any way to inject service in System or World? HOT 1
- Assigning default value for Ref type in a schema can cause sideeffects
- Babylon.js ball example seems a bit broken
- Feature request: Support multiple components of the same type per entity.
- Typescript - Mandatory field is not present on the SystemQueries interface
- Class constructor System cannot be invoked without 'new'
- Clear system resource after Removing a system HOT 1
- The removal queries can react pooled entity when removing entity inside system
- is ecsy dead? HOT 10
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 ecsy.