qiao / ces.js Goto Github PK
View Code? Open in Web Editor NEWComponent-Entity-System framework for JavaScript games.
Component-Entity-System framework for JavaScript games.
Hi Qiao, really eager to start working with this lib, looks to be well thought out and designed.
I've noticed the dist and zip are both out of date and the examples do not work because of this. For example, addedToWorld does not actually get called in the dist version. I noticed these discrepancies when trying the example, so I had to pull the repo, delete dist, then npm install -d, then make, then copied over the new build.
Is CES.js optimized for the v8 javascript engine? I noticed you were using John Resig's inheritance class for extending your objects, but in my own projects I've found that really bogs down the code optimization. I'm actually moving to using an entity component system to get away from using inheritance chains, but I see you're using them in your engine. Do you have any performance measures that you could show me?Just to ensure that If I go with CES, I won't be adding just another inheritance layer on top of my already existing one. Thanks!
can I use this for an MMORPG server? How can I dynamically create an entity? Like there will be a lot of entities and data will be different for each of them.
CES = require('ces')
CompA = CES.Component.extend({name: 'a'})
CompB = CES.Component.extend({name: 'b'})
var world = new CES.World();
world.entityAdded('b').add(function (entity) {
console.log('b')
});
world.entityAdded('a').add(function (entity) {
console.log('a')
entity.addComponent(new CompB());
});
var entity = new CES.Entity();
entity.addComponent(new CompA());
world.addEntity(entity);
result
a
Change entityAdded order.
CES = require('ces')
CompA = CES.Component.extend({name: 'a'})
CompB = CES.Component.extend({name: 'b'})
var world = new CES.World();
world.entityAdded('a').add(function (entity) {
console.log('a')
entity.addComponent(new CompB());
});
world.entityAdded('b').add(function (entity) {
console.log('b')
});
var entity = new CES.Entity();
entity.addComponent(new CompA());
world.addEntity(entity);
result
a
b
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.