Jump to content


Photo

Advanced Gesture Recognition System


  • Please log in to reply
55 replies to this topic

#1 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 01 May 2007 - 07:08 PM

Overview:
Ever played Black and White? If so, you must remember the innovative spell system, which required you to trace a spell's symbol to cast it. My gesture system allows just that. With just a few lines of code, you can add shape recognition to your games. It will take you no more than a few minutes to master the system. The help file also has an easy to follow step-by-step tutorial that will guide you through the process of recognizing a shape.

Source released!
Redownload from GMBase. Be sure to read the License first.

Extension Webpage
License
(Current Version: 5.2)

Edited by Kyle_Solo, 28 February 2008 - 04:06 PM.

  • 0

#2 oakwhiz

oakwhiz

    GMC Member

  • New Member
  • 268 posts

Posted 02 May 2007 - 01:43 AM

I think this is a good start. I don't know exactly what it would be used for, though.

* I noticed that you could draw a small shape or a large version of the same shape, did you use scaling for that?
* The recognition rate is low. If this were for an action game, I wouldn't want a critical gesture to be ignored.

EDIT: Can this be used for things besides the mouse? Like the keyboard?


Please disregard, this was for an old version.

Edited by oakwhiz, 31 May 2007 - 07:38 PM.

  • 0

#3 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 02 May 2007 - 02:00 AM

You can adjust the recognition rate for each shape. You can also draw shapes scaled however you want. This is almost a bug, because it lets you draw a rectangle and interprets it as a square. I'll work on it. Yes, it could be used for the keyboard, maybe. It lets you set the x,y it captures, so you could come up with a system that works based on that.

EDIT: Bug fixed

Edited by Kyle_Solo, 26 June 2007 - 02:51 PM.

  • 0

#4 khajiit

khajiit

    GMC Member

  • New Member
  • 22 posts

Posted 06 May 2007 - 11:55 AM

Suhweet! Im gonna use this in the game im making, I'll be sure to credit you :D
  • 0
I was…
No dark knight, breaking men like ice
I was like a lycanthrope until the moon glazed over
Lipped with blood and last goodbyes

#5 Seeker

Seeker

    GMC Member

  • GMC Member
  • 366 posts

Posted 22 May 2007 - 03:28 AM

How did you handle the scoring in yours? In mine, I allow two type of definitions to be made. You can either add points to a grid or create a directional string. One doesn't affect the other. Dot product is used when scoring point grids, and a string similarity script is used when scoring directional strings. It's all done in the gesture_score() script if anyone searches. The directional string definitions are less accurate than the point grid ones, but I've managed to always get the right shape when drawing the point grid definitions. I don't know why anyone else has had difficulty, but I explained how to make things easier to draw.

You linked to yours in mine, so I'll do the same, heh heh.
My gesture system

Edited by Seeker, 22 May 2007 - 03:29 AM.

  • 0

#6 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 22 May 2007 - 06:41 PM

Mine uses a bizarre method of comparing two arrays of points. It score based upon the difference it calculates between them. It's more advanced than it sounds, trust me.

You linked to yours in mine, so I'll do the same, heh heh.

Fine by me. I would encourage readers to try both.

By the way: Major update! Please re-download. This version is much better. Now has a shape creator and nice demo.
  • 0

#7 Seeker

Seeker

    GMC Member

  • GMC Member
  • 366 posts

Posted 23 May 2007 - 03:59 AM

Mine uses a bizarre method of comparing two arrays of points.  It score based upon the difference it calculates between them.  It's more advanced than it sounds, trust me. 

<{POST_SNAPBACK}>


I do believe. This new demo is amazing! I can't believe I didn't think about putting a shape creator in my version after all of the other things I did. Great idea. I'm having greater success with your shapes in this version than did the last. I don't know if you changed the underlying code or just the settings, or whether my hand has just gotten a lot steadier over the last few weeks :-), but it seems better. I wish others would pay this and my own a little more attention, seeing the work that was put into both.
  • 0

