Ahmed Khalifa

Members
  • Content Count

    41
  • Joined

  • Last visited

Everything posted by Ahmed Khalifa

  1. @Tom Atom Thanks so much, that is really great
  2. Thanks a lot, I didn't know about that stack part
  3. That's weird because nothing different since the beginning. So I start to try to corner the problem and I think I found it. So the background is 1x1 pixel that is scaled to cover the whole screen. Every frame, I redraw it using the correct color (green or red) without calling clear based on the current status in the map. When I commented this part, everything become very fast. So I added the clear in and everything is still fast. Is the graphics object keep track with all the previous drawings and recall all the drawing calls for every render? If that is the case, it make sense that it slows down near the end as it accumulated a lot of fillRect calls since the beginning of the game. I thought without calling clear, it just redraw the object on a texture on the previous drawings and use it.
  4. Thanks, It is scaling a graphics object (not a bitmap) down. Is there a problem with that? I don't redraw the object at all (I draw it one time at create only)
  5. Also I don't think, it is problem of driver as I tested it on multiple different devices and they all have the same behavior. Also will Canvas at some point support Tint?
  6. I just did profiling I don't know if these values are normal or not. 4430.4 ms Scripting 346.1 ms Rendering 658.5 ms Painting 3473.6 ms Other 64904.0 ms Idle The average frame rate is 15 frames Getting the tree call, I can see the rendering consume most of the time. Attached a picture of the call tree.
  7. I just tried using Bitmap fonts and no difference same weird problem. And I found out that tint is not working in canvas (all bitmap text are white). Just play the game for a minute in webgl and you will see the slow down (remove letters from the sequence to get a correct english word), tried different computers and same problem happens at all of them. I even restarted the computer.
  8. Thanks Rich, I will definitely try using bitmap fonts but shouldn't it slow down that much even if I am using around 30 normal font objects? It is weird that it didn't slow with time with you. Did you start profiling after the game started (after loading)? As the loading take long time and the game start to slow down after it start by a minute or something. May be it slows down when u play in it, try to remove letters to have a correct English word. I will test the bitmap font and see although I just wanted to use normal font. Also is updating Phaser.GameObject.Text text is it intensive from GPU point of view (as I change two text objects every frame)?
  9. I am working on a project that uses exactly 1 group, couple of containers (around 30) containing a picture from a tiny texture and a text, and 2 graphics object. When I select Phaser.WEBGL (Phaser.AUTO also selects WebGL), the game slows down after one minute or something. The game frame rate drop to almost 5 fps. I though there is something wrong with my code at the beginning and tried to optimize calling functions and other parts but with no affect on the final result. When I changed to Phaser.CANVAS, the game is very fast and maintaining 60 fps. I don't know if that is a bug in the framework or misuse in my code. I am testing on chrome browser on a Mac Book from 2015. here is a link of the game using canvas: http://akhalifa.com/testing/reduce/canvas/ here is a link of the game using webgl: http://akhalifa.com/testing/reduce/webgl/
  10. Hello everyone, I am trying to make the screen scale automatically based on the browser window. So I used the scale variable in world to scale it. I was trying to center it so I used the following code: this.world.x = Math.floor((this.game.width - Global.SCALE * Global.WIDTH) / 2); this.world.y = Math.floor((this.game.height - Global.SCALE * Global.HEIGHT) / 2); which didn't work nothing on the screen moved, I tried world.position.x/world.position.y and world.left/world.top and still nothing changed. Any help?
  11. I updated C-Square and released a totally free game on iOS and Android. It's better than the original version Looking forward for feedback Website: http://www.amidos-games.com/csquare/ iOS: https://itunes.apple.com/us/app/c-square/id1191030278?ls=1&mt=8 Android: https://play.google.com/store/apps/details?id=com.Amidos.CSquare Screenshots:
  12. What I found out is I need to use the beta version of crosswalk to make it work <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library_beta:23+" />
  13. I am doing the same and its not working
  14. I tried ogg and mp3. mp3 is the most used extension
  15. No I mean when you load ur sound files. For example that what I am using now which is relative path to the index.html this.game.load.audio("Music1", ["assets/CSquare - Track 1.mp3"]); In this case the path is "assets/CSquare - Track 1.mp3" or should I use something else?
  16. Since iOS doesn't use the crosswalk so it works fine, android without crosswalk works on some devices fine but I need crosswalk to make sure all devices are running smoothly and as soon as I use crosswalk, the game start and sounds is never played. Does I need the full path instead of relative path for crosswalk?
  17. I tried it and it taking forever, here is the apk www.amidos-games.com/testing/csquare-forever.apk
  18. That's the problem, it never finish if you are using crosswalk
  19. what is the difference between using the above with callback function vs checking this function? this.cache.isSoundDecoded("SfxName") Shouldn't both be the same?
  20. What does that mean? I tried to disable decoding and launch the game and just do the decoding with playing and sound doesn't come out.
  21. Hello everyone, I read lots of articles about android being terrible in decoding audio. But I don't understand. I run my phaser game on android in browser it work perfect with sound and music and it work perfect when its wrapped with Cordova only. The problem is when I integrate crosswalk in it, no sounds are playing at all and when I order the loading screen to wait till decode just a 1 second long sound file (mp3, 44100) it doesn't continue, just stuck there. I tried cordova-media-plugin and still nothing is working. I am using the latest crosswalk and latest cordova. Any help plz,
  22. I found out after some experiments that, Chrome installed on my tablet runs WebGL and phonegap doesn't want to do that on Android Lollipop on Nexus 10 or iOS 9 on iPad mini 1. I asked over PhoneGap forums and they say I should ask here instead I tried to force Phaser render to be WEBGL and Phonegap doesn't work on these devices but on my new devices it work fine with WebGL as usual (even using AUTO). I tried to use crosswalk to unify the webview used and Its the same. here is the link to my Phonegap forums: https://forums.adobe.com/message/9191763#9191763 Any help?
  23. Hello Everyone, I am working on porting my game C-Square (https://amidos2006.itch.io/c-square) to mobile phone so the game use Phaser.Graphics to draw everything. I know using Phaser.Graphics is not efficient so I decided to generate the texture at the beginning of the game to get the correct resolution based on the device and save it. So I designed the following class: class GameTextures{ static overlayer:PIXI.Texture[]; static logo:PIXI.Texture; static startButton:PIXI.Texture; static arrows:PIXI.Texture[]; static generateLogo(g:Phaser.Graphics):void{ g.beginFill(Global.COLORS[0], 1); g.drawRoundedRect(-Global.TILE_SIZE + Global.GAP_SIZE, -Global.TILE_SIZE + Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, 2 * Global.GAP_SIZE); g.drawRoundedRect(Global.GAP_SIZE, Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, 2 * Global.GAP_SIZE); g.endFill(); g.beginFill(Global.COLORS[1], 1); g.drawRoundedRect(Global.GAP_SIZE, -Global.TILE_SIZE + Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, 2 * Global.GAP_SIZE); g.drawRoundedRect(-Global.TILE_SIZE + Global.GAP_SIZE, Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, 2 * Global.GAP_SIZE); g.endFill(); GameTextures.logo = g.generateTexture(); g.destroy(); } private static generateStartButton(g:Phaser.Graphics):void{ let percentage:number = 0.25; let shift:number = Global.GAP_SIZE; g.clear(); g.lineStyle(Global.GAP_SIZE, Global.GREY, 1); g.drawRoundedRect(-Global.TILE_SIZE / 2 + Global.GAP_SIZE, -Global.TILE_SIZE / 2 + Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, Global.TILE_SIZE - 2 * Global.GAP_SIZE, 2 * Global.GAP_SIZE); g.lineStyle(0); g.beginFill(Global.GREY); g.drawTriangle([new Phaser.Point(-Global.TILE_SIZE * percentage + shift, -Global.TILE_SIZE * percentage), new Phaser.Point(Global.TILE_SIZE * percentage + shift, 0), new Phaser.Point(-Global.TILE_SIZE * percentage + shift, Global.TILE_SIZE * percentage)], false); g.endFill(); GameTextures.startButton = g.generateTexture(); g.clear(); } private static generateArrows(g:Phaser.Graphics):void{ let percentage:number = 0.25; let shift:number = Global.GAP_SIZE; g.clear(); g.lineStyle(Global.GAP_SIZE, Global.GREY, 1); g.drawTriangle([new Phaser.Point(-Global.TILE_SIZE * percentage + shift, -Global.TILE_SIZE * percentage), new Phaser.Point(Global.TILE_SIZE * percentage + shift, 0), new Phaser.Point(-Global.TILE_SIZE * percentage + shift, Global.TILE_SIZE * percentage)], false); GameTextures.arrows = [g.generateTexture()]; g.clear(); percentage = -0.25; shift = -Global.GAP_SIZE; g.clear(); g.lineStyle(Global.GAP_SIZE, Global.GREY, 1); g.drawTriangle([new Phaser.Point(-Global.TILE_SIZE * percentage + shift, -Global.TILE_SIZE * percentage), new Phaser.Point(Global.TILE_SIZE * percentage + shift, 0), new Phaser.Point(-Global.TILE_SIZE * percentage + shift, Global.TILE_SIZE * percentage)], false); GameTextures.arrows.push(g.generateTexture()); g.clear(); } private static generateOverlayer(g:Phaser.Graphics):void{ g.clear(); g.beginFill(Global.COLORS[0], 1); g.drawRect(-Global.TILE_SIZE/2, Global.TILE_SIZE/2, Global.TILE_SIZE, Global.TILE_SIZE); g.endFill(); GameTextures.overlayer = [g.generateTexture()]; g.clear(); g.clear(); g.beginFill(Global.COLORS[1], 1); g.drawRect(-Global.TILE_SIZE/2, Global.TILE_SIZE/2, Global.TILE_SIZE, Global.TILE_SIZE); g.endFill(); GameTextures.overlayer.push(g.generateTexture()); g.clear(); } static generateTextures(g:Phaser.Graphics):void{ GameTextures.generateStartButton(g); GameTextures.generateArrows(g); GameTextures.generateOverlayer(g); g.destroy(); } } Then During the game I load these texture in Phaser.Image object. I though since everything is texture it will be loaded on the GPU and rendered fast. But the game using this method or without have the same framerate which is around 10 frames/second (even on the main menu which doesn't have too much objects). Any ideas how can I make it faster or caching the texture? Thanks in advance
  24. I am updating #ProcEngine to add more features. For now I will add lower constraint on number of objects in the level using genetic algorithm. Any more suggestions?