Closed scriptorum closed 11 years ago
Thanks, right now neko is not supported (mainly because i was too lazy), but I'm gonna look into this. Looks like one can't just compare functions using == and must use Reflect.compareMethods. Gotta research on this thing some more.
BTW, why (and how) do you use neko? I thought it's not very popular for games, and only used for scripts and server-side web.
Yeah, I was surprised that function reference comparison is so fickle on Neko. I really love Haxe, but there's still a lot of cross-target gotchas like this.
I use Neko as a target for development testing only because it compiles so quickly. Flash also compiles quickly, but Neko dumps console output to stdout, which makes me a happier logger. Flash just dumps traces straight to the screen, which drives me nutso. HaxePunk has a debug console that improves that situation, but it's not nearly as useful as stdout console output. If I could figure out a clever way to write Flash traces to a file and tail -f that file, I'd switch to Flash, which is often the final target anyhow.
I kinda fixed it the same way but with more testing, so I'm closing this issue.
Thanks Dan!
My game which has a significant number of entities slows to a crawl on Neko. It happens whenever an entity is removed from a node list while the Ash engine is mid-update. ComponentMatchingFamily removes the entity and node, puts the node on-deck for the node pool, then hooks into Engine.updateComplete. When the engine finishes updating, the callback releases the on-deck node into the pool. It does this part fine, but then the callback tries to remove itself from the updateComplete signal. This fails. The signal remains, and over a time the signals accumulate, dragging the app to a standstill.
The failure appears to be in SignalBase.remove. In two locations, nodes in the linked list are compared to the listener, but the comparison returns false on Neko.
CPP makes the compare successfully. I changed the comparison to this:
And that seems to fix the problem. There are other comparisons in that method which may suffer from the same comparison problem, I don't know, but changing these two fixed an egregious problem for me.
I'm on Neko 1.x and Haxe 2.1, but I've had this problem for a while and I'm pretty sure it was present when I was messing around with Neko 2.