Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Apps in 108 using much more CPU than 107

Author
Message
Grumpy Jedi
14
Years of Service
User Offline
Joined: 16th Jan 2010
Location:
Posted: 23rd Mar 2013 21:21
I've been using 1075 until now. When comparing the difference in CPU usage on apps compiled between the versions I'm noticing a huge spike CPU usage in 1089.

With SetSyncRate(60,0) - programs that used 2% to 5% CPU in 1075 are using 18% to 20% CPU (quad core) in 1089.

If SetSyncRate is changed to (30,0) in 1089 the CPU usage drops back to the 2% to 5% range as it was in 1075. Unfortunately physics objects don't move smoothly with a setting of (30,0) like they do at (60,0).

Has something changed with SetSyncRate when using (60,0) in 1089 that would cause the spike in CPU usage?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Mar 2013 22:37
SetSyncRate(60,0) is now a special case on Windows that attempts to use VSync instead of the normal AppGameKit timing as this results in a smoother experience, but I don't know why it would be using up CPU. A quick test on Windows 7 has low CPU usage with SetSyncRate(60,0).
Grumpy Jedi
14
Years of Service
User Offline
Joined: 16th Jan 2010
Location:
Posted: 23rd Mar 2013 23:20
I was using an XP machine if that makes any difference...

When you say it's a special case on windows does that mean everything remains the same for apps on iOS?

I tried disabling the busiest part of my app that handles all the physics objects and the CPU usage dropped substantially without them in play. However with all the physics objects turned off in 1089 the CPU usage was still above what it was in 1075 with all of them turned on.

Another thing I noticed was that turning off a wav file I had looping dropped the CPU substantially. The physics section of my code does play some wav files so I wonder if it's something in the sound playback.

I'll run some tests with just sounds playing and just physics objects and see if I can't narrow down the cause.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Mar 2013 23:36
Quote: "does that mean everything remains the same for apps on iOS?"


Yes

Quote: "I'll run some tests with just sounds playing and just physics objects and see if I can't narrow down the cause."


If you can create a small example project that shows the problem, email it to me or post it here and I'll take a look
Grumpy Jedi
14
Years of Service
User Offline
Joined: 16th Jan 2010
Location:
Posted: 24th Mar 2013 00:26 Edited at: 24th Mar 2013 00:27
I just ran some tests on my app.

I've narrowed down the problem to the playback of wav files but only with the SyncRate set to (60,0).

If the SyncRate is set to (30,0) the problem does not exist.

Even setting the SyncRate to (60,0) with no sounds playing has an effect on the CPU usage, but when the sounds start playing it really spikes.

I made this code for you to try out, you'll need a couple of sound effects to use named Sound1.wav and Sound2.wav


if you set the syncrate to (60,0) (up arrow) and toggle sounds on (spacebar) you should see a big spike in CPU usage. If you turn the sounds off, or use a (30,0) SyncRate you should see the drop in CPU usage.





I saw you answered my question about the GameCenter commands in the sticky thread.

Quote: "They work, but only if your app is set up in iTunes Connect to use Game Center. They will get help entries once we update the help files, but you just call GameCenterSetup then GameCenterLogin and you can call the other commands as needed."


Will the help files be coming soon or is there anywhere I can find a list of all the GameCenter commands and the parameters they take in the beta files?
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 26th Mar 2013 14:22
Following this thread, as I have notice this as well.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 26th Mar 2013 15:22
Quote: "if you set the syncrate to (60,0) (up arrow) and toggle sounds on (spacebar) you should see a big spike in CPU usage"


Unfortunately I can't replicate this, I used the attached sound for both, but the CPU never went above 2-3%

Quote: " is there anywhere I can find a list of all the GameCenter commands and the parameters they take"


Here is the list of game center commands

Attachments

Login to view attachments
Grumpy Jedi
14
Years of Service
User Offline
Joined: 16th Jan 2010
Location:
Posted: 26th Mar 2013 17:38 Edited at: 26th Mar 2013 17:51
I ran some more tests and this is what I've found.

I tested on my Win 7 machine, and the Win 7 machine did not reproduce the increased CPU usage.

The problem apparently only exists on an XP machine.

Also, when the app is run in full screen, the CPU usage increase is more pronounced than when the app is run windowed.

The CPU usage increase on XP is 5 to 7 times (windowed vs fullscreen) normal.

EDIT: Your sound file reproduces the problem exactly the same as the ones I used.

Thanks for the list of Game Center commands! They look pretty self explanatory, though I'm not positive what GameCenterExists() is for, and hmm AchievmentsReset, why would anyone want to wipe out their achievements
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 26th Mar 2013 22:06
I just tested it in a virtual machine running XP SP2 and couldn't replicate the issue. It occasionally peaked to 10% but always returned to near 0% at both sync rates.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 27th Mar 2013 08:55
I suspect that this is highly dependent on the video hardware and drivers.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 27th Mar 2013 15:02
Quote: "I'm not positive what GameCenterExists() is for"

It returns 1 if the current platform supports GameCenter, this will only return 1 on iOS.

Login to post a reply

Server time is: 2024-05-07 19:33:37
Your offset time is: 2024-05-07 19:33:37