#8 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 23 May 2007 - 04:05 AM

Thank you! I worked pretty hard on this. I actually felt the need to improve it when I saw Point Magic. I am currently working on even better recognition. Specifically, better recognition for bigger shapes (right now smaller ones are easier to recognize). A stupid bug is keeping me from testing it. It works fine as scripts, but when I package it into the extension is gives a weird error. I'll hunt it down, never fear.

EDIT: Found it. Still needs some work though. I posted a record of the error here. Not my fault!


EDIT: I've fixed the recognition for bigger shapes. They are now recognized exactly the same as small ones. Pretty cool, huh?

Edited by Kyle_Solo, 12 September 2007 - 04:55 PM.

  • 0

#9 Seeker

Seeker

    GMC Member

  • GMC Member
  • 366 posts

Posted 23 May 2007 - 09:25 PM

Thank you!  I worked pretty hard on this.  I actually felt the need to improve it when I saw Point Magic.  I am currently working on even better recognition.  Specifically, better recognition for bigger shapes (right now smaller ones are easier to recognize).  A stupid bug is keeping me from testing it.  It works fine as scripts, but when I package it into the extension is gives a weird error.  I'll hunt it down, never fear.

EDIT: Found it.  Still needs some work though.  I posted a record of the error here.  Not my fault!

<{POST_SNAPBACK}>


Wow, you did all of this in the short time that passed since I released Point Magic? You work fast! I'm happy my little presentation gave you extra motivation. :-) I actually like your presentation more than mine. It has a slicker, more professional look.

I figure people won't truly appreciate these kind of things until they see them put to use in a game. So I'm going to work on that later on and at least one other example/program, and then I'll post a video or something so people can actually SEE that these things work since it seems that it's hard for new users to get the drawings down.
  • 0

#10 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 25 May 2007 - 04:30 PM

Update! Version 4.3 supports more accurate scaling of gestures. The cutoff argument is now different. It should be about equal to max(widthofshape,heightofshape). In previous versions large shapes had a much smaller chance of being detected, now the chances are equal! Download link in first post. The demo has also been updated to reflect the changes to the cutoff variable, and I made it more pretty (I was bored). To anyone using this in a game (anyone?): use the updated version! It might be a pain to update the cutoff, but it will work much better.

Next version:
...
I'm drawing a blank here...
What would you like to see in the next version?

Edited by Kyle_Solo, 12 September 2007 - 04:56 PM.

  • 0

#11 hasser

hasser

    GMC Member

  • New Member
  • 537 posts

Posted 28 May 2007 - 01:27 PM

I extracted it but it still says : cannot find extension pacage:gestures. how do i fix this?
  • 0

#12 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 28 May 2007 - 04:12 PM

You need to install the 'gesturesXX.gex' extension. (XX being the version number)
Info on installing extensions

Edited by Kyle_Solo, 26 June 2007 - 02:52 PM.

  • 0

#13 hasser

hasser

    GMC Member

  • New Member
  • 537 posts

Posted 29 May 2007 - 09:00 AM

ok i did it, it works now.

cool extesion... could be very useull.... you should make it so you can start drawing from any part of the shape and it wil still reconise it instead of having to allways start drawing the circle from the top..
  • 0

#14 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 30 May 2007 - 05:33 PM

I don't know if you changed the underlying code or just the settings, or whether my hand has just gotten a lot steadier over the last few weeks :-), but it seems better.

<{POST_SNAPBACK}>


A little of both. I changed the code slightly, but most of it was the settings. I didn't know it would react to shapes with points only at the corners. It reacted poorly. To everyone: You have to carefully define your shapes. For 4.4 I will be adding a gesture_shape_subdivide function to make it easier. (Added)

you should make it so you can start drawing from any part of the shape and it wil still reconise it instead of having to allways start drawing the circle from the top..


I thought about it, but it would be very hard. Very hard. You can't even begin to understand how mindbogglingly hard it would be. It would also slow the system down a lot. Don't count on it.

