I am writing a game in SceneKit, and it is divided into levels. Each level uses different basic shapes (the ones that come in Xcode/SceneKit as default, found in the object library) as "obstacles" that the player must avoid. So level one has blocks as obstacles and runs at 60 FPS on iPhone 6 and a below, yet when the player plays level two, which uses Pyramids as obstacles, the FPS drops to 10. There are less than 500 nodes in each level. It runs at 60 FPS on iPhone 8. What is occurring and how can it be fixed?
Here is a youtube link that displays how they are being used in the game. It is run on an iPhone 8 Plus and has no FPS issues; however, if run on an iPhone 5s or lower the frame-rate drops very low for the first level, but not the second.
This link provides it with statistics running. WaitDrawable takes up a big portion.
Here are images of the wireframes, with and without materials.
The issue was that Physics was being called on every frame, then performing some logic. The player was hitting the floor, used to center the block, every frame. I changed the contact bit mask and all the issues went away.
Related
Currently, I’m trying to create a game in swift’s SpriteKit, and I’m trying to give it a smoother framerate than it has currently. Right now, whenever I, say, press a button, the framerate suddenly jumps to a much lower value, causing the player sprite (whose movement is based on a value multiplied by a deltaTime value) to suddenly jump forward. Is there any way to smooth the framerate such that the changes in framerate aren’t so sudden and drastic?
Code running in the simulator isn't a good test of the graphics performance of a Sprite-Kit (or Scene Kit) application.
This is because SK will, in order to perform certain graphics effects, utilise calls to the specific graphics hardware available in an iOS device whereas in the simulator, these calls will need to be emulated in software by the host machine, causing a reduction in graphics performance (some operations will be affected a lot, other less so), even if the underlying graphics card in the host machine is nominally more powerful that the one in the iOS device.
Simulator testing is good for testing functionality, and it can give an indication of performance. For example, an application that was running OK in the simulator suddenly starts performing poorly after a change. Checking the displayed 'draw count' shows that the number of 'draws' required to render the scene has increased, possibly causing the slowdown. Or conversely, a change may lead to an increase in performance and a reduction in draw count.
However, the only way to be sure is to test the application of a real device.
I am working on roulette(Casino Style game) game project in Unity3D.
I am rotating a ball around a wheel and wheel is also rotating on its own axis in fixed update.
I am using transform.RotateAround function to rotate the ball around the wheel and i am also decreasing ball's speed in fixed update.I am assigning a random initial speed to ball within a range such that it always stops on different position each time .
For testing purpose i kept the initial ball speed to constant and check it in unity editor such that every time it rotates it always stops on the same number.
I build this project to android and PC .Though the ball stops on the same number each time in both android and PC build but the result is different in both of them.
For example- Every time ball rotates it stops on number 8 in android and number 20 on Pc each time.
Can somebody please suggest me some ways to obtain same result on different devices?
Why it is happening? Is unity physics behaviour is different in different processor?
and please explain me how to fix that .
Unity has a fixed time step, so that isn't the cause of the differences as one might expect. Physics simulations are incredibly complex things, so I'm not going to pretend that I know exactly why you're seeing differences. However, I would imagine it is to do with floating point precision differences between your computer and a much smaller phone processor.
One way to test this would be to run the simulation on another computer, and compare the results to the both of your current devices.
I'm using Unity3D 5.3 version. I'm working on a 2D "Endless running" game. It's working normally on PC. But when I compile it to my phone, all of my gameobjects are shaking when they are moving. Gameobjects are in a respawn loop. I'm increasing my Camera's transform position x. So when my camera is in action, all of the other objects look like they are shaking a lot and my game is working slowly on my phone as a result. I tried to play my game at Samsung, on discovery phones. It's working normally on some of them. But even on some Samsung devices it's still shaking. So i don't understand what the problem is. Can you help me with this?
One thing you can do is start optimising, if you have a game that is either finished or close to it. If you open the profiler, click "Deep Profile" and then run it in the editor on your PC, you'll get a very detailed breakdown of what is using the most resources within your game. Generally it's something like draw calls or the physics engine doing unnecessary work.
Another thing that might help is to use Time.deltaTime, if you aren't already. If the script that increases the transform doesn't multiply the increase by Time.deltaTime, then you're moving your camera by an amount per frame rather than per second, which means that if you have any framerate drops for any reason, the camera will move a smaller distance and that could be throwing out some of your other calculations. Using Time.deltaTime won't improve your framerate, but it will make your game framerate independant, which is very important.
I have a problem with fps while using particles. In game I have coins which uses particles.
I have tested my application on iPhone 3gs, 4, 4s, 5 and on iPad 3. FPS goes down to 30-35 on 3GS and iPhone 4. But when I stop using particles FPS goes to 50-60.
I used also CCParticleBatchNode but didn't help :(
The code I used with batchNode:
CCParticleBatchNode *batchNodeParticle = [CCParticleBatchNode batchNodeWithFile:#"image.png"];
CCParticleSystemQuad *particles = [CCParticleSystemQuad particleWithFile:#"particles.plist"];
[batchNodeParticle addChild:particles];
[self addChild:batchNodeParticle];
Any suggestions?
Thanks and sorry for bad english.
Particle effects are very easy to use performance killers. Here are a few suggestions:
Reduce the number of particles. Usually one is tempted to start out with far too many particles. Anything above 100 should make you feel uneasy, anything above 250 should cause a mild panic attack.
Multiple particle effects running at the same time multiply the number of particles. 10 particle effects with 100 particles are just as bad performance-wise as a single particle effect with 1000 particles.
Don't use overly large textures. Most particles look fine with a 64x64 texture or even less.
There's no real need to provide a -hd version of the particle effect. Particles get scaled up on Retina devices and look the same automatically. The only benefit from using -hd particles is using higher resolution textures, which in 99% won't make any visual difference on Retina devices. This is because most particle effects are somewhat blurry in nature to begin with.
Particle batching only improves performance if you add multiple particle effects (using the same texture) to the same particle batch node.
In the Andengine "A Moving Ball" example, I experience a "jump" in the animation every 5 seconds or so ie. The lateral movement is not always smooth, it seems to skip a few pixels. I'm running this on a Samsung Galaxy SII. I also noticed this on the emulator.
A Moving Ball example
This is a problem for me as I'm creating an environment of ten bouncing balls and every few seconds I get this judder effect.
I'm looking for a very consistent movement, similar to say the baloons in "Crazy Pill":
Crazy Pill
Has anyone noticed this occassional lag or any idea how to create a smooth movement?
Thanks
see if this discussion and solution helps
Jittering texture when using BoundCamera