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 / Why is GetPointerPressed() that slow?

Author
Message
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 29th Sep 2011 21:28
Is there a way to speedup the GetPointerPressed() command in any way?
I use it in my IPad project but I need to hold the finger for about a
second until it gets recognized.

The game itself runs at full speed (same as on Windows) so it seems
that there's a delay in the Pointer commands.

Any ideas or experiences with that?

Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 29th Sep 2011 21:46
I do experience the same on my iPad.

iOS Apps from Trisect Development.
Click here.
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 29th Sep 2011 22:00
Which XCode and Base SDK version do you use to compile the AppGameKit player? Currently I upgraded XCode to 4.0.2 with Base SDK 4.3.

Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 29th Sep 2011 22:41
I use the same as you

iOS Apps from Trisect Development.
Click here.
Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 30th Sep 2011 00:18
For me its like the GetPointerPressed gets slower and slower the longer I play my game

iOS Apps from Trisect Development.
Click here.
Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 30th Sep 2011 19:22
My hole game get slower and slower on my iPad.
Could it be the player?

iOS Apps from Trisect Development.
Click here.
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 30th Sep 2011 20:18
I changed some code and now it's a bit faster but not optimal.

Before it was like that:



Then I changed it to something like that:




Now it's better then before but it seems that there's still some delay in detecting a touch event.

Then I updated to current XCode 4.1 and it also seems to be a bit faster.

Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 30th Sep 2011 20:52
I don't know anything about AGK. But maybe you could just hold a variable that contains the GetPointerReleased() its return.

So...

bool screentouched = (bool)GetPointerReleased();

...at the beginning of your loop code.

And after that you just check that each time when you need it.

if(screentouched == true)
{
// do stuff
} else {
// do other stuff
}
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 30th Sep 2011 21:20
RedEye the problem seems related to Tier1 not to Tier2 c++
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 30th Sep 2011 21:29
@Hubdule: You overdoing it with the GetPointerReleased calls. You are calling it 3 times in every frame. That could be 3 times in 16 milliseconds. Overkill! One call for each frame should be enough!
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 30th Sep 2011 22:15
@MikeHart

I know that it's not the best way to do it and to me it really looks wrong but when I call it only once a frame then it doesn't feel "right" as it takes up to one second until the "touch" event got recognized.

When calling it more then one time, then it seems like it's faster. So I'll try it with different methods and test, what "feels" best

Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 30th Sep 2011 22:21
Hubdule:

I'll be waiting to see if you find the solution.
And I'll try myself to see if I can speed things up.

iOS Apps from Trisect Development.
Click here.
XanthorXIII
AGK Gold Backer
13
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 30th Sep 2011 23:56
File it as a bug if you haven't yet.
http://code.google.com/p/agk/issues/list
I haven't been able to test yet on iPod Touch although I'm getting to a point to where I will be doing that soon.
Trisect Development
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 2nd Oct 2011 21:03 Edited at: 2nd Oct 2011 21:41
I tried to optimize my code but it did not help.
When I print the FPS it starts with 30 and slowly drops down to below 10. Proberly lower but I stopped it.

The game I'm working on is a memory game.
What I do is show a grid with 10x10 sprites.
Each loop I check for keypress and if keypressed then I change the pressed sprite with SetSpriteImage.

But for each keypressed it gets slower and slower.

Any idea why?
[Edit]
I think I'm onto something.
I print the GetManagedSpriteCount every loop and it is increasing for each loop. So proberly something wrong with my code somewhere.
[/Edit]

[Solved]
I found out that every time I did redraw my 10x10 grid I did a CreateSprite instead of SetSpriteImage and it added a 100 new sprits every time I called my keypressed routine.
But now it sloved and my game is fast again.
[/Solved]

iOS Apps from Trisect Development.
Click here.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Oct 2011 04:17
Phew, thought we had a problem with the input code there If anyone else experiences a slow GetPointerPressed command, please write a small peice of code and what you expect it to do so we can all compile and run to see what we get on our systems.

I drink tea, and in my spare time I write software.
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 10th Oct 2011 09:31
I found the "error" The problem was that I tossed to many sprites on the IPad. So the whole thing slowed down a bit and the GetPointerReleased() seemed to be slow on detecting touches. But this wasn't the case as soon as I changed the project in the main loop where now every second cycle most of the drawing takes place. Now it works as expected! Perfect on IPod and IPad.

Login to post a reply

Server time is: 2024-11-22 02:32:17
Your offset time is: 2024-11-22 02:32:17