Edited by Kyle_Solo, 28 September 2007 - 03:25 PM.

  • 0

#15 Seeker

Seeker

    GMC Member

  • GMC Member
  • 366 posts

Posted 01 June 2007 - 07:06 PM

It's too bad that most of the people around here don't like to be challenged.... :D You should make a little game with this and release it in Creations. We can challenge each other, since I'm making a game of my own (and a nice little program). :-)

Edited by Seeker, 01 June 2007 - 07:13 PM.

  • 0

#16 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 05 June 2007 - 06:44 PM

Update! 4.4 is now out, with new features, including a better help file which contains a tutorial. Also, two new functions have been added and the demo has been slightly updated to reflect those changes.
  • 0

#17 oakwhiz

oakwhiz

    GMC Member

  • New Member
  • 268 posts

Posted 10 June 2007 - 01:20 AM

I think this will be useful for my Nintendo DS simulator. *puts into pile of extension packages*
  • 0

#18 death-droid

death-droid

    GMC Member

  • GMC Member
  • 2600 posts

Posted 10 June 2007 - 04:39 AM

looks cool just about to try out

EDIT:Very nice 10/10


one question are you able to make it so it has that effect that goes along the line as soon as you draw anything and can you make it do stuff if you make a shape??

Edited by death-droid, 10 June 2007 - 04:45 AM.

  • 0

Posted Image


#19 GearGOD

GearGOD

    Deus Verus

  • GMC Member
  • 2153 posts

Posted 20 June 2007 - 01:07 PM

Any idea why GM would tell me that the extension is corrupted?
  • 0
Engineers are not programmers. Stop thinking that you can save a few bucks by writing code yourself instead of hiring a programmer. Your code sucks.

#20 Alex

Alex

    3lite Member

  • New Member
  • 3098 posts

Posted 20 June 2007 - 01:17 PM

These aren't that hard to make. Although, I haven't actually tested it. I made a hand writing to text converter a long time ago. I assume it would be similar.
  • 0

#21 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 20 June 2007 - 01:43 PM

No one appreciates anything I do. It's a curse I must learn to live with. :D I don't know if yours is similar or not. This one uses a complicated (not directional) method to compare four arrays of points. I also made this to be easy to use. I personally think it is very useful.

Edited by Kyle_Solo, 28 September 2007 - 03:25 PM.

  • 0

#22 Alex

Alex

    3lite Member

  • New Member
  • 3098 posts

Posted 20 June 2007 - 01:55 PM

Sorry, I wasn't trying to be rude or anything :whistle:

I'm just saying, these aren't that hard to make (or at least, the one I made, was quite simple).

I'm sure yours is much better and more complicated than mine though since yours has a lot more work put into it. :D

Sorry if you got the wrong impression. I do appreciate your work though.

Edited by /\lex, 20 June 2007 - 01:57 PM.

  • 0

#23 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 20 June 2007 - 02:18 PM

@GearGOD:
Works fine for me (I just downloaded it and installed it).

Edited by Kyle_Solo, 20 June 2007 - 02:18 PM.

  • 0

#24 Seeker

Seeker

    GMC Member

  • GMC Member
  • 366 posts

Posted 20 June 2007 - 03:48 PM

No one appreciates anything I do.  It's a curse I must learn to live with.  :D

<{POST_SNAPBACK}>


It's not that. It's just that most of the people around here rather reply to dinky little scripts that take about a minute to make and barely work properly. I've gotten a decent number of replies to my own system, but the fact that it is highly advanced and includes 120+ scripts (unheard of, as far as I've seen on this forum) so you can do many other things with it, should warrant some more replies, right? But don't take anything personally. True genious is generally wasted here. :whistle:

Edited by Seeker, 20 June 2007 - 04:09 PM.

  • 0

#25 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 24 August 2007 - 03:25 PM

