Sign in to follow this  

Drawing and Matching Like Crazy Cutter - Mario Party

Recommended Posts

Vincent_M    969

I'd like to add a gameplay mechanic that requires a player to draw symbols close to a predefined one just like in Mario Party:


This is for touch devices, so my idea would be to have a blank texture-like mask over the screen which is actually an array of booleans. As the player touches and drags their fingers over the screen, it'll make the pixels' boolean values become true. The drawing is silently scored whenever the player releases their finger, and if the score is greater than 70% or 80% relevancy, then it's considered a success. Something along those lines...


Also, I'd use a really low-res texture mask. Nothing like 960x640, or something crazy like that. That's just way too large!

Share this post

Link to post
Share on other sites
Samith    2460

That sounds like a sort of expensive approach, even with a low res mask. On one of the games I worked on we had a feature where the player could "sign" their name with the touch screen. As the player dragged their finger along the screen I would add verts to a tristrip that followed the player's finger. That way I had a relatively small object which described the player's signature (just a tristrip with a couple hundred points) vs a large texture.


If I were in your place, I would attempt something similar. As the player drags their finger, I would create a line strip or something that followed the player finger, then when they release their finger I could compare the line strip to the "correct" line strip for the gesture. Matching the player's line strip vs the correct line strip might be kind of tricky. I would probably normalize the player line strip (scale the line strip such that the min x of the line strip becomes -1, the max x becomes 1, the min y becomes -1 and the max y becomes 1) and then march along both the player line strip and the correct line strip at fixed intervals and sum up the distance from the player point to the correct point. If the sum of the distances at each sample point is below some threshold, it passes, otherwise it fails.


Keep in mind I've never actually implemented a gesture system, so the matching part might need some work, but what I suggested is probably a good place to start and should be faster than comparing two textures (even a modest 100x50 texture would require 5000 comparisons).

Edited by Samith

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this