I had the idea of a component based system with dynamic behavior for a long time. In this talk I show one approach in solving this problem, with a focus on ECMAScript 6 new features.
system knowledge should have one authoritative, unambiguous representation. Every piece of knowledge in the development of something should have a single representation. A system's knowledge is far broader than just its code. It refers to database schemas, test plans, the build system, even documentation." DRY => SOLID => Design Patterns Source Orthogonality and the DRY Principle, Don't repeat yourself
system knowledge should have one authoritative, unambiguous representation. Every piece of knowledge in the development of something should have a single representation. A system's knowledge is far broader than just its code. It refers to database schemas, test plans, the build system, even documentation." DRY => SOLID => Design Patterns Source Orthogonality and the DRY Principle, Don't repeat yourself
Systems. (order does not imply anything) Problem As a content creator, I want to be able to create Custom Entities in order to satisfy new use cases. Desired Features Ability to add/remove behavior of an component/entity without changing the implementation.
Movement + Player var asteroid = new ComponentCarcass(); asteroid.addComponent(new View(x=50, y=60)); asteroid.x // 50 Component Carcass addComponent removeComponent handleMessage Message TRAP
Movement + Player var asteroid = new ComponentCarcass(); asteroid.addComponent(new View(x, y)); asteroid.addComponent(new Movement()); Component Carcass addComponent removeComponent handleMessage Message TRAP
will check which component from the "array of components" knows how to respond to the trapped message. It will forward the message to the correct component and return the response
Movement + Player var asteroid = new ComponentCarcass(); asteroid.addComponent(new View(x, y)); asteroid.addComponent(new Movement()); asteroid.addComponent(new Player()); Component Carcass addComponent removeComponent handleMessage Message TRAP
Old Proxy API 3. Traits: Composable Units of Behavior 4. Delegation - The White Paper[Google Tech Talk] 5. Changes to ECMAScript - Proxies and Traits 6. Brendan Eich - Proxies are Awesome!