Search the Community

Showing results for tags 'fps'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 82 results

  1. 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; }
  2. For the life of me, I can't find a setting which adjusts camera movements with current frame rate (automatically adjusting speed, inertia, turn rate). Camera which either warps or bogs down depending on where you look at is simply unacceptable in any application, let alone games. Maybe it's too obvious but in any case I need some help here.
  3. Hello all! I'm currently working on a website that has a Babylon.js scene as it's background, and also includes a game created with Babylon.js. I'm trying to keep the scene as simple as possible - I'm only using planes and their clones - and I'm testing on a 2013 ASUS laptop where I'm getting constant 60FPS. But of course, there are users out there with lower graphics performance, and I'm trying to find a way to test and handle that. In my current setup, I monitor the FPS in the first ten seconds, and if it averages under 45FPS, I call scene.dispose(); and set a cookie so the scene won't be loaded next time. Is there a better way to do this? Thanks in advance! BTW, here a video of the submarine-themed game in progress :
  4. Running the instance Demo both from the babylonjs.com website and locally: I see potential FPS in debug overlay showing ~60 FPS. Actual FPS is ~15 FPS. I tested this in both Chrome and Firefox on both Linux and OSX. I tried removing various parts of the code. Reducing instance count to 10, removing collision tests from all objects. The FPS rises somewhat but the problem persists. I tried checking out the v2.5.0 tag in case something in latest was causing the problem. The problem persists. I think this may be due to BabylonJS depending soley on requestAnimationFrame for update/draw logic (which creates several problems actually, but I created a separate post to address that). I assume there must be something wrong in the update logic, but I am new to BabylonJS. Is anyone else seeing a low FPS number on the babylon website? See attached screenshot where render and frame are only 5ms and 8ms (potential FPS is 128) yet FPS is only 40!
  5. I'm new to BabylonJS but one of the first things I notice is that almost all of the demos run slow (20-30 FPS is typical) on the same machine that is running three.js stuff fast. It seems like update/draw is not being called as often as it could be, as according to the debug overlay update and draw frame time is only 10ms in these same demos (so potential FPS is 100). Additionally I think BabylonJS suffers from timing flaws that other JS engines do, see this article: https://www.isaacsukin.com/news/2015/01/detailed-explanation-javascript-game-loops-and-timing In three.js I am using Mainloop.js to control update/draw timing logic. I think I would like to do the same in babylon.js, unless I am missing something. To expand further, physics should ideally be at a 30hz update rate in my game, but draw calls and other update logic should be at 60hz. Also update logic should be called at a very consistent 60hz, where draw can vary a bit from 40-60fps without real harm. (Draw lag spikes are permissible but update lag spikes should be dealt with by calling update twice to catch up and make game logic and especially physics have predictable behavior and equal time per step.) Is there a way without forking Babylon to override the update/draw timing logic? I notice the functions beginFrame() and endFrame() are public. Can I just call beginFrame, do my render calls, and then call endFrame? Will this break anything? What should "do my render calls" look like? Again I would prefer to not modify babylon.js itself, and instead just override its behavior because I don't want to maintain a fork.
  6. hyyy guys, is it possible to get the same Fps on mobile as PC using BJS engine
  7. for better loading speed, i used texture packer to change multiple sprites to some json atlas. sometime, fps drop from 45-50 to 2-3, especially when use tween or when user other object as modal popup in states. The "sprites" version working fine with 45-50 fps. It happened on "canvas" render mode, the "opengl" render mode is fine with 25-30fps. But i need to use canvas mode for capture screenshot button (canvas2image), and it give better fps (45-50 when uses pure sprites). Does anyone have a solution for this, please help. p/s: sorry for my bad english!
  8. Hi, In my pretty beefy game (lots going on) i get 55-60 frames on my computer with a 60hz monitor. However, when I launch it on another computer (much more power than mine, and with a 144hz monitor) I only get 30-40 frames? Its affecting my game because the update cycle is slower than it should be. When I run a jfiddle on those computers just drawing the fps, they receive their monitors refresh rate as the fps almost perfectly. The chrome is up to date and am using auto/phaser.WEBGL mode. Suggestions?
  9. I have placed hundreds of static sprites in my game and all goes well. But when I try to add 30 animated sprites (AI players) in the game, the FPS drops from 60 to 30. If I add even more it becomes very slow and unplayable. I have profiled my program on Chrome and found that this method CanvasSpriteRenderer.prototype.render is using too many CPU resources. Is there a way to reduce the CPU consumption and make my game smooth again?
  10. Hi Guys, I have multiple game states and one of them is kind of slow on mobile, while it works just fine on desktop. I ran a js profile to find out what could be the potential cause of this and attached it as a reference here. I know this image does probably not give away enough in order to make any clear predictions on what the issue for my fps drop is, but maybe the pattern of the times spent for the functions to execute yields something I could make use of. I commented out most of my update functions of that state to see whether the issue is hiding in there, but no success. The imagery and text I am rendering is also smaller and less than on my working states. I also tried to destroy and null all objects of the previous state. There might be still a couple I haven't captured. This is what I null: this.game = null; this.add = null; this.make = null; this.input = null; this.state = null; this.stage = null; this.time = null; this.world = null; Any suggestion what could go wrong?
  11. Hey. What do you think is the best option ? I know there won't be probably a "best" option but what would you guys choose? Babylon seems more complex than playcanvas but that might bring some more advantages to the table as well idk...
  12. Hey guys, first post, started using Babylon Friday, so I may be a little green. I'm done waiting for Unity3D's webgl porting to not be a steaming pile. Really liking everything so far, but I could use some advice on moving forward with an FPS camera. I extended it from the BABYLON.FreeCamera. Nailed down most of it, but realized that the built-in collision the camera uses has no real concept of friction. It's going to be a bit of a problem when I intended on having moving floor platforms. They just slide right out from under you as-is. I'd rather not start from scratch or fall back on TargetCamera because of all the input groundwork that FreeCamera provides. My best guess for moving forward is to dig in and start overriding the collision functions of FreeCamera like _collideWithWorld(), _updatePosition(), etc. and replace them with Oimo compatible logic. I just want to get the problem out there before I go down that rabbit hole. Is this a horrible idea? Or maybe I'm just missing something incredibly obvious about the built-in physics? Thanks in advance for any advice.
  13. Hello, I don't know if this is something that could be merged into github but we had some projects (and therefore customers) that were highly loaded with objects, thus a bit slow in rendering. The camera inertia was then to long lasting to control the camera if you know what I mean. This is what I've changed to handle this: // Inertia var engineDelta = Math.min(this.getEngine().deltaTime,100), inertiaFactor = Math.min(1,16.66666 / engineDelta); if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) { this.alpha += (this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset) / inertiaFactor; this.beta += this.inertialBetaOffset / inertiaFactor; this.radius -= this.inertialRadiusOffset / inertiaFactor; this.inertialAlphaOffset *= this.inertia * inertiaFactor; this.inertialBetaOffset *= this.inertia * inertiaFactor; this.inertialRadiusOffset *= this.inertia * inertiaFactor; if (Math.abs(this.inertialAlphaOffset) < BABYLON.Engine.Epsilon) this.inertialAlphaOffset = 0; if (Math.abs(this.inertialBetaOffset) < BABYLON.Engine.Epsilon) this.inertialBetaOffset = 0; if (Math.abs(this.inertialRadiusOffset) < BABYLON.Engine.Epsilon) this.inertialRadiusOffset = 0; } // Panning inertia if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) { if (!this._localDirection) { this._localDirection = BABYLON.Vector3.Zero(); this._transformedDirection = BABYLON.Vector3.Zero(); } this.inertialPanningX *= this.inertia * inertiaFactor; this.inertialPanningY *= this.inertia * inertiaFactor; if (Math.abs(this.inertialPanningX) < BABYLON.Engine.Epsilon) this.inertialPanningX = 0; if (Math.abs(this.inertialPanningY) < BABYLON.Engine.Epsilon) this.inertialPanningY = 0; this._localDirection.copyFromFloats(this.inertialPanningX / inertiaFactor, this.inertialPanningY / inertiaFactor, 0); this._viewMatrix.invertToRef(this._cameraTransformMatrix); BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection); this.target.addInPlace(this._transformedDirection); } It rotates by the given inertia amount depending on the time that proceeded during the renderings. The var engineDelta = Math.min(this.getEngine().deltaTime,100) is to avoid big camera jumps on frames that last longer than 100ms. In our project the render loop doesn't run continuesly. If someone likes to test this and/or push it into babylon I would be glad to have contributed a small thing :-) If not it's also completely okay as it's only needed in our project(s)! ;-) Best regards Kevin
  14. Hi guys, I'm having a specific issue and I'm looking for some help. I have a big image which I hide at game start. Later on I revive this image to display it. The very first time I do this, it provokes a big jitter, but further attempts provoke no lag at all. So I think it has to do with the fact that at game start the image has never been rendered, and once I render it for the first time, some kind of 'render-loading' might happen and provoke the jitter. For the time being I create the sprite, add it to the game, and then immediately kill it (so that the player doesn't see it). So it's never been rendered (hence the jitter later on). Is there a way for me for do the same thing AND load the texture to the renderer as well, preventing the jitter happening later? Sorry if it makes little sense, I don't know canvas rendering enough to point exactly why the jitter happens. But I assume the images must be somehow transferred from the cache to the renderer, or something like that. Is there any way to force it (and still not display the image)? (Just to confirm my hint, If I do render the image at start, even briefly, and kill it, the next revive won't jitter at all. Also, all I do is use game.add.sprite(), kill() and revive(), if it helps). Thanks a lot!
  15. I've been trying to work out how to set the frame rate for a MovieClip animation. I assume this is where the animationSpeed property comes in, but the API documentation is rather vague: What does this mean in terms of frames per second? If I want an animation to play at, say, 15 FPS, what value should the animationSpeed property be?
  16. Hi, I am having an issue with latest version of BabylonJS (beta version), when loading a page with clean cache the FPS displayed by getFPS stays at 60 fps during 58 frames (seems a constant), meaning that the sceneOptimizers can't get triggered if the FPS is too low (timer gets to 0 before being able to run the optimizer).
  17. Hi All, In my game i am having a emitter which execute when user tap on the object. The emitter is slow in low level android phones. So I am planning to check the fps. If fps < 30 then don't show the emitter ELSE show the emitter. I am going to use the below line in create function so that Phaser will calculate the fps. me.game.time.advancedTiming = true; Will it reduce the performance of the game, because only when the advancedTiming property is set to true Phaser starts calculating fps, which is an additional work for Phaser. Thanks for your help. Joseph
  18. Hello ! There is a free complete course by Victor Mallet. It is about how to create a basic FPS : https://openclassrooms.com/courses/creez-votre-propre-fps-en-webgl It is in french but with a translator, you may understand : https://translate.google.com/translate?hl=en&sl=fr&tl=en&u=https%3A%2F%2Fopenclassrooms.com%2Fcourses%2Fcreez-votre-propre-fps-en-webgl
  19. My Phaser (v2.6.2) game runs great at 60fps on my iPhone 6S. But then I tested it on a regular 6 and was shocked to see 20fps. I took everything out until nothing was left but an empty scene and it is still just 30fps on iPhone 6 and 10fps on iPad Mini 1. The code below outputs: In Safari on iPad Mini 1 iOS 8.2 -> webgl: true fps: 20 In Safari on iPhone 6 iOS 9.3 -> webgl: true fps: 30 (I even checked this on two different iPhone 6 because I couldn't believe my eyes) In Safari on iPhone 6S iOS 10 -> webgl: true fps: 60 The performance cannot possibly be this bad can it? iPhone 6 is still a modern device. But what could be wrong with my code below? For comparison I also quickly googled html5 game engine and set up a basic scene with Panda JS that just sets the renderer to WebGL and prints out fps and it was running at 60 on all 3 devices listed above. So I think I can rule out device and it must be something down to the Phaser engine, or the way that I am using the Phaser engine. <!doctype html> <html> <head> <script src="./build/phaser.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <script type="text/javascript"> window.onload = function() { var game = new Phaser.Game(360, 640, Phaser.AUTO, '', { init: init, render: render }); function init() { game.time.advancedTiming = true; } function render() { game.debug.text("webgl: " + (game.renderType === Phaser.WEBGL) + " fps: " + game.time.fps, 32, 32); } }; </script> </body> </html>
  20. On certain computers, ones that wouldn't seem like they should lag, movement in my game is slow. When using `game.time.desiredFps = 30;` it also happens. My question is, how can I drop frames instead of making players swim through mud? Instead of looking ugly, it becomes unplayable. I tested this for p2, it also happens with that physics engine.
  21. Hello I am trying to develop a FPS using BabylonJS and CannonJS in TypeScript. My first problem was what type of Impostor to use as the player, end up using a Cylinder with a FixedRotation = true. Now I place the camera on top off the Cylinder on every frame, and apply Impulses to the Cylinder based on keyboard input, and camera target. The algorithm that I came up is the flowing (hero = Cylinder): scene.registerBeforeRender(function () { //Your code here //Step camera.position.x = hero.position.x; camera.position.y = hero.position.y + 1.0; camera.position.z = hero.position.z; let camFront = camera.getFrontPosition(1.0); let vecFront = camFront.subtract(camera.position); vecFront.normalize(); let finalVector = new BABYLON.Vector3(0.0, 0.0, 0.0); if (moveForward) { finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecFront.x, 0.0, 1.0 * vecFront.z)); } if (moveBackward) { finalVector = finalVector.add(new BABYLON.Vector3(-1.0 * vecFront.x, 0.0, -1.0 * vecFront.z)); } if (moveRight) { let q = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(90)); let m = new BABYLON.Matrix(); q.toRotationMatrix(m); let vecRight = BABYLON.Vector3.TransformCoordinates(vecFront, m); vecRight.normalize(); finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecRight.x, 0.0, 1.0 * vecRight.z)); } if (moveLeft) { let q = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(-90)); let m = new BABYLON.Matrix(); q.toRotationMatrix(m); let vecLeft = BABYLON.Vector3.TransformCoordinates(vecFront, m); vecLeft.normalize(); finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecLeft.x, 0.0, 1.0 * vecLeft.z)); } finalVector = finalVector.normalize(); hero.physicsImpostor.applyImpulse(new BABYLON.Vector3(15.0 * finalVector.x, 0.0, 15.0 * finalVector.z), hero.getAbsolutePosition()); }); Is there a more effective way to do this ? Thanks in advance.
  22. Hello I have submit a question in the Questions & Answers sections: But I my problem is not in decode but in the BABYLON.JS Resume: The control works but the problem is that the camera/hero doesn't go straight forward all the time. Example if at start I point at the Box at the top left if and only press 'W' it goes straight to the Box, but if I for example go straight 'W' for 1-5 seconds and then point at the Box and press 'W' the camera/hero doesn't go straight to the BOX, it goes sides ways. Can anyone please check this out ?
  23. Hi everyone: I want to know how to limit the FPS that Bjs render. I'm newbie in this framework and i don't understand how to use the SceneOptimizer helper. Any simple sample to do this? Many thanks in advance.
  24. Hello everybody, I'm doing a little game plateform for fun and for the ground management and for more speed, I wondered if was worth better not use (for optimization) : - Tilemap : But I feel that after a certain number of box it starts to slow down... (and i can use player.body.blocked.down to know il player is landing) OR - Objects that define the ground and far fewer (but i loose player.body.blocked.down to know il player is landing) And that's make -> And all mixed -> I manage this with tiled like that -> What is the best practice to design ground and manage ground collision to keep a max of fps ? thank for help and this great forum Here the sources.zip
  25. I want to clamp to 30 fps. Not some animation, but the whole rendering. How could I do that?