Discussion about game on mobile

Discussion and feedback on Construct 2

Post » Fri Dec 07, 2012 1:41 am

I've been seeing pretty decent results using preview on lan on my iPad 2. Between 30-35 frames per second. I had done some preliminary testing with xcode back when I started the project and everything seemed to be running well. I was actually expecting even better performance once I compiled out to a mobile device.

Well this last week I started compiling with xcode only to discover that my project is only running at 3-4 fps once compiled. It runs the same in the simulator. What really gets me is that I can open the exported project directly on my Mac and I get a whopping 67fps.

I've tried both phonegap and building a project from scratch using uiwebview. Both gave about the same results.


Updated info below!!! 12-9-2012
Thunder2012-12-10 05:55:12
B
5
S
2
G
5
Posts: 26
Reputation: 2,987

Post » Fri Dec 07, 2012 4:02 am

@Thunder I dont understand?you compile your game with which compiler?

You mean, preview on Lan ->30-35fps
Compiled game on ipad 2 ->3-4fps
compiled game run on pc simulator ->3-4fps
game run on Mac ->67fps?

P.S.:I always find testing in cocoonjs launcher more accurate than preview on Lan.
B
12
S
4
G
4
Posts: 64
Reputation: 4,014

Post » Fri Dec 07, 2012 6:45 pm

Phonegap has no hardware acceleration, so it's unsurprising that the performance was so bad. Try cocoonjs or appmobi's direct canvas instead.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Fri Dec 07, 2012 7:28 pm

[QUOTE=PixelPalette]
1. If you are using cocoonjs, do not use too many tiled backgrounds! After trial and error, i found out that was the biggest performance hinder. Not sure if CocoonJS needs to optimize tiled backgrounds.
[/QUOTE]

Glad to see someone else has this problem too. I hope they get it fixed soon, I'm still using Sprites where Tiled Backgrounds would be much more efficient because it reduced my FPS.
B
19
S
5
G
1
Posts: 104
Reputation: 2,920

Post » Sun Dec 09, 2012 1:25 am

@ZhaoYun

I was using xcode on a Mac to compile for iOS. The fps numbers in your reply are what I'm seeing.

@Arima

Yeah I knew that Phonegap doesn't use any hardware acceleration. After doing some research I found that xcode doesn't have access to Nitro JavaScript like the standard Safari does. So you will see a performance difference over a compiled app versus a web app that runs in a browser. You won't see the benefits of Nitro in a compiled app that uses uiwebview.

I did some testing with the CocoonJS Launcher app and seen improvement in speed. But unfortunately I've went from 3-4 fps to 14-20 fps, which is still to slow to be playable.

This isn't the first game I've ever created, and don't think I'm doing anything unusual. I guess the first game I ever modded was Doom running under Dos. Back when Windows was just a business program that you started from the command prompt.

I've tried to keep everything optimized, graphics, audio, and code. My current Cocoon export is around 8 megabytes.

Updated info below!!! 12-9-2012Thunder2012-12-10 05:55:57
B
5
S
2
G
5
Posts: 26
Reputation: 2,987

Post » Mon Dec 10, 2012 5:56 am

After doing some more testing with the CocoonJs Launcher I think I've found what was causing most of my slow speeds. It had to do with using a random time. I like using random events but they were killing performance on mobile. I was using both a "wait random(30,60)" and a "every random(30,60)". I only had a few events set up to use random times. Removing the random expressions completely, or setting the events to only fire at certain times solves most of my slow speeds. I still have some more optimizations to do. But now I've been seeing the frames per second running up in the 60's with CocoonJS. A pretty big increase in performance to say the least.

If anyone has any interest in exporting to iOS I strongly recommend the CocoonJS Launcher. It is a fantastic tool for testing! The app itself is really well designed and makes it so easy to test right on the device. Don't think about it, just install it.


@Ashley

The CocoonJS launcher gives me an unrelated error message in the log file. It doesn't seem to effect performance or functionality in game that I've noticed. I didn't know if this message would be anything you'd want to know about or not. Here's the error message.


JSUtilities Exception: TypeError: 'undefined' is not a function (evaluating 'caf(this.raf_id)') Line: 1219 File: ? Tag: onsuspended


I did a small test after looking around in the exported c2runtime.js and found that by removing the following two lines the error no longer reports to the log. Just thought you'd like to have the info of where the error is located.


if (this.raf_id !== 0)
caf(this.raf_id);
B
5
S
2
G
5
Posts: 26
Reputation: 2,987

Post » Mon Dec 10, 2012 6:31 am

Huh, interesting about the random hitting the performance. Thanks for the info.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Mon Dec 10, 2012 10:01 am

@Thunder
Thanks for sharing such crucial information. I use "random time" in my minigame too,tonight I shall try it out!
B
12
S
4
G
4
Posts: 64
Reputation: 4,014

Post » Mon Dec 10, 2012 5:05 pm

@Thunder
Well, my random(0.5,1)second has no cost on my performance. I just deleted them and the performance has not changed.
B
12
S
4
G
4
Posts: 64
Reputation: 4,014

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests