pdeveloper / eskimo Goto Github PK
View Code? Open in Web Editor NEWeskimo is an entity-component system written in Haxe, focused on having a small codebase, simple API, and performance.
License: MIT License
eskimo is an entity-component system written in Haxe, focused on having a small codebase, simple API, and performance.
License: MIT License
Currently EventView and BufferView extend the basic View. This doesn't allow features to be stacked (What if you need event queues as well as buffers?)
Writing this down to remind myself.
private class Something {
public var xxx: Int;
}
class SomeSystem extends System {
var someView = new View<Something>();
...
}
Results in Type not found : Something
in the someView = new View<>
line.
Hi,
Your repository is seriously lacking in unit tests. Please add some.
munit is a good choice, because it's cross-platform (builds and runs on multiple platforms, if you so choose).
What's the intended way of doing that?
var objs = new View<A, B>();
... initialize objs with something...
for (e in objs.entities) {
objs.manager.components.remove(e, A);
}
This won't work for all entities, as entities without A will be overwritten immediately.
A workaround i found is using View.entities.entities
This will properly remove A from every entity, but it seems hard to remember.
for (e in objs.entities.entities) {
objs.manager.components.remove(e, A);
}
https://github.com/sh-dave/eskimo-issues/tree/master/view-arguments-instantiation
With haxe's maps i can do:
class S1 extends System {
var v : View<C>;
var m : Map<Int, C>;
override public function onStart( sm : SystemManager ) {
m = new Map(); // no <Int, C> neccessary
}
}
This doesn't work for views. I have to type the type arguments again
override public function onStart( sm : SystemManager ) {
v = new View<C>(sm.entities); // <C> neccessary
}
If I have a interface represent the graphics of an entity.
interface RenderComponent {
function getDrawable():IBitmapDrawable;
}
and this implement:
class SpriteRenderComponent implements RenderComponent
{
public var target:Sprite;
public function new() {
target = new Sprite();
}
public function getDrawable():IBitmapDrawable {
return target;
}
}
and I create a view:
var v:View = new View([RenderComponent],null,context);
add an entity:
var e:Entity = context.entities.create();
e.set(new SpriteRenderComponent ());
But I can't get the SpriteRenderComponent
using context.entities
.
Also, this doesn't work either:
var e:Entity = context.entities.create();
e.set(cast (a,RenderComponent));
I found that it is related to some methods in ComponentManager.hx
.
Anyway, am I supposed to do this, does it volatile the concept of ECS?
I forget to add a system other systems depend on. This results in an endless loop in SystemManager.evaluateSystems(). Would be nice to somehow be notified about it.
An easy solution would maybe to add a loop counter and printing unresolved systems when that counter hit some threshold in debug builds.
So the topic of this issue is really more of just a potential solution to the problem I'm having. Basically, my systems have both a render method and an update method. This render method in each system needs to have access to Kha's graphics API. Obviously, baking this into a generic library like eskimo would be a bad idea.
SystemManager.update is not a complex function, and a rendering equivalent could be just as light. However, it of course needs to loop through the systems variable, which is private.
A simple solution might be just overriding SystemManager. This brings me to my second point, that the System class of course doesn't have a render method. How would you go about this?
https://github.com/sh-dave/eskimo-issues/tree/master/system-multiple-onStart
Using systems with other-system-dependencies, depending on the order systems are added to the SystemManager, System.onStart() is called multiple times.
In this case, S2 depends on S1 and does a get in onStart();
class S2 extends System {
var s1 : S1;
public function new() super([S1]);
override public function onStart( sm : SystemManager ) s1 = sm.get(S1);
}
sm.add(new S1());
sm.add(new S2());
will result in:
trace S1.onStart
trace S2.onStart
sm.add(new S2());
sm.add(new S1());
will result in:
trace S2.onStart
trace S1.onStart
trace S2.onStart
IFilters are now implemented and used in the SystemCreator. Need to transfer this functionality to Views.
Hi,
The example in README.md
is a bit contrived (string/int components -- useful for testing though). In particular, it doesn't explain how to use systems.
ECS libraries can do things different ways, and I think Eskimo is missing a sort of "philosophical design" part that states things like (if I got this right):
In particular, I thought systems are supposed to be a "super-set" of views: they filter and select entities with the right set of components, and they have some "update" method or something that they operate across all components (eg. find all entities with position and velocity components, and move the position according to the velocity).
How is Eskimo supposed to work with regards to systems?
https://github.com/sh-dave/eskimo-issues
I put up a small repo in case there are more issues, so you can easily reproduce. ๐
Just recursive clone and drop the issue folder into KS.
https://github.com/sh-dave/eskimo-issues/tree/master/view-arguments
../s/S.hx:6: characters 18-26 : Type not found : c.C1
.
If you comment out the line, you see that this works for haxe's Map class.
It does also work when i put each component into it's own file and import them.
Edit: Also doesn't work when i try to import the actual class(es) by name:
import c.C.C1;
Can't build for java
haxelib run hxjava hxjava_build.txt --haxe-version 3300 --feature-level 1
javac "-sourcepath" "src" "-d" "obj" "-g:none" "@cmd"
src/eskimo/IComponentType.java:9: error: getClass() in IComponentType cannot override getClass() in Object
java.lang.Class getClass();
^
overridden method is final
src/eskimo/ComponentType.java:96: error: getClass() in ComponentType cannot override getClass() in Object
public java.lang.Class getClass()
^
overridden method is final
Note: src/haxe/root/Date.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
Compilation error
Native compilation failed
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.