GithubHelp home page GithubHelp logo

What is purpose of the System? about scent HOT 9 CLOSED

danielkcz avatar danielkcz commented on September 25, 2024
What is purpose of the System?

from scent.

Comments (9)

martikaljuve avatar martikaljuve commented on September 25, 2024

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.

danielkcz avatar danielkcz commented on September 25, 2024

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.

martikaljuve avatar martikaljuve commented on September 25, 2024

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.

danielkcz avatar danielkcz commented on September 25, 2024

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.

martikaljuve avatar martikaljuve commented on September 25, 2024

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.

martikaljuve avatar martikaljuve commented on September 25, 2024

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.

danielkcz avatar danielkcz commented on September 25, 2024

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.

martikaljuve avatar martikaljuve commented on September 25, 2024

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.

danielkcz avatar danielkcz commented on September 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.