Comments (9)
Ah, very interesting! I've used React + Flux (using Alt.js) for the past few months and haven't found it as easy as Ractive, but for this case I agree it could work well.
I presume engine.addSystem
would still be required to register the systems in the correct order. Would the Systems still get access to the whole engine instance, or are you thinking of encapsulating functions like onAction
and getNodeType
in the Systems as well?
Hitagi.js, another recent ECS, also has Systems with overridable functions, but it is quite limited in that you can only subscribe to single components in the update method: https://github.com/RoganMurley/hitagi.js/wiki/System
from scent.
Flux is not that good, Redux implementation is much better in my opinion. I don't know Ractive, but there is a bunch of approaches lately building on ideas of React.
I am not sure if engine.addSystem
is useful that much. It should work like creating tree of components in React. You will have a single entry System and then in a execute
method you would specify other systems to run in specified order. These can again specify their own subsystems and so on. That would allow to control dynamically what systems are being executed based on some states and in my opinion it should be more clear what is happening where.
Regarding other methods like getNodeType
, I suppose that you would need engine instance there anyway, so you can use them in there for sure. Additionally there could be a way to specify node types you are interested in and the System would grab them for you and when a system is removed (not returned from the execute
method) it would do proper cleanup. Same for actions.
Hitagi.js looks very interesting, I will definitely investigate and perhaps get some inspiration there. Thanks!
from scent.
Oh, I didn't realize the execute
method is similar to React's render
method, it makes sense now. In that case engine.addSystem
does seem redundant.
from scent.
I am essentially thinking to leave the System as it is in the Scent, but make a separate project with this approach. In that case keeping addSystem
is necessary to actually add top level system into the mix.
I am curious @martikaljuve, how much would this new approach help you in your project? I suppose that you use something different to organize your code too and you are not going to change it. I am certain that it would help us for our game, so I am soon going to design this in more detail.
from scent.
My Scent projects have been really simple right now, mostly just 2D sprites or 3D meshes slowly panning across the screen with some touch interactivity. I've managed fine with just top-level systems with no nesting. As soon as I get to create something more game-like, I would find more use for nesting and adding/removing systems.
I've been reading up on Redux now, the documentation is excellent.
from scent.
I've been using React extensively for the last year, so I could help with experimenting with this new approach if you ever feel like it.
This evening I tried to hack together Scent and React, here's the result: https://github.com/martikaljuve/scent-react-example/tree/master/app
Another approach could be to implement a replacement to ReactDOM.render
without using the DOM. It might also be interesting to not depend on React, but use JSX with a custom pragma, e.g. Scent.createSystem
instead of React.createElement
.
from scent.
Hey. It's great that you are still interested in using Scent. Sadly me not so much. We have kinda abandoned our attempt of making game in Javascript for now and working on it with Unreal Engine. Honestly I don't have much of motivation to maintain Scent right now. Would you be perhaps interested in it? I could still provide code review and such.
from scent.
I would be up for it, but I'm not well-versed in CoffeeScript. I've been planning to write something similar using ES6 or possibly TypeScript, but that should probably happen in another project.
On another note, have you looked at Mozilla's A-Frame? They have an interesting approach of having entities defined in the DOM using Custom Elements.
from scent.
Honestly I don't use CoffeeScript anymore for some time now. I regret now that Scent got caught in the time I've been CoffeeScript admirer. So either rewrite this or make it as a new project entirely, it's up to you. I've added you as a collaborator.
I don't know anything about A-Frame and I am not sure how having some state in DOM could be a good thing. How are you going to make a server based logic then? I don't like that idea at all :)
from scent.
Related Issues (19)
- Any recommendations for tracking changes? HOT 3
- Allow triggering actions with no handlers? HOT 8
- Only first Node.onAdded callback is firing? HOT 6
- Adding an entity instead of array of components to engine? HOT 2
- Engine update invoked before engine start
- Expose component types from node type
- Register available component types within Engine
- Chained setting of data to component
- Replacing component doesn't trigger node change events HOT 5
- Browser build with dependencies HOT 2
- Make better tutorial and setup small demo HOT 2
- Release 0.8.3
- Make engine iterable over entities
- Triggering actions of the same type within single update
- Here's a simple TypeScript definition file for Scent. HOT 3
- An in-range update of debug is breaking the build 🚨 HOT 2
- An in-range update of debug is breaking the build 🚨 HOT 2
- A possibly useful tip to get component properties on entities. HOT 1
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 scent.