GithubHelp home page GithubHelp logo

edge's People

Contributors

dwzzz avatar fponticelli avatar hamaluik avatar misiur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edge's Issues

Component doesn't exist through `entity.exists()`

Hi, I'm using Edge with HaxeFlixel. And I use FlxSprite as a IComponent.
This should reproduce the problem:

var sprite = new FlxSprite();
var entity = engine.create([sprite]);
trace(entity.exists(sprite)); // false

Why?
FlxSprite extends FlxObject and FlxObject extends FlxBasic, thus the key for FlxSprite is flixel.FlxBasic.
But exists() uses Type.getClass() on FlxSprite and it returns flixel.FlxSprite, of course. Hence false.
This is kinda a design problem, I guess.

In the mean time, I'll just replace this in the Entity class:

  function key(component : {}) {
    var t : Class<Dynamic> = Type.getClass(component),
        s = Type.getSuperClass(t);
    while(s != null && s != edge.IComponent) {
      t = s;
      s = Type.getSuperClass(t);
    }
    return Type.getClassName(t);
  }

with this:

  function key(component : {}) {
    return Type.getClassName(Type.getClass(component));
  }

Build Failure w/ Haxe 3.3.0-rc1 when implementing IComponent

With the release of Haxe 3.3.0-rc1, my game no longer seems to work.

I was able to "fix" the problem here in edge.core.macro.Macros by manually adding a "meta" property to the object with the value "null". At the moment, I'm not completely sure why this works. I'm looking at the listed breaking changes, but since I'm still new to haxe, nothing jumps out at me.

I'm thinking a native method either returns or accepts a differently shaped object in 3.3.0 vs 3.2.1.

I'll circle back to this and see if I can find the solution (or better understand the one mentioned).

Another note on this. It seems the tests still pass, but I don't see any classes implement IComponent.

Millions of allocations?

I tried to profile my project using hxscout, and I saw some worrying results. I reproduced it in small repo: https://github.com/Misiur/Alloc/blob/402a0344d8577113fad40df7fc0bc301b78006ee/Source/Main.hx

After just a few frames things get messy. For 1000 entities iterators generate 800000 allocations (last frame only has 550000)

I'm not even sure how to debug that. Should I be worried? Or is it normal?

I wanted more frames, but app stops responding after that frame.


(Self time on left, total on right)

(

// TODO optimize
๐Ÿ˜ƒ )

Macro Errors Under Haxe 3.3.0 (linux)

Trying to compile anything using edge (including the basic demo included in this repo), I get:

/home/kenton/.haxe/edge/0,7,0/src/edge/core/macro/Macros.hx:11: lines 11-18 : Array<Null<{ value : Null<Null<haxe.macro.Expr>>, type : Null<haxe.macro.ComplexType>, opt : Null<Bool>, name : String }>> should be Array<haxe.macro.FunctionArg>
/home/kenton/.haxe/edge/0,7,0/src/edge/core/macro/Macros.hx:11: lines 11-18 : Type parameters are invariant
/home/kenton/.haxe/edge/0,7,0/src/edge/core/macro/Macros.hx:11: lines 11-18 : { value : Null<Null<haxe.macro.Expr>>, type : Null<haxe.macro.ComplexType>, opt : Null<Bool>, name : String } should be haxe.macro.FunctionArg
/home/kenton/.haxe/edge/0,7,0/src/edge/core/macro/Macros.hx:11: lines 11-18 : { value : Null<Null<haxe.macro.Expr>>, type : Null<haxe.macro.ComplexType>, opt : Null<Bool>, name : String } should be { ?value : Null<Null<haxe.macro.Expr>>, type : Null<haxe.macro.ComplexType>, ?opt : Null<Bool>, name : String, ?meta : Null<haxe.macro.Metadata> }
/home/kenton/.haxe/edge/0,7,0/src/edge/core/macro/Macros.hx:11: lines 11-18 : { value : Null<Null<haxe.macro.Expr>>, type : Null<haxe.macro.ComplexType>, opt : Null<Bool>, name : String } has no field meta
/home/kenton/.haxe/edge/0,7,0/src/edge/ISystem.hx:5: characters 2-11 : Build failure

Any idea what's up?

Thanks!

add Macros to auto implements some methods

  • componentRequirements
  • entityRequirements
  • toString
  • constructor
  • also check that an update member:
    • is present
    • it is a function
    • it is public
    • that the arguments are custom class instances

"DocumentClass doesn't contain a method `update`" error using OpenFL

I tried to see if I can integrate this system into OpenFL, but all I get is the error above, with "Build failure".
lime [2.8.3]
openfl [3.5.3]
thx.core [0.39.0]
edge [0.7.0]

Code is here:

package;

import edge.ISystem;
import edge.World;
import openfl.display.Sprite;

class Main extends Sprite implements ISystem
{   
    public function new()
    {   
        super();

        var world = new World();

        world.render.add(this);
        world.start();
    }

    function update()
        trace("hello");
}

Sorry if I'm actually missing out an important detail here.

add World

World should contain a default schedule implementation and a few standard phases (frame, update, render)

move Cycle to Phase

where Phase is a class instance with a collection of Nodes (linked list) each containing a reference to a system to be able to prioritize the systems.

Register component as interface or specific base class identifier?

From the API, doesn't seem to support it. From the code, it appears as if it's always meant to using base class implementation as identifier for given component type?

Why does the macro consider s=superClass to have a possibility of being IComponent? This will never happen because IComponent is an interface, not a class, anyway (I think, from what i remembered with superClass).

Also, when I use reference-based typedef instead for View<T> (eg. typedef SomethingReusable = { } ) , it doesn't work properly when I wish the macro was also capable of determining the component fields from typedefs, class fields, etc. besides anonymous structure.

evaluate supporting multiple views/collections of entities in system

In implementations of ISystem, every field variable with the following format should be automatically populated:

var enemies : View<{ pos : Position, entity : Entity }>;

or if a View class is too much:

var enemies : Iterator<{ pos : Position, entity : Entity }>;

Implementing View might have the advantage of an easy way to count items and a faster iterator implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.