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 / Touch problem with GetRawTouchCurrentX()

Author
Message
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 29th Sep 2012 02:53
It seems GetRawTouchCurrentX() and GetRawTouchCurrentY() don't start reporting the correct position until you have moved by >10px.

I think it's because the touch type becomes "drag" and thus registers a new value. It doesn't matter how long I HOLD the position and start moving - the values don't change unless I'm 10px away from the origin.

Once the touch type becomes "drag" it's fine.

It's kind of confusing, because the AppGameKit joystick doesn't behave this way - it's instantly responsive to small movements, but try and do something similar yourself and you'll see the same.

Is this limited to android only?
This is on build 107 (which doesn't simulate touch screen with the mouse anymore on the PC) so this could just be a problem with the android player code.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 29th Sep 2012 09:57
It works fine for me, are you using unknown touch events?

integer GetRawFirstTouchEvent( bIncludeUnknown )

I find if I set it to one it reacts immediately...


this.mess = abs(sin(times#))
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 29th Sep 2012 13:57
I am getting the unknown touch events.

It might not be perceivable unless you show the difference between the event start x,y and the current x,y

No matter how carefully I move my finger initially, it jumps 10px on the first movement. Once it's moving though, all movements are
as expected.

Here is my function which also shows the distance travelled. The code needs a UDT for the event info.



BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Sep 2012 23:12
Quote: "integer GetRawFirstTouchEvent( bIncludeUnknown )

I find if I set it to one it reacts immediately...
"


This does not work for me on Windows
I have to drag to get my touch event to register at all. I would add more but this feature is on hold for now, until I have more time to investigate. If anyone wants to post a test function I'll certainly contribute.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Sep 2012 23:33
On a Windows touch screen, you will get a lag. Even things that should just require a touch (GetPointerPressed()) actually require that you move your finger across the surface for it to register.

Have you tried your app on another device?

Cheers,
Ancient Lady
AGK Community Tester
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th Sep 2012 03:54
@Ancient Lady: Did you mean me or Batvink?
I don't have any other device (apart from iphone which I can't compile to yet)
I could make an apk for testing on other devices, but like I say, the AppGameKit joystick doesn't do this, so I don't think it's going to be lag on the device.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Sep 2012 06:31
nz0, both of you, based on similar bits in your posts.

Do you use touching on you screen with the joystick?

I avoid the virtual joystick because I don't think it will play well on an iPhone type device (very small).

Aside from that, the joystick is using different core code (that we don't have access to) from the generic touch functions.

I can only repeat that my experience with a Windows touch screen is very different from all the other platforms with built in touch handling.

Unless you plan on publishing only in Windows, in which case you don't want to use the touch commands, you will need at least one device in your target platform to test on. And you will need to have, at a minimum, a good Player for that device (some have been posted for Android, including me here, but for iOS you will need a Mac, Xcode and an Apple iOS Developer license to build your own Player (or try the TGC Player service).

Cheers,
Ancient Lady
AGK Community Tester

Attachments

Login to view attachments
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th Sep 2012 13:17
I dismissed the usability of the inbuilt AppGameKit joystick long ago.
However, with extra functionality, this method can be usable (e.g. grand theft auto)

I assume the default joystick is using different code than that which we are using; I refer to it to point out that the problem is unlikely to be the devices capability of reporting initial movement.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Sep 2012 13:57
Quote: "This does not work for me on Windows "

I'll see if Lee has made any changes for the Intel competition. He was using touch commands on W8...


this.mess = abs(sin(times#))
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th Sep 2012 14:32
Here is a fully working example (copy, paste, run) illustrating the issue.




BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Sep 2012 18:28
Quote: "I'll see if Lee has made any changes for the Intel competition. He was using touch commands on W8..."


Thanks, I saw he was touching and swiping gracefully. I can swipe but can't touch, although I have my own swipe function.

@nz0, I ran your code and it doesn't react at all for me. However, my touchscreen is extremely responsive in Windows (8) in general. My laptop processor is an Intel i7 so that may have a bearing on the Windows performance.

To quit the program, I had to swipe the quit button to get it to react.

nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 30th Sep 2012 22:56
@batvink: that doesn't sound good at all - you seem to have much more serious problems on windows touch, probably needs a thread of it's own?

After doing some more testing on my issue, it seems that I can get a reading (in rare cases) from 9.75 pixels of initial movement from origin.

Incidentally, I found more strange bugs in the IDE during this testing; in my first example earlier in the post,



shouldn't even compile (but it did in my main app) because TouchEvents[x] hadn't a property set - e.g. TouchEvents[x].ID - but when I made a stand-alone piece of code to illustrate this issue, the IDE raised an error - hence the changes in the second post,



*sigh*.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 1st Oct 2012 17:37
nz0, the IDE/compiler doesn't check to see if you've set anything before using it. You run into those problems when you run the app.

Cheers,
Ancient Lady
AGK Community Tester
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 1st Oct 2012 21:53
@Ancient Lady: I think you misunderstood me. In my first example, I have TouchEvents[x] which is a UDT array. If this variable was anything, it would be a pointer to an array.
However, the compiler warns that this isn't valid (rightly so) but didn't do so when the same code was embedded in my main app.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 1st Oct 2012 23:45
Yes, I did misunderstand. But the compiler/IDE does sometimes miss stuff. And sometimes it doesn't actually compile (that was the subject of another post).

Cheers,
Ancient Lady
AGK Community Tester
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 15th Oct 2012 16:04
Anyway, to return to the point of my post, can someone try the code out on a touchscreen device and confirm my findings?

Zeerun
AGK Developer
18
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 15th Oct 2012 18:16
@nz0 just broadcasted this to my Nexus S and it all worked smoothly!

I seek perfection but wear my scars with pride
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 15th Oct 2012 18:32
you can get an initial movement of <10 pixels?

Zeerun
AGK Developer
18
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 15th Oct 2012 19:00
yes, initial touch positions the joystick
peering around my thumb shows movements under 10 pixels think I noted it said 6 pixels, did not attempt a low score challenge though

I seek perfection but wear my scars with pride
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 15th Oct 2012 21:41
Quote: "On a Windows touch screen, you will get a lag. Even things that should just require a touch (GetPointerPressed()) actually require that you move your finger across the surface for it to register."


This happens only in AppGameKit though. With another sdk I use there is no need to drag 10 pixels and there is no lag on windows touchscreen. it registers even if you touch very softly!
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 16th Oct 2012 15:36
@zeerun: when i have started moving, i can register very small movements. however, the initial movement only i cannot get <10 pixels.

if you can get 1 or 2 px (even after the initial movement) it would be useful to know

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th Oct 2012 00:28
I get the same as you on the Xoom tablet, but the Nexus 7 seems to be responsive as soon as the touch is started, so it may be device specific about when Android decides a touch press is moving.
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 17th Oct 2012 07:42
Thanks for checking Paul.
That doesn't explain why the agk joystick is immediately responsive to fine movement on my xoom - actually, maybe it does...

It must mean that the agk joystick doesn't use the same technique for input?

I can understand that the 10px might be a way of isolating a "short tap" - masking out small movements this way.

So what options are available to me if I want to make my own joystick... how does AppGameKit implement the joystick?

Zeerun
AGK Developer
18
Years of Service
User Offline
Joined: 28th Aug 2005
Location: United Kingdom
Posted: 17th Oct 2012 17:22
When I start the app, first thing I did was (with little finger this time) was press the yellow square, the entire joystick moved to center to my finger location, then on same motion as I moved my finger, just the yellow square moved, I was able to register 1.9 with the trusty pinkie.

Hope this info is useful!

I seek perfection but wear my scars with pride
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 24th Oct 2012 18:42
So how does the agk joystick move properly, but getraw() stuff suffers device dependant issues?

What method does the agk joystick use and what methods can I use to make my joystick work properly?

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 24th Oct 2012 18:55
The virtual joystick uses the same method as the though input commands, I just tested it on the Xoom tablet with a large joystick and get the same small jump after the initial touch press before it becomes smooth.
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 25th Oct 2012 09:31
Right. Thanks for clearing that up.
If I make my joystick 8 direction digital style, I might be able to get away with it.

Login to post a reply

Server time is: 2024-04-28 09:29:27
Your offset time is: 2024-04-28 09:29:27