Performace Problems, physics game.
mandre96

Hello,I'm making an angry birds like game for an university work and I'm struggling with performace issues.In the editor,runs amazingly well.In my PC via mozila it runs smooth,but not as well as in the editor.But my PC is pretty dam good, and when i tryed in other PCs it peforms badly.I know its an very specific problem and it is not possible to solve without having acess to my project itself but what I need its some tips, since I'm not an experienced programmer.Some questions:

◘Does opacity, fade in and out brings the performace down?

◘Does camera movement?Continuous collision detection(bullet=>true)?

◘Does the minimun size?

◘The number of Weblgl layers?

 

If you guys have any tips,I would be immensely grateful.

Marcos Andre.

 

All 3 Comments
foxcode

I dont think you should be having any performance issues making an angry birds like game. We made one ourselves on youtube and didn't have any issues with performance at all.

Without seeing your code it's difficult to say what could be causing the issues. If you like, you could download your code from the editor, and email it as an attachment to clockworkchilli@gmail.com and I could have a look for anything obvious.

Alternatively there are some basic things you could check.

  • If you are drawing large images, try to avoid moving them if possible once drawn. If the image is not moved, it does not have to be redrrawn, this can make a big difference
  • Remove any console logs you may have in update functions as this can slow things down a little

 

Most modern pc's have ample cpu power to run whatever you are likely to make with WADE. I Think it's more likey to be a rendering issue, trying to draw too many pixels too often. Perhaps Gio can be of more help, this is really his area

Gio

◘Does opacity, fade in and out brings the performace down?

No

◘Does camera movement?Continuous collision detection(bullet=>true)?

Camera movement yes slightly, because if forces a full redraw. It depends on how many things are visible on the screeen while the camera moves. If it's hundreds of sprites, it will be a noticeable performance hit, but still something that you can overcome (see below about using a texture atlas).
Continuous collision detection yes, that is expensive, you should only use it on a few objects at a time. Don't use it on every single physics object.

◘Does the minimun size?

It really depends on whether the bottleneck is simulation or rendering. If it's simulation, reducing the screen size will do nothing. If it's rendering, it may improve performance a bit.

◘The number of Weblgl layers?

Yes and no. If you set up your layers properly (e.g. separate moving object from non-moving objects putting them on different layers), having more layers can actually improve the performance of your app. If it's not done properly, it will slow things down. It's a double-edged sword.

 

Generally, I would recommend using a 2d layer for things such as a static background that does not move, and a webgl layer where you have lots of moving objects. You may want to use a texture atlas on the webgl layer to speed things up.

The main thing though, is to do some profiling to understand what part is being slow. Here's a quick tutorial. This is the first thing you should do to have a better understanding of what's going on. It may be that there's just a simple thing that you can change to speed things up significantly.

mandre96

FoxCode and Gio,I will be sending the code.Right now I'm translating to english since I live in Brazil and the code is commented in portuguese.I'm doing with some friends or an integrated work for the university we study.We gonna make an mobile Tamagotchi game.It will have 3 minigames:a doodle jump, an candy crush and an angry birds like game.I was in charge of the angry birds game.Since I liked soo much this new framework/javascript editor i choosed wade to do my part of the project.My other friends decided to go with pure javascript.My friends are pretty advanced in their works,but i'm still strugling with some bugs.They criticized my choice but I decided to give it a go,and now, I'm pretty much in the end of a prototype, but the deadline is close and I'm still strugling with some bugs.The are charging my part saying I'm taking too long to finsih such an "ordinary" game.So I will tell some things that I encountered and will be sending the code right away.

 

◘The onCollision,onPreCollision and OnUpdate are not working when called in app.js or when coding an behavior.I think you guys could check that out.

◘My game is pretty dam simple, but if I do not compile an exe, it struggles with performace(When I run in mozila for example).I tested the apk and i have the same performace issue.I will be honest,I'm really nervous and desperate about this, because, as my friends will integrate all of our projects, and then compile to an APK with XDK, and, to present for our professors,will be in an HTML form,My game must work via html!

◘Another very odd problem is when the game is over, I have an restart button.The button clears the scene and then calls the wade.app.init().It should work fine, but when it recals the init function, the physics is not inicialized properly.Some collision boxes are not inicialized and ,sometimes,no physics at all is inicialized.

 

 

I will correct the error of behaviors , translate some comments(I'm brazillian!),try some performace improves, and will be sending the game.Since I'm not an experienced programmer I ask understanding as to the possible code errors , but I do believe there are not many of them, since I already spent countless hours reviewing the code and already watched all the tutorials already posted by the clockworkchili.If you guys can help me and change some things please feel free to do so.You guys have no idea how immensely grateful I will be to you.I really hope this framework grows and be more widely spread and used for game developers.In the next couple hours I will be sending the Code.

 

 

 
 
With immense gratitude,Marcos Andre.
Post a reply
Add Attachment
Submit Reply
Login to Reply