-
Notifications
You must be signed in to change notification settings - Fork 0
An entity component system written for dart.
License
boustrophedon/entity-component-dart
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is an entity component system framework for writing games. It is written in dart because it is for writing stuff in the browser. I recently did some rewriting and now it uses component mappers and stuff like Artemis, and the entities themselves are now simply ints, so they can be easily transmitted across a websocket. There's now a ClientWorld and a ServerWorld class that I may end up merging again. todo: I think I want to change the messaging system to subclass an Event class rather than using generic Maps, and have components require a toJson() method. They should also have id numbers so that I can do something like update arbitrary components of entities via a message over the network, rather than doing it ad hoc. Genenerally you use it like this: Create a subclass of ServerWorld or ClientWorld depending on whether it will run on the server or client side, and add fields for your global data pieces. ClientWorld w = new MyClientWorld(); //or whatever world.register_system(new WhateverSystem(world)); // ... more register_system calls world.canvas = queryElement("#canvas-area") // or whatever and then you do world.run() the systems run in the order they are registered. in your WhateverSystems that you've implemented and imported, you subscribe for events and stuff inside System.initialize() rather than the constructor because the world object might not be set up, or you might need to use some global data that's not available until after other systems have initialized. entities are then created by the systems, and they get passed to the systems based on which components they want to look at.
About
An entity component system written for dart.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published