jay3sh

Members
  • Content count

    11
  • Joined

  • Last visited

1 Follower

About jay3sh

  • Rank
    Member

Contact Methods

  • Twitter
    jyro

Profile Information

  • Gender
    Male
  1. Z-order examples outdated?

    Thanks @ivan.popelyshev. I wasn't aware of pixi.js plugin mechanism. It seems to work now. Which of the two examples are the right way to use pixi-display? Layers or DisplayList? Is there a plan that this functionality will get included in pixi.js core?
  2. Z-order examples outdated?

    Hi, I'm trying to get Layers/Z-order functionality working and following examples on it. There are two different examples on pixijs site http://pixijs.io/examples/#/layers/zorder.js http://pixijs.io/examples/#/display/zorder.js Both have different approaches. But I could not find the functions described there in my pixijs installation. There's no PIXI.display object, nor is there PIXI.DisplayGroup. Strange thing is the version I'm running is 4.6.0 (from npm) and the examples above also reportedly running 4.6.0. I also do not find the classes like DisplayGroup in API docs, they are only there in the examples. What am I missing?
  3. In my game I've a tower sprite (it's a top-down 2D RTS game). I rotate it with my animation mechanism (i.e. I update the sprite.rotation in steps). While rotating I also want to run the firing animation of this tower sprite. To synchronize these two animations I want to know how long (in msec) it will take for one run of the sprite animation. The only way to specify how fast the AnimatedSprite should run is to set the `speed` property. However this value is an arbitrary scaling factor for internal time. Is there a way to estimate how long a single run of the animation takes for a given `speed` value?
  4. Same game, same computer, poor performance on 4k monitor

    Does the problem remain same when you change from split display to mirroring OR it at least gets slightly better? There are three modes - 1) Split/extend display 2) Mirror display (i.e. same content on both screen) 3) Only show content on one of the two screens. In my case the option 3 was faster than option 1. But it was still laggy, for reasons I don't know.
  5. Same game, same computer, poor performance on 4k monitor

    I've observed the same behavior while running a game on my laptop vs on my TV over HDMI. The resolution is the same and I'm only choosing one display at the time (no split display). Are you splitting your screen across your laptop and external monitor?
  6. AnimatedSprite single pass

    Hi, I was trying to make my AnimatedSprite run only once. Initially I thought it could be achieved by setting `loop` to `false` and manually calling `play()`. However that worked only first time. For instance, I wrote code to run the animation once when mouseover. Later on when the animation is over I would take my mouse elsewhere and then bring it back over the sprite to trigger animation again, but this time it wouldn't play. After lot of experimentation I figured out that I have to call `gotoAndStop(0)` in the `onComplete` callback to achieve what I wanted. let animSprite; // Load animSprite animSprite.loop = false; animSprite.gotoStop(0); animSprite.onComplete = function () { animSprite.gotoAndStop(0); }; animSprite.play(); Is this the right way to achieve single-pass animation?
  7. loading textures > sprites in a loop

    As the others have pointed out, there's no way of listing files in a directory from a webapp running in a browser. If you have files organized on your server inside a folder and have named them in a known sequence, then you can load each of the files using `fromImage` in an async loop as described by @xerver above. You will have to know their filesname or the pattern of filenames at least. If you however run your webapp in a desktop framework like electron, then you can use their APIs to list files in the directory and then write code to load each of those files. You won't have to hardcode how many files there are or even have them in sequence. In electron you can use standard node.js filesystem APIs like readdir and readdirSync. HTH
  8. I did some CPU profiling, couldn't get much out of it at this time. But I'm not complaining about the ticker consuming the CPU when active. In fact I'm getting near 60fps result, so there's nothing wrong with performance. I just found it odd that when the app goes in background the app still keeps consuming CPU and I've to explicitly stop() the ticker. Thought others will find this detail useful, because such app running in background could drain the laptop battery real fast.
  9. I'm sure it's not due to any extensions. I can even narrow it down to pixi's event loop, because when I call stop() on the ticker, the CPU usage clearly drops.
  10. I agree. Chrome shows 200% cpu usage for the tab running pixi app. I think that's combined usage of gpu process and main tab. So the code snippet above is just a little workaround to quite the CPU down when app is in background.
  11. I noticed that in my game the Pixi Application takes lot of CPU resources when it's running. Even when it's in background or is not visible, it consumes the CPU. Two Chrome processes are constantly using 25-30% CPU on my linux box (more on my macOS). It became very troublesome while working from a cafe on my macbook pro without charger. The app drained by battery in no time. Only way to avoid this is to stop the pixi application ticker when you don't want it to consume resources. For a typical Pixi.js application, i.e. a game, it does make sense for the game to pause when it goes in background. Therefore I wrote this small routine using the `blur` event handler, to pause the Pixi app, whenever the window looses focus. This drops the CPU usage to 6-7% by Chrome processes. In a browser or electron app, the window.onblur callback will get called whenever the focus switches from the app window to some other application (or even dev console). However in jsfiddle environment, you need to click on the application first and then click somewhere else for testing this functionality. That's because the code runs inside an iframe on jsfiddle page. The simple resume dialog lets you resume the app when you want. You can try it here: https://jsfiddle.net/jay3sh/ft8am5fr/13/ If you have any other tips, or suggestions to reduce CPU usage, I would love to know.