• Content count

  • Joined

  • Last visited

1 Follower

About jay3sh

  • Rank

Contact Methods

  • Twitter

Profile Information

  • Gender
  • Interests
    Game Development

Recent Profile Visitors

150 profile views
  1. Where are the Layers?

    Out of curiosity, how's the new Containers system different from what already pixi.js provides? Sorry if I missed something obvious, I don't use Phaser, but AFAIK it uses pixijs and I use pixijs containers as Layers. So I'm curious about the problems you are facing. Thanks.
  2. [Complete] [phaser] Cyber Tank

    Nice game. Are all enemy turrets necessary though? I mean one could reach the exit or gather all the cubes, without having to deal with some of the enemy turrets. Is that intentional?
  3. [PixiJS] 2D Tower defense game

    Not implemented (yet). This is basic prototype. Maybe in future. Thanks for trying it out.
  4. Hi all, I made this short 2D Tower Defense game using Pixi.js. I would love to know what do you think. http://jayesh.me/pixicraft/demo1.html Libraries/Tools used: pixi.js, howler.js for audio, Inkscape for artwork, coding in Typescript
  5. 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?
  6. 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?
  7. 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?
  8. 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.
  9. 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?
  10. 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?
  11. 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
  12. 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.
  13. 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.
  14. 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.
  15. 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.