I'm a few hours into writing my first game and I've come across an issue that I can't figure out. It's a very simple game, the interface is comprised mostly of custom canvas progress bars - no open gl or anything like that. I'm using a timer set to 40ms that runs two methods, one to update the game, and one to update the interface. All was going well, until I tried watching a video whilst debugging and my performance went through the floor. The rest of my computer still runs fine, but bars that should take a second to fill (and do when no video is running) are taking as long as 4 seconds to fill instead.

I read that the timer steps are influenced by the stress on your computer, but it's so bad that I'm guessing I must be doing something wrong. I've tried adjusting the timer interval but it doesn't seem to make a difference... I'm stumped!

2) you said 40ms.... are you sure the work being intiated by the timer firing is complete by the time it fires again? As an experiment, increase the timer period, and see what the result it.

3) I found that using progressbars (the actual control), that they are "expensive" to update frequently (if you are going from say 0 to 10,000 .... DON'T refresh it every single interval... divide it into intervals where each interval is at least 2 pixels of the width of your progress bar .. (personallly I just use 5% of the width.. ie. update it 20x max)

_________________Dave SisemoreiMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1Note : I am not interested in any solutions that involve custom Plug-ins of any kind

Thanks again for replying. Sorry I didn't realise how vague I was being!

The problem occurs when I watch an external video in my browser, although any kind of outside CPU usage seems to have a detrimental effect to the run speed. It's also quite inconsistent - when under stress, the update speeds surge and slow resulting in very jumpy animations.

I am using a custom progress bar class that uses a value between 0 and 100 for the drawing. When the timer fires, it calls the UpdateModel method which updates all the game values (about 40 lines of code) and then the UpdateInterface method which updates the values of all the progress bars and then calls refresh on each of them, not Invalidate (not heard of this before). The interface method is only 20 lines of code.

I considered that maybe I was asking too much in such a short time frame (40ms) but I figured this couldn't be the case as when the debug/app is the only thing running, I get good performance.

I hope this information is more helpful, if needed I can post some code and/or a video in the morning.

I went into my UpdateInterface method, command-f to find 'refresh' and replace all with 'invalidate', clicked run and problem solved... this baby is running like a dream! Thanks Dave you've cracked it for me! I was starting to think maybe RB was a bad choice for my game (as basic as it is) but you've just blown this thing wide open!