Search the Community
Showing results for tags 'emit'.
-
Hello, I'm trying to understand how some parts of Phaser work. But I'm confused by the emit functions. For example arcade/world.js script at https://github.com/photonstorm/phaser/blob/master/src/physics/arcade/World.js contains: ... this.emit('overlap', body1.gameObject, body2.gameObject, body1, body2); ... this.emit('collide', body1.gameObject, body2.gameObject, body1, body2); ... sprite.emit('overlap', body.gameObject, tile, body, null); ... sprite.emit('collide', body.gameObject, tile, body, null); ... the same in many other places in Phaser. Please explain how to find the exact JavaScript code that is executed by these emit(). Thanks!
-
Apologies for what is a very vague question. My game runs fine for quite awhile, but eventually starts to spend 90% of its time (checked via chrome's profiler) in the emit function from pixi. I can't really share the ~18k lines of code, but I only do a few things in pixi so maybe someone knows right away that one of these things is an issue. It is a bit difficult for me to find the issue as it does take quite awhile to appear. Are any of these things suspects for causing pixi to 'emit' more and more over time? animating by changing a sprite texture: this.body.texture = PIXI.Texture.fromFrame('someArt'+frameNumber+'.png') creating a mask by drawing some shapes to a regular old canvas, having a sprite made from PIXI.Texture.fromCanvas(canvas), and then updating this mask via this.visibilityMask.texture.update() *once every frame* using a few PIXI.Graphics objects, and redrawing the graphics object from scratch every frame (only a few objects though, less than 10) updating x, y, rotation, mask, tint of a few objects every frame -- I have a networking layer which is constantly updating the properties of many of the objects. Any ideas? Sorry for the abstract problem. The game runs at a solid 60 fps with most of its profiled time spent 'idle' for at least 30 minutes. Going forward I'm just going to comment out large sections of the game and leave it running when I'm done working for the day. Maybe one of these mornings I'll return to find the program without a leak, and then I'll have narrowed down the search. The problem does appear to be in the game client and not the game server, as opening up fresh clients without restarting the server yields 60 fps again. Thanks!
- 6 replies
-
- memory leak
- emit
-
(and 1 more)
Tagged with:
-
Hi, I try to search everywhere and I only found one example which is in ReactPIXI. My question is how I can make React communicate/emit data to PixiJs ? For example, React emit data and it listened by Pixi. Is there any good example out there? Thank you.