Multitouch support [proposal]

Post your help queries and engine programming questions here

Multitouch support [proposal]

Postby foolmoron » Tue Mar 25, 2014 12:19 am

So I've been trying to do some pinch zooming and noticed that the engine doesn't handle multiple simultaneous touches.
Apparently there's just a simple check in IgeEntity that disables sending a mouseDown event after a "mouse" is already down, but other than that, it seems like there is no reason for mouseDown events not to be fired on all touch down events, simultaneous or not. Is there a reason for limiting it to just one touch/mouse?

I made a fork of the repo to experiment with disabling this one-touch limit, and made the following changes:
https://github.com/foolmoron/ige/commit ... 0150c1ba13
It seems to work fine and I've got a basic touch zooming component.

Anyone feel like the engine should have multitouch? Is there a better way to do it? Let me know what you think!

PS: I might have messed some things up with the repo when trying to fork and such... I think it's all fine now though.
foolmoron
 
Posts: 57
Joined: Thu Oct 24, 2013 7:20 pm

Re: Multitouch support [proposal]

Postby Doidel » Thu Mar 27, 2014 11:05 am

I'd like to have rob's opinion on this, however I imagine that it was never the engine's goal to provide a fully-fledged touch functionality. There are other libraries which try to solve this (rather complicated when sophisticated) issue.
The initial thought was, if my memory serves, to unify click and touch for that basic steering/usage on a touch device is possible.

For that matter I'd also suggest to implement hammer.js, jquery mobile or any of those advanced libraries for advanced gesture recognition.

(Rob: Haaalp!)
User avatar
Doidel
 
Posts: 59
Joined: Tue Jan 14, 2014 5:05 pm

Re: Multitouch support [proposal]

Postby foolmoron » Fri Mar 28, 2014 1:45 am

I agree that multitouch is complicated, and the unification of mouse/touch events is a core and important feature for the engine.

But it seems to already work just fine with a couple of tiny changes. Sure it doesn't have the advanced gestures of hammer.js and such, but I don't see why we can't just get multiple simultaneous touch events in our mouseDown callbacks.
foolmoron
 
Posts: 57
Joined: Thu Oct 24, 2013 7:20 pm

Re: Multitouch support [proposal]

Postby Doidel » Fri Mar 28, 2014 9:35 am

Ok, I quickly scanned through your proposed changes (!= thorough look):
Look through the library to find all references to mouseDown etc. since you introduced a new variable "touchesDown". Further it might be worth a thought having just 1 instead of two varialbes, where _mouseStateDown would be an integer and in a desktop environment that array would simply never grow bigger than 1. Like this it would also be easier to track down missing other bugs related to mouseDown, e.g. from the examples. For now I doubt that mouseDown is only used in those two locations you uploaded changes for ^^ Maybe that's the case, but I can't quite believe it.
Further, the most important thing, make clear if and how your changes break existing code.
Lastly it's maybe a smart idea to contact Rob and ask him why he had this limit in the first place. Maybe there's code on top of it which relies on only one mouseDown event being fired.

Sorry for long text & nit-picking, I appreciate the work though! Carry on!
User avatar
Doidel
 
Posts: 59
Joined: Tue Jan 14, 2014 5:05 pm

Re: Multitouch support [proposal]

Postby foolmoron » Fri Mar 28, 2014 4:16 pm

Doidel wrote:Further it might be worth a thought having just 1 instead of two varialbes, where _mouseStateDown would be an integer and in a desktop environment that array would simply never grow bigger than 1.

Yeah that's what I tried at first since it's the obvious solution... but I was testing on my touch screen laptop and found that when you have a finger down on the screen, clicking the mouse doesn't register browser events. This might be a Windows 8 or Chrome thing that is unavoidable. So you could click and hold the mouse (+1), touch down with a finger (+1), release the mouse (0), and then release the finger (-1), to arbitrarily increment the perceived number of mouses down. The only solution I had was to explicitly separate mouse/touches.
foolmoron
 
Posts: 57
Joined: Thu Oct 24, 2013 7:20 pm

Re: Multitouch support [proposal]

Postby beaubrandon » Fri Jun 06, 2014 11:46 pm

Hey guys, has there been any more on this? The game I'm building with this engine is somewhat fast paced and absolutely requires some basic multi-touch capabilities to allow movement and weapon firing at the same time. I implemented touch controls to see how they would react with the current system using IgeUIButtons and it had issues with the event firing when pressing (and releasing) 2 buttons at once.

It seems like a more integrated approach would be the answer with separate event handling for mouse and touch. I think I can build up something to work but it'd be great to have a built in solution.
beaubrandon
 
Posts: 12
Joined: Tue Nov 05, 2013 3:33 pm

Re: Multitouch support [proposal]

Postby robaldred » Wed Jun 11, 2014 10:58 pm

Might be worth taking a look at the touch controller component I made a while ago...

viewtopic.php?f=15&t=163

It supports multi touch for moving and firing independently. Worked great for a top down shooter prototype I built.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England


Return to Help & Questions

Who is online

Users browsing this forum: No registered users and 1 guest
cron