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.

Newcomers AppGameKit Corner / [SOLVED] Performance on android when using broadcasting sluggish

Author
Message
Richard Stevens
4
Years of Service
User Offline
Joined: 14th Jan 2020
Location:
Posted: 4th Aug 2020 22:23
Hi

I'm writing a little game that's quite trig heavy (lots of square routes and atan2's every frame), but runs very comfortably at 60fps on my laptop (processor around 5% utliised)

When I run it on android, by broadcasting it, it still says it runs at 60fps (I have print screenfps() running) but it looks very choppy.. like it's running at 20fps or something.

Any idea why that would be?

Thanks.

The author of this post has marked a post as an answer.

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Aug 2020 22:49
Does that happen intermittently or constantly?
Richard Stevens
4
Years of Service
User Offline
Joined: 14th Jan 2020
Location:
Posted: 5th Aug 2020 00:10
It's constant.
Richard Stevens
4
Years of Service
User Offline
Joined: 14th Jan 2020
Location:
Posted: 5th Aug 2020 01:47
ahh.. hang on. I think it may be something to do with the 'jitteriness' of the accelerometer on my phone. Sorry false alert!.. some smoothing required.
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 6th Aug 2020 16:05
if you are worried about the square roots you can multiply the other value by itself to remove the need for the square root.
i.e. if you are checking a squared value is closer than a certain distance you can just do it like
if sqrt(x) < y then
becomes
if x < y*y then

this is faster on the cpu but honestly i've never seen an actual use case where the sqrt slows down the process more than the graphical side of things already does
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu
Richard Stevens
4
Years of Service
User Offline
Joined: 14th Jan 2020
Location:
Posted: 6th Aug 2020 16:16 Edited at: 6th Aug 2020 16:19
Thanks SG. In this case I need to know the distance as I'm doing some funky rotational/repositioning stuff relative to the player, that needs me to store the distance... but that's certainly one I'll stick in the memory bank for future optimisations.

My next task is finding a way of blitting a super fast 2d filled polygon/triangle .. don't suppose you happen to know of one? I don't think sprites quite fit the bill in this case. I need 200 or so in real time 60fps.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 6th Aug 2020 22:08
Quote: "Thanks SG."

it's pronounced "g" (i couldn't resist )
[AGK Resource Directory] | [TGC @ GitHub]
[My Itch.io Home]
[CODE lang=AGK] Your Code Here [/CODE]
[VIDEO=youtube] VideoID [/VIDEO]
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 6th Aug 2020 23:45
This post has been marked by the post author as the answer.
Cant say for AppGameKit but I was working on optimising a rather large project built in another language during lockdown, I had some lagging but the code was clean and I tracked it down to 2 calls to Mod() in a drawing loop, I changed my approach and bypassed the 2 calls and got lighting fast speeds so smallg has a point there, if you can code the math then do so because it does affect cpu cycles.

Quote: "it's pronounced "g" (i couldn't resist )"


You see the hood's been good to me
Ever since I was a lower-case G
But now I'm a big G, the girls see I got the money
Hundred dollar bills y'all....

Soz, that tune popped into my head soon as I read that and I couldn't resist lol

Login to post a reply

Server time is: 2024-11-23 08:10:04
Your offset time is: 2024-11-23 08:10:04