Ulbast

Members
  • Content Count

    22
  • Joined

  • Last visited

About Ulbast

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Decreasing the value of collisions of bullets vs bullets and changing blocks into one type solved a thing, 60 fps now! Thank you guys!
  2. Hi, in my finished game I've found a thing, that slows my game from 60 to 30 fps. Too many collisions handlers. Well I need them to control whole game, to call all essentiall functions, but they are sloooooowing game drastically. game.physics.arcade.collide(bullets, layer, resetBullet); game.physics.arcade.collide(grenades, layer, resetBullet); game.physics.arcade.collide(ebullets, layer, resetBullet); game.physics.arcade.collide(chest3, chest5, chesting); game.physics.arcade.overlap(bullets, ebullets, resetBullet); It's for bullets to destroy chests, bullets with themselves and chest with chest. If I delete this, FPS goes from 30 to 60. But I need this. How can I do it? It's interesting, because the bullets aren't even created and they are slowing game. I have much more collision handlers, for every object to collide with layers and with all other objects like player, bullet, chest, another bullet, enemy bullet etc... Full code of game is avaiable here: redplanetgame.prv.pl
  3. Thanks for your answers. Rendering from atlas is somehow complicated for me, the clearest , official tutorial have no basic explanation of it. But I've found a thing, that could be crucial here. Too many collisions handlers. Well I need them to control whole game, to call all essentiall functions, but they sloooooow game from 60 to 30 fps. game.physics.arcade.collide(bullets, layer, resetBullet); game.physics.arcade.collide(grenades, layer, resetBullet); game.physics.arcade.collide(ebullets, layer, resetBullet); game.physics.arcade.collide(chest3, chest5, chesting); game.physics.arcade.overlap(bullets, ebullets, resetBullet); It's for bullets to destroy chests, bullets with themselves and chest with chest. If I delete this, FPS goes from 30 to 60. But I need this. How can I do it? It's interesting, because the bullets aren't even created and they are slowing game
  4. Hi, I present you my game made in Phaser, here u are: redplanetgame.prv.pl I've finished it 3 months ago. It's a platform game, to collect all goals and kill enemies. When I was creating it, it worked fine, I mean, on full fps, but when I reach the end it drastically slowed down. I started few topic about this problem. I think, it's too many bullets or sth.(or my weird structure of code). When u inspect the browser, on bottom u can see all of my phaser code I've used. It's this: <script type="text/javascript" src="functions.js"></script> <script type="text/javascript" src="create.js"></script> <script type="text/javascript" src="update.js"></script> <script type="text/javascript" src="game.js"></script> <script type="text/javascript" src="jquery-3.2.1.js"></script> My question is: how to speed up whole game? Now it's seriously problematic. Another weird thing is that on many computers it works fine, on few it doesn't run completely (black screen instead of game), on other it freezes after few seconds, and in one the space+left arrow is not working xD
  5. Deleting the checkWorldBounds make game a lot faster, thanks a lot!
  6. When the bullet leaves the screen, in next second eventually it collide with wall and die. In addition, checkworldbounds is set true. The shooting look like this: //CREATE //ENEMY BULLETS ebullets = game.add.group(); ebullets.enableBody = true; ebullets.physicsBodyType = Phaser.Physics.ARCADE; game.physics.enable(ebullets, Phaser.Physics.ARCADE); ebullets.createMultiple(50, 'enemy_bullet'); ebullets.setAll('checkWorldBounds', true); ebullets.setAll('outOfBoundsKill', true); ebullets.forEach(function(bullet){ bullet.body.collideWorldBounds = true; bullet.body.bounce.set(1)}); turret13 = game.add.sprite(145*16, 61*16, 'turret'); object_create_properties(turret13,'turret'); turret14 = game.add.sprite(145*16, 67*16, 'turret'); object_create_properties(turret14,'turret'); turret15 = game.add.sprite(145*16, 71*16, 'turret'); object_create_properties(turret15,'turret'); //TIMER game.time.events.loop(1000, turrets_shot, this); //turrets shooting //IN FUNCTIONS: function turrets_shot() { enemy_shooting(turret13,'turret'); enemy_shooting(turret14,'turret'); enemy_shooting(turret15,'turret'); } function enemy_shooting (enemy,type,direction) { if ( type == 'turret' ) { nextFire = game.time.now + fireRate; var ebullet = ebullets.getFirstDead(); ebullet.reset(enemy.body.x+4, enemy.body.y+16); ebullet.body.velocity.y=0; ebullet.body.allowGravity = true; } }
  7. When I'm increasing the pool, the game goes slower and slower. Any other ideas?
  8. Well I solved the problem, the issue was in Tiled Editor, where the important was the name of tileset. Thanks for answer
  9. Both files are present on the server. E: the 404 log somoehow dissapeared, but the other remain: phaser.min.js:20 Phaser.AnimationParser.spriteSheet: '[object HTMLImageElement]'s width/height zero or width/height < given frameWidth/frameHeight spriteSheet @ phaser.min.js:20 addSpriteSheet @ phaser.min.js:20 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 start @ phaser.min.js:20 preUpdate @ phaser.min.js:10 updateLogic @ phaser.min.js:11 update @ phaser.min.js:11 updateRAF @ phaser.min.js:18 window.requestAnimationFrame.forceSetTimeOut._onLoop @ phaser.min.js:18 phaser.min.js:20 Phaser.AnimationParser.spriteSheet: '[object HTMLImageElement]'s width/height zero or width/height < given frameWidth/frameHeight spriteSheet @ phaser.min.js:20 addSpriteSheet @ phaser.min.js:20 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 asyncComplete @ phaser.min.js:21 fileComplete @ phaser.min.js:21 loadImageTag @ phaser.min.js:21 loadFile @ phaser.min.js:21 processLoadQueue @ phaser.min.js:21 start @ phaser.min.js:20 preUpdate @ phaser.min.js:10 updateLogic @ phaser.min.js:11 update @ phaser.min.js:11 updateRAF @ phaser.min.js:18 window.requestAnimationFrame.forceSetTimeOut._onLoop @ phaser.min.js:18 phaser.min.js:27 Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)' at c.Tileset.draw (phaser.min.js:27) at c.TilemapLayer.renderRegion (phaser.min.js:26) at c.TilemapLayer.renderFull (phaser.min.js:26) at c.TilemapLayer.render (phaser.min.js:26) at c.TilemapLayer._renderCanvas (phaser.min.js:26) at c.World.d.DisplayObjectContainer._renderCanvas (phaser.min.js:7) at c.Stage.d.DisplayObjectContainer._renderCanvas (phaser.min.js:7) at d.CanvasRenderer.renderDisplayObject (phaser.min.js:9) at d.CanvasRenderer.render (phaser.min.js:9) at c.Game.updateRender (phaser.min.js:11)
  10. Hi, in my platform game I want to load map from Tiled. Everything was working fine, with this example: function preload() { game.load.tilemap('level1', 'assets/level8.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tiles-1', 'assets/tiles-1.png'); } function create() { //MAP SETTINGS map = game.add.tilemap('level1'); map.addTilesetImage('tiles-1'); map.setCollisionByExclusion([ 13, 14, 15, 16, 46, 47, 48, 49, 50, 51 ]); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); } It worked perfectly, but when I just edited tilesheet and used them in Tiled (identical tiles but grey instead brown), the game cannot load. The error from the console: Failed to load resource: the server responded with a status of 404 (Not Found) and Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)' at c.Tileset.draw (phaser.min.js:27) at c.TilemapLayer.renderRegion (phaser.min.js:26) at c.TilemapLayer.renderFull (phaser.min.js:26) at c.TilemapLayer.render (phaser.min.js:26) at c.TilemapLayer._renderCanvas (phaser.min.js:26) at c.World.d.DisplayObjectContainer._renderCanvas (phaser.min.js:7) at c.Stage.d.DisplayObjectContainer._renderCanvas (phaser.min.js:7) at d.CanvasRenderer.renderDisplayObject (phaser.min.js:9) at d.CanvasRenderer.render (phaser.min.js:9) at c.Game.updateRender (phaser.min.js:11)
  11. After update, nothing changed. The function is not working ;/
  12. Creating objects while running? As my hero is copying himself every sec. or stth like that? Everything was working perfectly, since more objects come to life. Now when I'm removing a few bullets, everything goes faster. But it sounds ridiculous if this little amount of objects can slow the whole system...
  13. By increasing amount, as I suspected, its even worse, the game runs slower, because it has more objects to handle... Bullets are killed with collision with objects, like this: function resetBullet (bullet) { bullet.kill(); } game.physics.arcade.overlap(bullet, sth, resetBullet);
  14. Hi guys, my game was working fine, fluently, etc and I was expanding it. It's platform, where a lot of bullets are flying, also many spikes hang from the upper platforms. Now, when I add more spikes and more bullets, when the turrets shot them, the game drastically slows. Is too many object there? And what can I do to make it faster again? Creating spikes: function create_spikes ( x , y , number, angle, vertical) { for (i=0; i < number; ++k, i++) { if ( vertical != 'yes' ) { spikes[k] = game.add.sprite((x+i)*16, y*16, 'kolec'); } else spikes[k] = game.add.sprite(x*16, (y+i)*16, 'kolec'); game.physics.enable(spikes[k], Phaser.Physics.ARCADE); spikes.enableBody = true; if ( angle==180 ) spikes[k].body.setSize(12, 8, -14, -16); else spikes[k].body.setSize(12, 8, 4, 8); spikes[k].body.allowGravity = false; spikes[k].angle=angle; } } //ENEMY BULLETS ebullets = game.add.group(); ebullets.enableBody = true; ebullets.physicsBodyType = Phaser.Physics.ARCADE; game.physics.enable(ebullets, Phaser.Physics.ARCADE); ebullets.createMultiple(50, 'enemy_bullet'); ebullets.setAll('checkWorldBounds', true); ebullets.setAll('outOfBoundsKill', true); //ENEMY SHOOTING function enemy_shooting (enemy,type,direction) { if ( type == 'mortar' && enemy.alive==true) { nextFire = game.time.now + fireRate; var ebullet = ebullets.getFirstDead(); ebullet.reset(enemy.body.x-20, enemy.body.y-20); ebullet.body.velocity.y=-200; if ( player.body.x <= enemy.body.x ) ebullet.body.velocity.x=-200; else ebullet.body.velocity.x=200; }
  15. I just realised that I'm one update behind. I will update, then.