Hadik

Members
  • Content Count

    36
  • Joined

  • Last visited

About Hadik

  • Rank
    Advanced Member

Recent Profile Visitors

913 profile views
  1. Thank you for your reply, this should be very helpfull I appreciate it
  2. With both method I got almost same FPS. Can arcade hold physics like this (video bellow), I need simple physics, when I will simulate "blocks" in zero gravity space, unfortunetly I will also need joints for connect these blocks together, and make complex strucutres. On the other hand, in game will be around 50 000 blocks, but on the view, will be only about 500 maybe less, but I trying in P2JS disable physics out of camere view but withou success. Also only few block require full P2JS, rest of block will be out of screen, I want make complex strucutres from these blocks, but on the other hand every block should be object, because I need detect collision (hit), on block level, not full strucuter, because every block will be destroyable. So only few count of blocks requre complex physics, other will be only dummy for other network players. (test with 100 blocks... with 3000 I got 16 FPS) )
  3. I create a lot of game in Phaser.IO (for example very popular IO game mudwars.io - about 20k visitors per day) and I am now prepareing for next project, when I need some kind of P2JS system, where I can simulate huge number of blocks. But when I place about 3000 blocks, game performace is poor, on my (i5-4460 and AMD R9 270X) I got only 16 FPS.. So phaser is unusable, and I planning use much more counts, like 50 000 blocks. Then I try same thing in the Unity engine (2D), and with same numbers of blocks, I got full FPS(without vsync around 120 FPS). So is there any option how I can optimalizte phaser, or is unusable for this kind of project ? Thank you for reply
  4. Hadik

    Memory leak in extended sprite

    Unfortunately no, it's weird. I have only one solution recyclate this objects, kill and revieve in next time is require. I read lot of articles about this problem on stackoverflow. Developers which make games in the JS, have same problesm, where create and destroy instance over again (60 times every second), and after few minutes game crash. Most recommend use recyclating of this intances. Also this solution use Rich in his examples, for example /Games/Tank use this method.
  5. Hadik

    Memory leak in extended sprite

    Thank you, but We are looking in dev tools a lot of hours, but we see only this. http://prntscr.com/cg5u02 (comparsion between two snapshost 30 seconds) Emitter not solve this problem, For example we have a bullet object, which is created when player press key, and destroy also with timer, same problem, if player will shoot for 30 minutes, memory will be filled and game crashed.
  6. Hadik

    Memory leak in extended sprite

    In another object extends from sprite, call in update new SmokeEffect(this.game, exhaustPosition.x, exhaustPosition.y, this._onDirt, isMoving); and object player is global variable, I create instance of object Player (object extends sprite) We are desperate with this problem, it ruined are release plans
  7. Hadik

    Memory leak in extended sprite

    Hello, I have simple exteneded object from sprite. Its simple smoke effect with tween alpha for some effects, after tween ends, call this.destroy(), for destroy and remove this sprite from game. But somethink vierd happends. I call this every tick, but memory increase more and more, and after few minutes browser crash. When I dont use this object, game run OK and memory not increase. I think there must be somethink, and this think not allow GC clear this instance. But I try clear object as example, only create sprite nothink else, and on the end put this.destroy(), same memory leak. But when I create only sprite (without extending and creating instance), and call destory() on this sprite, memory leaks gone.. Everythink OK. So where is problem ? I also try after destroy set to all properties in this instance to null, same situation, GC not clear memory. Problematic code here: /* global Phaser, Utils, config */ /** * XP point body * * @class XpPoint * @extends Phaser.Sprite * @constructor */ SmokeEffect = function (game, x, y, black, lessTransparent, settings) { /** * @property {Phaser} game - Main game context * @private */ Phaser.Sprite.call(this, game, x, y, 'smoke'); game.add.existing(this); game.physics.enable(this, Phaser.Physics.ARCADE); //2500 game.time.events.add(100, function () { this.destroy(); }, this); }; SmokeEffect.prototype = Object.create(Phaser.Sprite.prototype); SmokeEffect.prototype.constructor = SmokeEffect; I try clear all properties in instance, but not help: for(var property in this){ this[property] = null; delete this[property]; } When I do this everythink is OK: var effect = this.game.add.sprite(exhaustPosition.x, exhaustPosition.y, 'smoke'); this.game.time.events.add(2500, function () { this.destroy(); }, effect); This anoying memory leak blocking release our game, almost one year of development stop on this memory leak, anybody know how solve it ?
  8. Hadik

    Sprite disoration, fake 3d

    Thanks both for post lewster32: Very interesting information, Where you find it ? I trust you, but I want more information, if is possible So, I will use three.js or try hack pixi to make what I want, but I could be very hard to solve it.
  9. Hadik

    Sprite disoration, fake 3d

    Hello is there any option how sprite or bitmapdata disorate like this ? http://prnt.sc/cbta2h (Original image: http://prntscr.com/cbtabn) I know how to make skew, with few hours hacking pixi http://prntscr.com/cbtahj But its not still what I want I want to create fake 3D like in the GTA1/2 Move this sprite I cane done with paralax, but I still need some method how transform sprite to first image I know that there is some options
  10. Hadik

    Get coords based on rotated sprite

    OK I found best solution var length = 150; var realAngle = this.angle + 180; var radians = realAngle * Math.PI / 180; var x = this.x + Math.cos(radians) * length; var y = this.y + Math.sin(radians) * length; Works perfectly
  11. Hadik

    Get coords based on rotated sprite

    feudalwars: Thank you, good solution It's not fully clear solution, but better than nothink or complex math
  12. How I can get X and Y in the game like on this screen: http://prntscr.com/ay1k10 I will have rotated sprite which can be rotated and move by this.body.velocity.copyFrom(game.physics.arcade.velocityFromAngle(this.angle, 300)); and rotated by this.body.angularVelocity = -300; How Can I get coords forward this object forwared at axis X + 20 px, depends on rotation ? I try pivot and anchor to 2nd help sprite, but coords of this sprite is on center, not where is realy lays. Like this: http://prntscr.com/ay1jbw
  13. Hadik

    Keep runing after change tab

    I use that (Read full topic ) But I found solution, not solve everythink, but it enough.
  14. Hadik

    Keep runing after change tab

    Is there any option how to keep runing game (update function) when will game lost blur, switch tab. Yes I use game.stage.disableVisibilityChange = true; (in create, preload and also update) nothink change. I try avoid pausing in source code in the Phaser, but nothink change. Any solution which I found is: start own loop outside Phaser funtions, and when will lose focus (copied from Phaser source code) call update function. It works but its not clear solution. setInterval(function () { if (document.hidden || document.mozHidden || document.msHidden || document.webkitHidden /*|| event.type === "pause"*/){ update(); } }, 1);