• Content Count

  • Joined

  • Last visited

Everything posted by ooflorent

  1. I have released 2.1.0 on NPM. Still to be done: ExamplesBenchmarks against other ECSFull documentation (code, API, site)
  2. Such a nice comment! I was quite busy the last few weeks so the release is not ready (what a shame!). I can't wait to hear your feedback. Feel free to PM me if you have any questions or encountered issues.
  3. First of all: ImpactJS is not free.PandaJS was created after makr.jsMoreover, both are "complete" game engines which makr.js is not.
  4. I don't think I would add a way to identify components using strings. Is there any reason to use them? There a so many drawbacks... Poor minificationNo existence check if mistypedNot coupled with the component type
  5. V2 does not identify components using strings but using their constructor, resulting in a huge speedup. There are two ways of checking if a component exists: function Position(x, y) { this.x = x this.y = y}// Using Entity#hasif (entity.has(Position)) { // ...}// Using Entity#getvar pos = entity.get(Position) // `null` if not assignedif (pos) { // ...}
  6. Hi, I have some news! I have open-sourced v2 development branch. You can find it on GitHub (experimental/v2). Warning: There are still a lot to do (tests, documentation, benchmarks, examples). Why is there a v2? Wasn't v1 good enough? While v1 was fast it was not so pleasant to use it. I have seen several games hacking makr to simplify the API but hitting really hard the perfs. v2 was done to prevent "wild" extensions of makr by providing a better API. Moreover it is faster than it was before! What is different in v2? Well, almost everything! Component types are now automatically detected (no more ComponentRegistry)Systems are gone (the developer can use whatever implementation he wants)All internalsWhat are v2 limitations? It cannot handle more than 32 components. Current implementation relies on a 32-bits integer to store component masks while v1 uses bit sets. This limitation may be removed in the future if it does not impact perfs to much. I tried v2 but it seems broken... The library is under active development and some features may be bloated. If you encounter an error or something, just drop an issue on GitHub and I'll fix that! What will be v2 API? EntityManager(...ComponentType: Function) #create(): Entity #get(id): Entity #query(...ComponentTypes): Entity[] #valid(id): BooleanEntity #id: uint32 #mask: uint32 #valid: Boolean #<T>add(component: T): T #<T>remove(ComponentType: Function<T>): void #<T>get(ComponentType: Function<T>): T #<T>has(ComponentType: Function<T>): Boolean #destroy(): void
  7. v2 is almost done. The API is finalized but I have to write the documentation, examples and some benchmarks. If you are interested I could send to you an alpha preview. Performance are good but need a few more tweaks. Your makrjs overlay is simple and not intrusive, this a good point! Be sure to update to makr v2 when it will be available.
  8. The development is done on a private repository until I am satisfied with the API. I'm using 6to5 to transpile ES6.
  9. Hello everyone, I'm currently working makr v2. It is an entire rewrite of the library and still focus on blazing fast execution. It heavily relies on ES6 features. Here is a comparison between system declaration in v1 and v2: // Beforefunction MovementSystem() { makr.IteratingSystem.call(this) this.registerComponent(ComponentRegistry.get(Position)) this.registerComponent(ComponentRegistry.get(Motion))}util.inherits(MovementSystem, makr.IteratingSystem)MovementSystem.prototype.process = function(entity, dt) { var position = entity.get(ComponentRegistry.get(Position)) var motion = entity.get(ComponentRegistry.get(Motion)) position.x += motion.dx * dt position.y += motion.dy * dt}// Afterclass MovementSystem extends IteratingSystem.use(Position, Motion) { updateEntity(entity, dt) { let [position, motion] = entity.get(Position, Motion) position.x += motion.dx * dt position.y += motion.dy * dt }}World creation: // Beforevar world = new makr.World()world.registerSystem(new MovementSystem())world.registerSystem(new CollisionSystem())world.registerSystem(new RenderingSystem())// Afterlet world = new Makr({ types: [Position, Motion, Body, Display], systems: [ new MovementSystem(), new CollisionSystem(), new RenderingSystem() ]})Major changes: Uses ES6Cleaner APITestsBrowserify supportNo more singletonsComponentRegistry is now automatically calledand more!It would be great to hear some feedback from you guys! Cheers!
  10. I see one problem with the sandbox: we are exposing too much but we can't do it differently. User scripts may bind ports through a Server instance or a socket.io one. // Outside the sandboxvar Server = require('http').Server;var server = new Server();server.listen(3000 + userID);// Inside the sandbox (if we expose the server)server.listen(3000 + otherUserID); // Bind another portserver = new (server['constructor']); // Create a new server// Inside the sandbox (through socket.io)socket.server.listen(3000 + otherUserID);Conclusion: we have to proxify everything...
  11. I'm not sure about sandbox mode. Is there any valid reason about it? Abstracted JSON store is great. FS access is not mandatory if there is a way to store JSON payloads. What would be the node version? Please, use 0.11 with harmony flag! What about development scripts? I don't want to commit generated / minified code! Moreover, we can submit a 13kb zip. How do you evaluate the zipped code size of the repository? I like this. What about sanctioned libraries?
  12. Are there any updates about the server rules? I would be glad to help! Feel free to send me a PM if you want my contact informations.
  13. This year I wanted to submit an MMOG to the competition. I have experience developing node.js games using (or not) socket.io. I could help or assist during the JS13KGame unless it is incompatible with the contestant status. Regarding your gist, several things are missing: You should expose the Server or a wrapper otherwise contestants will not be able to implement web services or fetch server dataThe new require function is way too restrictivewhat about file system access? Contestants may need to store data on disk
  14. Hi, I really appreciate your feedback ! Your systems should not rely on the entity order but should manage itself the depth sorting. Sorry for giving such a short answer but I am not able to dig more into a solution until Monday... If you have others questions, feel free to leave me a private message !
  15. And a game with great visuals at 60fps is easy to achieve (on desktop) if your rendering engine is awesomely powerful (who said Pixi?). Movies are smooth at 24fps because of motion blur! I can't agree more on this! As Gio said, it depends on the type of game! What really matters is the user experience.
  16. You're not supposed to fork Phaser to use it in your games. You only have to copy phaser.js to your project (like you usually do with jQuery).
  17. If you want your animations to be smooth, your game should render at the same frequency (or a multiple of it) than the device screen's refresh rate. Since most of LCDs render at 60Hz (so 60 FPS), it's a good thing to target 60 FPS! If you want to easily achieve this, you could run your game logic at 30Hz and render at 60Hz. The "rendering-only" frame processes little calculations to interpolate animations.
  18. I target 60 FPS for browser / desktop games. And 40 FPS for mobile games. It's not that hard to achieve it.
  19. Disclaimer: The implementation provided in my example is really bad! You engine is not that bad but it will consume a lot of memory. If you are looking to a strong JS ECS engine, then you definitely need to check out makr.js (compiled version here).
  20. I have created a really simple ECS engine and a demo demonstrating how to architecture a game that can fit with Phaser. This demo does not integrate Phaser but follows its game initialization process. https://gist.github.com/ooflorent/8314853
  21. This post describes a similar case: Phaser/Pixi + Ash.JS. The main issue while integrating Phaser with an ECS engine is how deep you want to use ECS components. In my opinion, the best approach is to decouple the update loop into systems and match game objects using groups. Phaser has a lot of features such as rendering, physics or audio management. Delegating these to systems seems pointless to me. As I said before, business centered systems are a better options. So, how to implement them? I would create a custom Phaser.Sprite class with a flags property to apply component masks on my game objects and then the game systems are iterating over all game objects (using optimized data structures). In this implementation there are no components, only entities (which are game objects) and systems. The flags property emulates components since the Sprite contains everything it need. If you want a complete ECS implementation, then you may have to drop Phaser or use only low level APIs.
  22. I'm creating a new ECS-based Phaser's example demonstrating how to architecture a game. I will release it in a couple of days. Maybe less.
  23. Maybe you should have a look at this: http://www.html5gamedevs.com/topic/1417-makrjs-%E2%80%94-an-entity-component-system-engine/
  24. // Game structures// ---------------var Bullet = { damage: 1, speed: 10 pos: { x, y }, velocity: { x: 0, y: 0 }, setAngularSpeed: function(angle) { // Compute velocity // ... }};var Player = { pos: { x: 0, y: 0 }, velocity: { x: 0, y: 0 }, shoot: function(pos) { var bullet = Object.create(Bullet); bullet.setAngularSpeed(getAngle(this.pos, pos)); return bullet; }};// Main// ----var player = Object.create(Player);var bullets = [];// Spawn a bulletbullets.push(player.shoot({x: 50, y: 20}));// Update all bulletsbullets.forEach(function(bullet) { bullet.pos.x += bullet.velocity.x; bullet.pos.y += bullet.velocity.y; // Handle collisions // ...});You can try something like this.
  25. It is not really accurate but you can rely on the Accept-Language browser header. Maybe you should read documentation about content negociation. There is a good JS library for that: https://github.com/garycourt/negotiate-js