Jump to content

Search the Community

Showing results for tags 'lag'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

  1. This is a strange one.I play a game called Defly.io and I'm trying to help the Developer sort an issue with the game. Once the game servers experience some stress the game begins to lag. This will ONLY happen in certain scenarios which have to be set up and easily replicated for this lagging issue to be applied. The kicker and what I'm most confused about is that in the exact same scenario where the game is lagging, all you have to do is open up the DevTools and boom, everything is fixed and lag free. What does the DevTools do to the webpage? Does it enable or disable anything? I am so confused. I've linked a video below of what happens in game; https://drive.google.com/file/d/115T6lwQXkgflF2ny-ZsKf28pcQqHwf49/view?usp=sharing https://drive.google.com/file/d/1F7StRStcynZh_YT2V0_LI5tVQEOIaQd9/view?usp=sharing Any help with this would be massively appreciated. Kind Regards,
  2. I've loaded two animations in Pixi with spritesheets. I wanna swap to second animation right after the first animation is finished. However, (It's happen with a 3840x1080 resolution, and the GPU memory usage is mainly fall between 90%-99%) 1. there's a significant lag of the transition between these two animations in the first time. 2. After the first play, if I remove and add the animatedSprite from the stage immediately, the transition is very smooth. 3. After the first play, If I remove the 2 animatedSprite from the stage, wait for ~2-3 minutes and add the 2 animatedSprite into the stage again, the transition is lagging again. I wanna know the proper way of swapping two animation in Pixi and also the reason of this phenomenon.
  3. I've followed many guides on the internet and I have found success in none of them so far. My situation is having a game where updates from the server are inconsistent, so-far I have found no lerp that can handle this without jumping and jittering a bunch.
  4. Hey Guys, I'm currently moving my camera around a series of sprites but the movement is painful to look at and jerky when moving the sprites and especially with higher speeds, is there anything you can do to fix/help the lag/poor performance as it isn't really usable as a build in this current state. I also as @Wingnut said have the issue that the transparent background is still clickable. Here is my current playground: https://www.babylonjs-playground.com/#41N19L#3 @Deltakosh @Wingnut @JohnK Any incites Guys?
  5. Hi! I'm in the process of developing an online multiplayer snake (4-8 simultaneous players in a grid based arena) with the stack involving Phaser in the client, Node in the backend with the networking protocol being websockets through socket-io. The progress made so far has been a prototype consisting of a dumb client and an authoritative server. The server proceeds game logic by 100ms and emits the result to the client at the end of each iteration of this game loop. The client is able to tell the server to change its direction to up, down, left and right, respectively, and the server will use this in order to calculate the next x and y position for this client (which is on the next tick). If the server notices clients colliding with walls, other clients or fruits, the involved client(s) is affected accordingly. The issue with this "dumb client" approach is that the responsiveness for the client seems to be lost in not actually simulating anything locally. From what I understand, to mitigate this lag for the client, client prediction can be applied. Since the movement is actually not caused as a direct action from a client but is always constant (you only influence direction in snake), this would mean that this 100ms game loop would have to be simulated in the client as well, with directional client input being respected and simulated directly in the client at the same time as it is being sent to the server for "verification". For some reason I cannot seem to wrap my head around this topic of the game having "constant speed". The examples I've read are mostly based on games where the movement is based directly on a fixed action, say "move me 10 px to the right", and not constant in the way snake is. Does this “constant speed” design change how I should tackle lag mitigation techniques such as client prediction? What about entity interpolation/extrapolation? Any help or guidance would be greatly appreciated.
  6. sansa

    Tween Issue

    Hello, I'm having an issue with the tween. For example a card flip. this.cardChoice = game.add.sprite(213, 255, 'normal_cards', 'back_card'); this.cardChoice.anchor.setTo(0.5, 0.5); this.cardChoice.scale.setTo(0.84, 0.80); this.cardChoice.scale.setTo(0.84, 0.80); public cardFlip() { this.tweenPCard = this.game.add.tween(this.cardChoice.scale).to( { x: 0 }, 200, 'Quart.easeOut'); this.tweenPCard.start(); this.tweenPCard.onComplete.add(this.choiceCardFlip, this); } public choiceCardFlip() { this.tweenChoice = this.game.add.tween(this.choice.scale).to( { x: 0.84 }, 200, 'Quart.easeOut'); this.tweenChoice.start(); } In the first few plays the tween is good but after several plays the card is not flipping and it's like the this.tweenCard = this.game.add.tween(this.cardChoice.scale).to( { x: 0 }, 200, 'Quart.easeOut'); is disappearing. Thanks.
  7. Hello, I am creating a simple, multiplayer, platform game in Phaser. I'm looking the best solution for lag. At the begining I sent to clients current positions of players. It was't be good solution. Next, I sent to clients velocities. In this solution I saw misalignment effect. One player saw own character at another postion than second player. Now I use queque of movement. This solution is good, but I think code can be better. Maybe someone has any ideas? function distance(x1, y1, x2, y2) { var dx = x1 - x2; var dy = y1 - y2; return Math.sqrt(dx * dx + dy * dy); } function update() { if (player.body.velocity.x != 0 && !(leftButton.isDown) && !(rightButton.isDown)) { player.body.velocity.x = 0; client.ws.send("VELX0|" + parseInt(player.body.x) + "|" + parseInt(player.body.y)); } if (player.body.velocity.x == 0 && !(leftButton.isDown) && (player.body.touching.down) && !(rightButton.isDown)) { player.body.velocity.x = 0; client.ws.send("VELX0|" + parseInt(player.body.x) + "|" + parseInt(player.body.y)); } if (leftButton.isDown && player.body.velocity.x != -300) { player.body.velocity.x = -300; client.ws.send("VELX-300|" + parseInt(player.body.x) + "|" + parseInt(player.body.y)); } if (rightButton.isDown && player.body.velocity.x != 300) { player.body.velocity.x = 300; client.ws.send("VELX300|" + parseInt(player.body.x) + "|" + parseInt(player.body.y)); } if (upButton.isDown && player.body.velocity.y==0 && player.body.touching.down) { player.body.velocity.y = -500; client.ws.send("VELY-500|" + parseInt(player.body.x) + "|" + parseInt(player.body.y)); } if (Object.keys(playersList).length > 1) { if (moves.length > 0) { i = moves.shift(); if (distance(player2.x, player2.y, parseInt(i["x"]), parseInt(i["y"])) <= 10 || moves.length >= 1) { if (i.move === "VELX") { player2.body.x = i["x"]; player2.body.y = i["y"]; player2.body.velocity.x = i["value"]; } if (i.move === "VELY") { player2.body.x = i["x"]; player2.body.y = i["y"]; player2.body.velocity.y = i["value"]; } } else moves.unshift(i); } } } } game = new Phaser.Game(900, 580, Phaser.AUTO, 'phaser', { preload: preload , create: create , update: update }); function Client() {} Client.prototype.openConnection = function () { this.ws = new WebSocket("ws://127.0.0.1/ws/"); this.connected = false; this.ws.onmessage = this.onMessage.bind(this); this.ws.onerror = this.displayError.bind(this); this.ws.onopen = this.connectionOpen.bind(this); }; Client.prototype.connectionOpen = function () { this.connected = true; }; Client.prototype.onMessage = function (message) { if (message.data.substring(0, 4) == "VELX") { z = { x: parseInt(message.data.substring(6).split("|")[2]) , y: parseInt(message.data.substring(6).split("|")[3]) , move: "VELX" , value: parseInt(message.data.substring(6).split("|")[1]) } moves.push(z); } if (message.data.substring(0, 4) == "VELY") { z = { x: parseInt(message.data.substring(6).split("|")[2]) , y: parseInt(message.data.substring(6).split("|")[3]) , move: "VELY" , value: parseInt(message.data.substring(6).split("|")[1]) } moves.push(z); } }; Client.prototype.displayError = function (err) { console.log('Websocketerror: ' + err); };
  8. The scene: I have a scene with 21 textured very low poly (300-400 poly count) models with skeletons and animations. Out of which I null the skeleton of 20 of the models, in order for bjs to avoid calculating their bones. (done to increase performance) Whenever I'm playing the animation of any of the 20 models (happens seldom), I'm temporarily setting their skeleton back for the period of the animation. The remaining model plays animation in a loop. I have a pretty strong computer (runs latest hardcore 3d games). The problem: The game mostly runs very smoothly, but in the beginning, I suspect before each model was visible on the screen and/or each animation was played for the first time, or something of the sort, there are a few freezes. A freeze is mostly 0.1-0.3 seconds but can even get to 3-5 seconds. After a few of these freezes occur (typically 2-3 freezes after game initialization), the game keeps playing smoothly with no more freezes. Throughout the game different models are displayed, but always in the format I displayed above (20 mostly with no skeleton, seldom play animations, 1 plays animation in loop). I'm suspecting the reason behind these freezes is garbage collection - which for some reason happens only a few times and then stops. Could bjs be doing lazy initialization of certain things only when they need to be used and after each initialization which happens on the run there's enough garbage to trigger a garbage collection? e.g. bjs initializing certain things only before playing an animation for the first time. Such a thing would explain the freezes. Hopefully I gave you enough info to solve this without a PG / profiling.
  9. Hello everyone! I have a big map with a tilesprite in the background (repeating mountains). When I want to hide them, the first time I do background.alpha = 0, I notice a huge stutter. I can go back to alpha = 1 and alpha = 0 as much as I want later on, no issue. Only the first alpha = 0 causes the game to lag terribly. I have tried with visible, renderable, exists etc. : same result! I have also tried to create a tilesprite with different frames and switch between them, but the impact on performance was dreadful (lost 50FPS!). How could I avoid that? What's the cause of this stutter? Thanks a lot!
  10. Hello again, all. Started project recently which seems simple enough and difficult to screw up, however, on our Apple devices I'n noticing over about the period of 30 minutes or so, the frame rate drops from 60 to under 20! I'm keeping an eye on instances in the world and they don't increase over time. I thought I had it well contained but it would appear I was wrong. I guess my questions is, what other things need manual keeping? My sprites/images are well contained I believe, could sounds not being destroyed be the cause? Cheers for any help
  11. Hi. Noob at Phaser (but senior in a lot of other things). I'm currently noodling with Phaser and Elixir + Phoenix + Websockets. So far: all going well. I've got a simplistic space-shooter happening that sends socket protocols up to the server with position, velocity rotation info about sprites & bullets that get re-broadcast to other players. It's simplistic, but it works. Next step is to deal with lag compensation, so here is my question: I may receive, for instance, a "bullet-fired" message that happened x number of game-ticks ago on the other player's machine. How can I tell the (for example) P2Physics Engine: 'this happened in the past, so you should move it to where you think it should be now"? I realise that the most obvious answer to this question is *PROBABLY* going to be "read how the physics engines work, fork one of them, and add these features yourself", but I just thought it's always worth asking the LazyWeb, just in case someone's already thought of this already. Thanks in advance.
  12. Hi there, Im having some issues with performance when i render thousands of sprites. Currently having issues with loading around 20k sprites, but eventually plan on having more (maybe even up to 60k) around the map. I did some research and found this is a somewhat common issue but cannot get a clear and concise answer. I ran some chrome profiles on my game to see whats holding me back: here are my results. To be honest, I don't really understand what that information means other than 20k sprites is too much. (I have a fairly decent computer and its slightly choppy at 20k trees, at say 60k its very choppy) Also, when I say choppy, I mean like it looks choppy, my movement is still fine (to make the point that its not like the game loop thats lagging). Essentially I have 20k trees being placed around a very large map that's being rendered with a tileSprite. However, it's not the map size that is holding me back since the performance I get is very dependent on the number of tree sprites. The tree's have no physics enabled on them and are just rendered and placed in a group then never touched again. Here is a snippet from my create function and how i render the trees. for(var i = 0; i<20000; i++){ treeX = Math.round(Math.random()*(mapSize-1)); treeY = Math.round(Math.random()*(mapSize-1)); temp = position(treeX, treeY); createTree = game.add.sprite(temp[0],temp[1], 'tree2'); treeGroup.add(createTree); } The position function I called in the loop just gets the pixel location of the tree's based on a tile, as shown below: var position = function(col, row){ column = (33*col+1); rowFin = (33*row+1); return [column, rowFin]; }; Any ideas as to how i can beef up my performance? Any way I could not render the tree's until they are in view? (Kill then revive when seen?) Any tips are greatly appreciated! Side note (if its useful), right now all I have is the tileSprite background, 20k trees, and movable player sprite. Edit: Would creating a chunk system be a good idea? If so anyone have any idea where to start with the best way to make one?
  13. Hi guys I'm working on a game developed with phaser.JS (and phonegap), and i'm facing a surprising problem. FPS is pretty good (it's between 55 and 60) but the avatar moves are not smooth. So i guess it's caused by the use of phaser feature. You can see the problem on the video here : https://www.youtube.com/watch?v=JfYBcvl4b78 Have you ever met this problem ? Do you have some idea to improve that ? Thanks for your time ! Dorian
  14. When using a 2048x2048 texture atlas the game runs fine. But if I switch to a 4096x4096 texture atlas, the game freezes for a short period of time (less than half a second) once every second. This doesn't happen on my iPhone 4S, only my PC. And it only happens in Chrome, and when using Phaser.CANVAS (Phaser.WEBGL works fine). I'm using Phaser version 2.4.4. I'm getting close to releasing this game, and I'm a bit worried about this... Thanks in advance!
  15. In one state I'm using Phaser.RenderTexture, game.make.bitmapData and they reduce framerate in the next state. Is there a way to get rid of them completely? 1) I'm switching the state. 2) Using .destroy() for bitmapData, RenderTexture and sprite which uses RenderTexture. What else can be done? Remove them from cache? Thanks in advance. P.S. using CANVAS mode
  16. Hello, I am building a continuous sidescroller game using Phaser. the game has parallex scrolling background, i have added the background as tilesprite and given it autoscroll. i am spawning the ledges on which the player runs as the game progress. my problem is that the game is a bit jerky in nature, it sometimes lags for a sec or two what can i do to resolve this? any suggestions are welcomed http://gamegurus.com/demos/RunningMan/ , here is the latest build of the game. Thanks
  17. Hi, I'm developing an html5 game using phaser + cocoonjs. So far there is only 1 sprite with velocity set, so basically it just moves from right to left. As simple as it sounds, running this on android device (and sometimes in chrome) I noticed that the sprite doesn't move smoothly, it's laggy! I'm not sure if there is a better way to animate the sprite that makes it smooth. Here is the code I have, I also attached the full application. /// <reference path="js/phaser.min.js" />var w = window.innerWidth;var h = window.innerHeight; var game = new Phaser.Game(w, h, Phaser.AUTO, '', { preload: preload, create: create, update: update });var speed = -250; function preload() { game.load.image('trainHead', 'img/trainHead3.png');} function create() { var globalY = game.world.height / 3; trainUnitHeight = h / 8; trainUnitWidth = w / 5; // Train head trainHead = game.add.sprite(game.world.width, globalY, 'trainHead'); trainHead.anchor.setTo(0.5); SetDimensions(trainHead, trainUnitWidth, trainUnitHeight); game.physics.arcade.enable(trainHead); trainHead.body.velocity.x = speed;} function update() {} function SetDimensions(sprite, width, height) { sprite.width = width; sprite.height = height;} Any help/suggestions are greatly appreciated! Thanks!!repro.zip
  18. Hi, I have 5 sprites and i want to play an animation on its sprite. this is the test Page : http://goldgames.eu/test.html I have this problem only on google chrome. when i am setting texture to sprite[0] and sprite[1] its ok but when i am setting texture to sprite[2] the browser lags. what i am doing wrong ? sorry for my english, its not very good
  19. Hey everyone! First post here, so bare with me a bit. I have started my first Phaser game and I've got the core of the game put together now. However, I have a problem where I'm experiencing some pretty serious FPS problems. In my game, a character moves around the map and the tiles they walk onto change colours. Each time a new colour is drawn the game lags. I use a basic TileMap with only 1 layer that is in JSON format. I use the TileMap.PutTile() function to change the colour of each tile. The image used for this tile is a very simple <1KB png image which is basically just a single colour. I wouldn't expect that drawing a single tile would cause such lag. I'm certain that the "putTile" line is the problem as if I remove it then there isn't a stitch of lag. // Pre-loading the tilemap and the tile game.load.tilemap('map', 'assets/maps/TileMap5.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tile-danger-zone', 'assets/images/tiles/tile-danger-zone.png', true); // Create map layermap = game.add.tilemap('map');mapLayer = map.createLayer('Tile Layer 1'); // Fill the tile -- once per player movementmap.putTile(DANGER_ZONE_ID, x, y, mapLayer); <-- this lags a fair bit (ie. 60fps -> 20fps) Am I doing something wrong in my practice here? Is there a more lightweight of doing this that wouldn't cause this lag? http://phaser.io/examples/v2/tilemaps/blank-tilemap ^ Given this example, the putTile method shouldn't be a problem at all. Weird!?! The game can be found here if you want to see the problem: http://www.supergaming.comxa.com/ Thanks for any help! Let me know if you need any further information.
  20. hi buddies, i've experiencing some lagging when i played my game prototype using firefox mozilla, but in chrome is really smooth? any idea why? any tips to enhance performance in firefox?
  21. Hi! Im on the final stages of my development in my Phaser Game Its a simple game of using the accelerometer to guide a ball to a hall and navigating through walls I extensively tested this game on the web browsers and its ok but when I use phonegap and tested it on mobile phones the FPS ranges from 20 - 45 ish which was still ok for me until the game suddenly falls apart by physics glitch. Is this about the lag or just that there is a physics problem? Here; Ball.GameEasy = function(game) { keys = null; ball = null; walls = null; timer = 0; totalTimer = 0; timer2 = 0; loop = null; firstRun = true; level = 1; //sfx_bounce = null; maxLevels = 5; audio = true; timer3 = 0; gamedif = 0; };Ball.GameEasy.prototype = { create: function() { this.add.sprite(0, 0, 'screen-bg'); panel = this.add.sprite(0, 0, 'panel'); panel.body.immovable = true; walls = this.game.add.group(); walls.add(panel); pauseButton = this.add.button(320-36-8, 8, 'button-pause', this.managePause, this); //audioButton = this.add.button(320-36-8-36-8, 8, 'button-audio', this.manageAudio, this); //audioButton.animations.add('true', [0], 10, true); //audioButton.animations.add('false', [1], 10, true); //audioButton.animations.play(audio); timerText = this.game.add.text(15, 15, "Time: "+timer, { font: "24px Cambria", fill: "#ffff00" }); levelText = this.game.add.text(120, 10, "Level: "+level, { font: "16px Cambria", fill: "#ffff00" }); totalTimeText = this.game.add.text(120, 30, "Total time: "+totalTimer, { font: "16px Cambria", fill: "#ffff00" }); fpsText = this.game.add.text(15,40, "fps: "+timer3, { font: "16px Cambria", fill: "#ffff00" }); hole = this.add.sprite((320)/2, 90, 'hole'); hole.body.immovable = true; hole.anchor.setTo(0.5, 0.5); hole.body.setCircle(5,15,15); ball = this.add.sprite((320)/2, 450, 'ball'); ball.anchor.setTo(0.5, 0.5); ball.body.bounce.setTo(0.3, 0.3); ball.body.setCircle(11, 12, 12); ball.body.linearDamping = 1; ball.body.collideWorldBounds = true; keys = this.game.input.keyboard.createCursorKeys(); window.addEventListener("deviceorientation", this.handleOrientation, true); /*if(!loop) { loop = this.game.time.events.loop(Phaser.Timer.SECOND, this.updateCounter, this); //loop = this.game.time.events.loop(1500, this.updateCounter, this); level = 1; }*/ this.createLevel(level); //sfx_bounce = this.game.add.audio('bounce'); }, createLevel: function(lvl) { // create levels manually // TODO: import from level editor switch(lvl) { case 1: { //totalTimer=0; gamedif = 0; timer2= 0; timer = 11; this.game.paused =! this.game.paused; walls.create((320-128)/2, (480-32)/2, 'element-w').body.immovable = true; break; } case 2: { timer = 11; this.game.paused =! this.game.paused; this.game.paused =! this.game.paused; walls.create(72, 320, 'element-w').body.immovable = true; walls.create(200, 320, 'element-h').body.immovable = true; walls.create(72, 150, 'element-w').body.immovable = true; break; } case 3: { timer = 11; this.game.paused =! this.game.paused; this.game.paused =! this.game.paused; walls.create(64, 480-128, 'element-h').body.immovable = true; walls.create(320-96, 480-128, 'element-h').body.immovable = true; walls.create(0, 240, 'element-w').body.immovable = true; walls.create(128, 240, 'element-w').body.immovable = true; walls.create(200, 52, 'element-h').body.immovable = true; break; } case 4: { timer = 11; this.game.paused =! this.game.paused; this.game.paused =! this.game.paused; walls.create(110-32, 480-128-32, 'element-w').body.immovable = true; walls.create(0, 240, 'element-w').body.immovable = true; walls.create(320-128, 240, 'element-w').body.immovable = true; walls.create(30, 150, 'element-w').body.immovable = true; walls.create(128+30, 150, 'element-w').body.immovable = true; break; } case 5: { timer = 11; this.game.paused =! this.game.paused; this.game.paused =! this.game.paused; walls.create(220-32, 480-128, 'element-h').body.immovable = true; walls.create(92, 480-128-32, 'element-w').body.immovable = true; walls.create(0, 240, 'element-w').body.immovable = true; walls.create(128, 240, 'element-w').body.immovable = true; walls.create(256, 240, 'element-h').body.immovable = true; walls.create(180, 52, 'element-h').body.immovable = true; walls.create(52, 148, 'element-w').body.immovable = true; break; } case 6:{ timer = 11; this.game.paused =! this.game.paused; walls.create(190,320,'element-w').body.immovable = true; walls.create(0,320,'element-w').body.immovable = true; walls.create((320-128)/2, (480-32)/2, 'element-w').body.immovable = true; walls.create(256, 150, 'element-h').body.immovable = true; walls.create(40, 150, 'element-h').body.immovable = true; break; } case 7:{ timer = 11; this.game.paused =! this.game.paused; walls.create(190,320,'element-w').body.immovable = true; walls.create(0,320,'element-w').body.immovable = true; walls.create((320-128)/2, (480-32)/2+40, 'element-w').body.immovable = true; walls.create(256, 150, 'element-h').body.immovable = true; walls.create(40, 150, 'element-h').body.immovable = true; walls.create(206, 118, 'element-w').body.immovable = true; walls.create(0, 118, 'element-w').body.immovable = true; walls.create(256/2+14.5, 113, 'element-h').body.immovable = true; break; } case 8: { timer = 11; this.game.paused =! this.game.paused; walls.create(220-32, 480-128, 'element-h').body.immovable = true; walls.create(92, 480-128-32, 'element-w').body.immovable = true; walls.create(0, 240, 'element-w').body.immovable = true; walls.create(128, 240, 'element-w').body.immovable = true; walls.create(256, 240, 'element-h').body.immovable = true; walls.create(180, 52, 'element-h').body.immovable = true; walls.create(52, 148, 'element-w').body.immovable = true; break; } case 9: { timer = 11; this.game.paused =! this.game.paused; walls.create(220-32, 480-128, 'element-h').body.immovable = true; walls.create(92, 480-128-32, 'element-w').body.immovable = true; walls.create(0, 240+24, 'element-w').body.immovable = true; walls.create(128, 240+24, 'element-w').body.immovable = true; walls.create(256, 240+24, 'element-h').body.immovable = true; walls.create(180, 52, 'element-h').body.immovable = true; walls.create(180-70, 52, 'element-h').body.immovable = true; walls.create(24, 360, 'element-w').body.immovable = true; walls.create(220-32-60, 480-128+68, 'element-h').body.immovable = true; break; } case 10: { timer = 11; this.game.paused =! this.game.paused; walls.create(220-32, 480-128, 'element-h').body.immovable = true; walls.create(92, 480-128-32, 'element-w').body.immovable = true; walls.create(0, 240+24, 'element-w').body.immovable = true; walls.create(128, 240+24, 'element-w').body.immovable = true; walls.create(256, 240+24, 'element-h').body.immovable = true; walls.create(128+24, 240+24-60, 'element-w').body.immovable = true; walls.create(0+24, 240+24-60, 'element-w').body.immovable = true; walls.create(128+24+128, 240+24-60, 'element-w').body.immovable = true; walls.create(128, 240+24-60-24-32, 'element-w').body.immovable = true; walls.create(0, 240+24-60-24-32, 'element-w').body.immovable = true; walls.create(128+128+24, 240+24-60-24-32, 'element-w').body.immovable = true walls.create(24, 360, 'element-w').body.immovable = true; walls.create(220-32-60, 480-128+68, 'element-h').body.immovable = true; break; } default: { break; } } }, updateCounter: function() { timer=timer-(timer3/timer3); timer2++; timerText.content = "Time: "+timer; totalTimeText.content = "Total time: "+(totalTimer+timer2); if(timer==0) { //gamedif=1; //this.game.add.text(320/3, 480/2, "GAMEOVER", { font: "36px Cambria", fill: "#ffff00" }); totalTimer=0; timer=0; timer2=0; level=1; this.game.state.start('GameOver',true,false,gamedif); //this.game.paused =! this.game.paused; //this.buttonContinue = this.add.button(0, 0, 'gameover', this.mainM, this); //this.buttonContinue = this.add.button(0, 0, 'screen-howtoplay', this.game.state.start('MainMenu');, this); } }, mainM: function(){ this.game.state.start('MainMenu'); }, managePause: function() { this.game.paused =! this.game.paused; }, manageAudio: function() { // turn on/off the audio audio =! audio; audioButton.animations.play(audio); console.log('audio: '+audio); }, update: function() { if(!loop) { //loop = this.game.time.events.loop(Phaser.Timer.SECOND, this.updateCounter, this); loop = this.game.time.events.loop(1000, this.updateCounter, this); level = 1; } timer3 = this.game.time.fps; fpsText.content = "FPS: "+timer3; var force = 10; if(keys.left.isDown) { ball.body.velocity.x -= force; } else if(keys.right.isDown) { ball.body.velocity.x += force; } if(keys.up.isDown) { ball.body.velocity.y -= force; } else if(keys.down.isDown) { ball.body.velocity.y += force; } this.game.physics.collide(ball, walls, this.wallCollision, null, this); this.game.physics.collide(ball, hole, this.finishLevel, null, this); }, wallCollision: function() { //sfx_bounce.play(); }, finishLevel: function() { if(level >= maxLevels) { //totalTimer += timer; //alert('Congratulations, game completed!\nTotal time of play: '+totalTimer+' seconds! exit the game'); alert('Congratulations, Easy game completed!\nTry the Medium Difficulty'); timer = 0; level = 1; //totalTimer = 0; this.game.state.start('MainMenuMedium'); } else { alert('Congratulations, level '+level+' completed!\nTotal time:'+timer2+''); this.game.paused =! this.game.paused; timer = 0; level++; totalTimeText.content = "Total time: "+timer2; levelText.content = "Level: "+level; this.game.state.start('GameEasy'); } }, handleOrientation: function(e) { var x = e.gamma; // range [-90,90] var y = e.beta; // range [-180,180] ball.body.velocity.x += x/2; ball.body.velocity.y += y; }};`How can I stop the physics glitch? Im using an old version of phaser.min.js which is about 376 kb now its 724 phaser 2.2.2 but my problem is when I use the new one the code tells me a problem about Phaser.StageScaleMode is undefined Will updating phaser version solve this problem? Thanks
  22. One day, without appear reason my game was getting a strange lag. The FPS is stable, but the main sprite what you manage in the game get lag in his actions. I recorded a video: http://www.youtube.com/watch?v=GULryQYi0LY&feature=youtu.be Please, anybody knows why it can happen? In the game there is not more movable objects. Thanks.
  23. Curently, I am making a roguelike game and have a little problem with drawing(updating) the level on the screen. The map is two-dimentional array which generates at the begining of the script ( ). If the player hits an arrow button then movePlayer() function is called. Inside that function we draw the map (1 frame per player's move). That's where the trouble begins. It is starting to drop frames very badly when all the tiles are drawn together (less tiles - more drawing speed, but not enough to play the game). Here is some code: var mapSize = { // in tiles (one is 16x16 px) width: 44, height: 62};//...generating random arrayvar stage, renderer;start();var wallTexture = PIXI.Texture.fromImage("images/level/wall.png");var container = new PIXI.DisplayObjectContainer();function start(){ renderer = PIXI.autoDetectRenderer(992, 704, document.getElementById('canvas')); stage = new PIXI.Stage(); this.document.onkeydown = movePlayer; } function movePlayer(){ //... <-- basic movement here requestAnimFrame(drawMap); renderer.render(stage);} function drawMap(){ for (var i = 0; i < mapSize.width; i++){ for (var j = 0; j < mapSize.height; j++){ if(map[i][j] == '20'){ //'20' is a wall tile var wall = new PIXI.Sprite(wallTexture); wall.position.x = i * tile; wall.position.y = j * tile; container.addChild(wall); } //... drawing other tiles here } } stage.addChild(container); }Thank you, for your help and time.
  24. Hi all, I'm new here. I'm working on a music game with a team for the Baltimore Indie Games Game Jam #2 - Play the Music and we've just hit the important milestone of playing the music while animating some sprites in time with the music. Here is the link to try out our current prototype: http://sambatista.com/bigjam2/v0.0.7/ Right now the beat-sync is done by polling the current time position of the song and dividing it by a step length. It works really well on desktop (Chrome/Firefox). We also have put in the "touch to begin" required by Android to unlock the audio system, and wait for the song to decode before starting the game. On my Galaxy S3, I'm experiencing a pretty sad delay of ~.5 seconds between the action on the screen and the corresponding "position" in the music. I wish we could do something to fix the latency but something tells me this won't be possible. If we knew the latency amount, we could compensate for it. Our last idea is to add a Calibration Screen that would find out the latency amount using player interaction. Recommendations? Roger
  25. Hello everyone, I've been having issues the last couple of days, because the arcade physics seem to be working unreliably in firefox. I have had no problems and no failures with it in Chrome. In firefox every now and then the game lags (more of a stutter, very short freeze) and the arcade-physic collision detection fails. I can walk through walls, fall through the ground and jump through ceilings. Looking at the framerate reveals a small drop in framerate whenever this happens. I also noticed that in Chrome the framerate stays more stable and the problem never happened so far. Looking through the issue tracker on github also didn't reveal anything in this direction. Can anyone help me with this?
×
×
  • Create New...