Any suggestions for version 5? Any at all? I might rework the editor and include options like snap-to-grid, moving points you've already placed, in-editor subdivide, deleting points, things like that. I will also format the scripts differently so that they resemble the way the particle system and data structures are formatted.

Example:
sh_square = gesture_shape_create(...)
gesture_shape_addpoint(sh_square,...)
...
gesture_shape_enable(sh_square) //Would enable the shape to be recognized by gesture_capture_end

EDIT: Version 5 is done

Edited by Kyle_Solo, 26 September 2007 - 10:57 PM.

  • 0

#26 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 01 September 2007 - 03:45 AM

EDIT: No longer relevant.

Edited by Kyle_Solo, 26 September 2007 - 10:58 PM.

  • 0

#27 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 10 September 2007 - 05:14 PM

Version update! See first post. Please note that Version 5 is incompatible with previous versions in many areas, so you might not want to update if you are already using it in a major project. For everyone else, this should be much more useful, as I've made it work more like GM's particle system in format.
  • 0

#28 Droolie

Droolie

    GMC Member

  • New Member
  • 117 posts

Posted 10 September 2007 - 07:08 PM

Version update!  See first post.  Please note that Version 5 is incompatible with previous versions in many areas, so you might not want to update if you are already using it in a major project.  For everyone else, this should be much more useful, as I've made it work more like GM's particle system in format.

<{POST_SNAPBACK}>


I can't get it to work. The extension is installed but in the example it isn't there automatically, so if you run it it gives you the unknown function/script error. If you do add the extension package then, it tells you this very nice story:
___________________________________________
COMPILATION ERROR in extension package Gestures
Error in code at line 1:
   /*gesture_capture(x,y)*/if !variable_global_exists("gesture_point") breakglobal.gesture_mousex[global.gesture_point] = argument0global.gesture_mousey[global.gesture_point] = argument1global.gesture_point += 1if (global.gesture_maxx < argument0)    global.gesture_maxx = argument0;if (global.gesture_maxy < argument1)    global.gesture_maxy = argument1;if (global.gesture_minx > argument0)    global.gesture_minx = argument0;if (global.gesture_miny > argument1)    global.gesture_miny = argument1;

at position 205: Unexpected symbol in expression.

Edited by Droolie, 10 September 2007 - 07:22 PM.

  • 0


#29 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 10 September 2007 - 09:06 PM

I know about that error, and I fixed that. You must have been one of the lucky two people who downloaded it before I fixed it (there was a 30 minute window). You need to re-download. This bug is not my fault, it is GM's. It exports scripts in a way that doesn't work with extension maker sometimes. Sorry you got that version, and thanks for reporting it. :snitch:

Edited by Kyle_Solo, 10 September 2007 - 09:11 PM.

  • 0

#30 Droolie

Droolie

    GMC Member

  • New Member
  • 117 posts

Posted 12 September 2007 - 05:42 PM

Ok, redownloaded :P
It looks great! I will certainly use it in my upcoming game, but then the system would need a little extra, which I will explain to you now:
The drawing in my game would work using a button that has to be pressed down when drawing, and released when finished.
That means you can release mouse buttons while still pressing that button.
That also means you can draw two/more things as one shape ( like two circles next to each other ) and that it should be recognized as 1 shape.
I dunno if that can already be done using the current system, so tell me if it can be done ( and tell me how! XD ). If it can't be done yet, then this is a suggestion for 5.1 :)
  • 0


#31 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 12 September 2007 - 06:28 PM

