How to click/touch fast moving objects?

Get help using Construct 2

Post » Thu Feb 21, 2013 2:59 pm

Hello all!
I have a problem with fast moving objects. When i click one, usually i miss the object or the object seems to miss the input.

The common solution (as i saw it implemented) is to give those objects a bigger mask to register inputs.
My object right now use one sprite for the character and one sprite (mask), pinned to it, with the programming and collision checks.
If there's a better solution so i can avoid using another mask it will make my day. 3 sprites for one object rings bad tunes to me.

And, totally out of subject, if someone found a way to use background images without killing performance (cannot strip it as tilsets) also will make my day.

Thanks in advance for any help!
B
31
S
4
G
4
Posts: 110
Reputation: 4,588

Post » Thu Feb 21, 2013 9:07 pm

I use a method where on touch/click, I pick the nearest clickable object (for multiple objects, I just make a family) to the mouse/touch location, and check the distance (something like if distance(touch.x, touch.y, object.x, object.y) is less than object.width+extraamount).

What platform are you exporting to? Using a background image shouldn't kill performance at all, unless you're layering a lot of them on top of each other, in which case you would be probably be hitting overdraw limits of your graphics card. You can also disable the clear background setting to help with the overdraw problem, as long as you're covering the entire layout with some sort of image.Arima2013-02-21 21:09:24
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Feb 21, 2013 10:42 pm

Hello Arima,
My platform to export "should" be ios/android and as a third option PC.
The background image kills performance on low gamma graphic cards only. As far as i could test. In my pc with very high specs everything runs at 60 fps. But i see a noticeable slowdown on average pcs (like those on my office).
I still didn't make much experimentation around this problem, that's why i ask out of topic. Maybe there's a known way to win some fps when big background images are used (specially on smartphones).

Now for the real topic:
Your approach seems good to avoid using another sprite. I will check it since i'm using exactly your method for other unrelated feature.
(Somehow i miss your idea for this)

Since you used this method, would it hit performance more or less than using the second mask sprite to register inputs?
If you believe it won't impact performance then i will use it for sure.

Thanks you very much! :)
B
31
S
4
G
4
Posts: 110
Reputation: 4,588

Post » Fri Feb 22, 2013 3:49 am

On mobile, it should actually be faster than having an extra object used as a mask. There probably isn't that much difference between them, though.

I'm not sure what you mean by low gamma graphics card. Do you mean low-end graphics card? I'm not sure why the gamma setting would affect the FPS at all.

Remember the graphics cards have a limited pixel fill rate the number of pixels they can draw per second. On smart phones, most of the current models, at 60 fps, can only draw every pixel on the screen three times. That includes fully transparent pixels of an image texture. If you have multiple large objects covering most of the screen, that's going to eat up a lot of the pixel fill rate. The same is true for low-end graphics cards on PCs.Arima2013-02-22 03:50:33
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Fri Feb 22, 2013 1:41 pm

Yes, sorry for the misspelling, it was low-end graphics card. Here in my country we say "gama/gamma" to how good a device is. High gamma low gamma, etc. Anyway you understood me.

I'm going to test your method for clicking with "near" formula now. I believe it should be faster too.

About the fill rate and the size of sprites, i have that very in count that's why i fear so much using sprites or big backgrounds. I don't have many smartphones to make test so i have to rely on other's experiences.

Thanks for your help Arima, lets see how this all work.
B
31
S
4
G
4
Posts: 110
Reputation: 4,588


Return to How do I....?

Who is online

Users browsing this forum: farfetchd83, mjj1990 and 4 guests