Using a key instead of the mouse can already be done. See the tutorial in the help file (also packaged with the extension, and instead of using the mouse events use key events.

The other one (two shapes as one) is an interesting challenge. It would require you to stop capturing after the first circle and not call gesture_capture_end() until you finish drawing the other circle. If that doesn't make sense, just say so and I'll make an example.
  • 0

#32 Droolie

Droolie

    GMC Member

  • New Member
  • 117 posts

Posted 14 September 2007 - 02:53 PM

Using a key instead of the mouse can already be done.  See the tutorial in the help file (also packaged with the extension, and instead of using the mouse events use key events.

The other one (two shapes as one) is an interesting challenge. It would require you to stop capturing after the first circle and not call gesture_capture_end() until you finish drawing the other circle.  If that doesn't make sense, just say so and I'll make an example.

<{POST_SNAPBACK}>


Actually, it does make sense and I could probably do that, but... I don't have the time to look at it o_O
So can you please make an example?
  • 0


#33 m1att92

m1att92

    GMC Member

  • New Member
  • 9 posts

Posted 26 September 2007 - 08:41 PM

You should add a variable that gives the accuracy of the drawing. ie. if you draw sloppy, the spell has less power...

Please consider this an official suggestion for 5.1.

EDIT: :D Sorry, I just found the percentage now. My bad

Edited by m1att92, 26 September 2007 - 08:50 PM.

  • 0

#34 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 28 September 2007 - 03:19 PM

I've added a very nice shape creator to the first post. The editor has snap-to-grid, moving points you've already placed, subdivide, deleting points, inserting points, testing the shape, tweaking the shape's cutoff, and exporting it to the clipboard for use in games.
  • 0

#35 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 09 October 2007 - 01:23 AM

Update to Version 5.1! Details in first post.
  • 0

#36 GPFault

GPFault

    GMC Member

  • New Member
  • 20 posts

Posted 13 November 2007 - 08:52 PM

Hey Kyle, this is a great utility.

Any chance you will release the source to Shapemaker?

Alternatively, here are a couple of improvements I could see to it:

1. Allow the user to toggle a grid on/off so you can see where you will be putting your points.

2. Allow the user to draw a shape and have shapemaker plot the points (density of the points can be settable). This way I can draw a curve rather than having to do it point-by-point.

3. Allow the user to import code generated by shapemaker. I wanted to import the circle code you used in the example to see what it looked like in shapemaker but I had no way to do that.

4. An undo feature (with unlimited levels of undo!) to cancel the last added point, moved point, subdivide operation, etc...

Last issue:

In the gesture application, when I'm in capture mode and I'm drawing a shape, sometimes there is a graphical break in the line. Have you seen this? It seems to happen when you are drawing semi-quickly using curves.

Awesome utility. If I can work out the kinks, I will totally be using this in a game.

Kevin.

Edited by GPFault, 13 November 2007 - 09:06 PM.

  • 0

#37 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 14 November 2007 - 02:30 AM

Here you go:
Shapemaker Source

The graphic "bug" is due to the mouse moving while the line is being drawn. After the line is drawn, the previous mouse position (used in the next step) is set. If the mouse move between drawing the line and setting the mouse's past position, a break will appear between the previous line and the next line. I think you can forgive me for not realizing this at first.

Here's the fix. Replace obj_gesture's step event with this.
//If the right mouse is pressedif mouse_check_button_pressed(mb_right){    //Graphical stuff    mxp = mouse_x    myp = mouse_y    //Start the capture    gesture_capture_start(mouse_x,mouse_y)    //That was easy!        //Graphical stuff, ignore    surface_set_target(sur)    draw_set_blend_mode(bm_add)    draw_sprite(spr_white,0,mouse_x,mouse_y)    draw_set_blend_mode(bm_normal)    surface_reset_target()}else if mouse_check_button(mb_right) //if the right mouse is being held down{    tmxp = mxp    tmyp = myp    //Graphical Stuff    mxp = mouse_x    myp = mouse_y        //Capture the points    gesture_capture(mouse_x,mouse_y)    //Very easy!        //More graphical stuff    surface_set_target(sur)    draw_set_blend_mode(bm_add)    var dir,dist;    dist = point_distance(tmxp,tmyp,mouse_x,mouse_y)    dir = point_direction(tmxp,tmyp,mouse_x,mouse_y)    for(i = 0; i <= dist; i += 1) //More graphical stuff    {        draw_sprite(spr_white,0,tmxp+lengthdir_x(i,dir),tmyp+lengthdir_y(i,dir))    }    draw_sprite(spr_white,0,mouse_x,mouse_y)    draw_set_blend_mode(bm_normal)    surface_reset_target()    //End of graphical stuff}else if mouse_check_button_released(mb_right) //if the mouse is released{    shape = gesture_capture_end() //end the capture    //Now the id of the shape has been stored in "shape"        //Show the name of the shape, or "None" if shape = 0    switch(shape)    {           case 0: shape = "None" break        case sp_square: shape = "Square" break        case sp_point: shape = "Point" break        case sp_zigzag: shape = "Zigzag" break        case sp_circle: shape = "Circle" break        case sp_star: shape = "Star" break        case sp_s: shape = "S" break    }        //There!  We recognized a shape.  Very easy.}else if !mouse_check_button(mb_right) //Graphical stuff{    //Graphical stuff    surface_set_target(sur)    draw_set_alpha(0.3)    draw_set_blend_mode(bm_subtract)    draw_set_color(c_black)    draw_rectangle(0,0,room_width,room_height,0)    draw_set_alpha(1)    draw_set_blend_mode(bm_normal)    surface_reset_target()}

There! Glad you like it.
  • 0

#38 GPFault

GPFault

    GMC Member

  • New Member
  • 20 posts

Posted 14 November 2007 - 05:07 PM

Wow, thanks for the quick reply. That fix did indeed stop the break in the line and I will make a few modifications to the ShapeMaker and repost it for you.

Thanks a lot! ^_^

GPF.
  • 0

#39 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 14 November 2007 - 05:10 PM

Awesome. I'll look forward to seeing what you add to it.
  • 0

#40 GPFault

GPFault

    GMC Member

  • New Member
  • 20 posts

Posted 15 November 2007 - 11:18 PM

Hey one more thing I thought might be useful to add is the ability to test the gesture "drawn backwards" or not.

Taking your circle, for example, the user must draw it clockwise... it would be nice to get a match even if it's drawn counterclockwise.

Or in the case of a non-closed shape, just starting from the last point and drawing to the first.

I'm guessing that would be a simple addition/flag.

Is it? :D

Kevin.

Edited by GPFault, 15 November 2007 - 11:20 PM.

  • 0

#41 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 29 November 2007 - 03:13 PM

I'm working on some functions to transform the shapes. I'm thinking gesture_shape_mirror (flips horizontally), gesture_shape_flip (flips vertically), gesture_shape_reverse (reverses order), and gesture_shape_rotate (rotates by amount). These functions would return the id of a new shape or replace the current shape, depending on what you want to do. I'll also have functions to get the location of a point in a shape (so you can do some graphic things). Can you think of anything else you want?

Edited by Kyle_Solo, 29 November 2007 - 03:28 PM.

  • 0

#42 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 29 November 2007 - 04:46 PM

Version update! See first post. Added all the ones in the above post and more.
  • 0

#43 terramaster

terramaster

    GMC Member

  • New Member
  • 42 posts

Posted 06 December 2007 - 11:12 PM

Hey I was wondering how I would get the % of accuracy (ive seen it in there somewhere) as gesture_capture_percent(id)

what is id? And how would I be able to get it in a numarical?


As well as:

   //Show the name of the shape, or "None" if shape = 0
    switch(shape)
    {   
        case 0: shape = "None" break
        case sp_square: shape = "Square" break
        case sp_point: shape = "Point" break
        case sp_zigzag: shape = "Zigzag" break
        case sp_circle: shape = "Circle" break
        case sp_star: shape = "Star" break
        case sp_s: shape = "S" break
    }
  
What is sp stand for?

What does the "case" function/whatever it is (im a GM noob XD) do?

And why do you have "break" in the end of each case sentence?

And is there any onther way to get any other easier contact method?

May I add:

THIS IS AMAZING!

Edited by terramaster, 06 December 2007 - 11:14 PM.

  • 0

#44 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 07 December 2007 - 03:43 AM

Thanks for your comment!
id is returned by gesture_shape_create. You use it like this:
variable = gesture_shape_create(...)
Now the id of the shape is stored in variable.
So to get the percent chance of that shape, you would use gesture_capture_per(variable). The id of the winning shape is returned by gesture_capture_end, so you can use that to perform actions based on which shape is found.
sp is just a prefix I put on the variable names I stored the shape's id in to make them stand out. It isn't needed, it just makes it easier to see what the variables contain.
As for your questions about switch, case, and break, the GM manual explains them better than I do.

If you want to talk to me further, PM me your email/chat name.
  • 0

#45 Bill23

Bill23

    GMC Member

  • GMC Member
  • 460 posts
  • Version:GM:Studio

Posted 15 December 2007 - 02:15 AM

I'm currently trying to edit your shapemaker, and I found a bug (actually I think this is a bug with your extension, not the shapemaker, but I figured I'd mention the shapemaker just in case.) It happened when I created a one-point shape (so there weren't any lines or anything).
ERROR in
action number 1
of  Step Event
for object obj_gesture:

In extension function gesture_capture_end:
Error in code at line 17:
       cutoff = global.gesture_c[cs]*(xmap/((width+height)/2))

at position 44: Division by 0.

  • 0
Posted Image
Posted ImagePosted Image

#46 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 15 December 2007 - 03:51 AM

One way to fix it would be to not have a one point shape. :ph34r:

The way I'll probably end up fixing it: shapes that have only one (or zero) points will not be able to be enabled.
  • 0

#47 Bill23

Bill23

    GMC Member

  • GMC Member
  • 460 posts
  • Version:GM:Studio

Posted 15 December 2007 - 06:00 PM

I added a way to show a grid to the shapemaker. Here it is.Download shapemaker.zip
  • 0
Posted Image
Posted ImagePosted Image

#48 Gamer_guy300

Gamer_guy300

    GMC Member

  • New Member
  • 226 posts

Posted 16 December 2007 - 12:01 PM

wow! this is great i'm gonna use this.....
  • 0

#49 GPFault

GPFault

    GMC Member

  • New Member
  • 20 posts

Posted 22 January 2008 - 12:25 AM

Hey Kyle, cool to see you released v5.2.

I am using this in a prototype game I'm working on and have a couple of questions:

1. I was wondering how hard it would be to add functionality to the system so that it doens't matter what direction you draw the shape in? (i.e. bAllowMirror = true or something like that)

EDIT> I just read the new functions, but I'm looking for a way to check if I've drawn a shape forwards or backwards. In order to do this, it looks like I would have to register a shape, then flip it, then register that one and test against both. Is this the only way? -- I was hoping to see this rolled into the check function if possible.

As a sub question, for a closed shape such as a rectangle, would it be possible to be able to start the drawing anywhere and still have it work?

2. I spoke to you about this before, but there is still an issue with the speed at which the user draws the shape and recognition accuracy. This is easily noticeable when drawing the square for example. Try drawing it pixel-perfect but EXTREMELY slowly (i.e. lots of sample points) versus very quickly and not so accurate (fewer points). -- Currently I can get a higher accuracy percentage by drawing it quicker because the number of points involved are closer to the sample... even if the shape doesn't resemble the square as close as it did when I drew it slowly and got a lower accuracy rating.

When we talked a few weeks ago, you said, "Hmm. I know what's causing this but it's going to be difficult to fix." Did you ever get any farther on it?

Thanks!

Kevin.

Edited by GPFault, 22 January 2008 - 12:33 AM.

  • 0

#50 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1071 posts
  • Version:Unknown

Posted 22 January 2008 - 03:48 AM

I really don't have the time to work on this extension right now, but I'll try to answer your questions.
1. As of now, that's the only way you can.
2. Still haven't entirely fixed that. I tried some things, but they didn't seem to help.

The good news is that I'll try to solve both in version 6 (Info).
It could be some time before I finish that up, though. Hang in there.
  • 0