Jump to content


Photo

Input Dog: Easy Controls and Replays


  • Please log in to reply
30 replies to this topic

#1 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 07 July 2014 - 01:03 AM

thumb.png


~~~~FREE and OPEN SOURCE~~~~~

https://github.com/messhof/Input-Dog

Input Dog on the Game Maker Marketplace

 
 
1.1.6 - added analog axis support
1.1.2 - added replay support
1.0.9 - simplified the code and renamed resources so that they wont conflict with your project
1.0.7 - supports older "directInput" joysticks along with newer ones. mix and match!
1.0.5 - supports 4 gamepads
 
inputdogscreenn.png
 
InputDog combines keyboard_check(), gamepad_check_button(), and input remapping in one easy to use package.
Adding inputs is a snap, just drop in the InputForPlayer1 object and edit its user event:
inputdog_add_input("left", vk_left, inputdog_leftStickLeft);
This creates an action called left with a default key mapping of vk_left and a default gamepad mapping of the left stick pushed to the left. If you want to check whether player 1 pressed left just write inputDog_pressed("left",1) --You can also check if a button is down or released.
This makes it very easy for the player as they can start on a keyboard, then plug in a joystick and use that, then abandon the joystick and go back to the keyboard without exiting the game or changing any settings.
We've also included an easy to modify custom controls room for your players to make it easy for them to set up their own control schemes.
 
NEW - Now you can record and play back inputs for as many players as you want! Click the "record" button to see an example of this
 
smallscreen2.png
 
InputDog works on mac and windows and supports both xinput (xbox) gamepads as well as direct_input (everything else). Players can toggle which mode they would like to use in the custom controls room.
Let us know what we can do to improve this plugin and please give us a review if you've found it helpful!
 
Link to Input Dog

Edited by messhof, 21 October 2015 - 06:14 PM.

  • 0

#2 thaaks

thaaks

    GMC Member

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

Posted 07 July 2014 - 08:46 PM

Looks nice!

I have some questions though:

  • does it support multiple keys for the same action (for example, have "Z" and "Y" do the "bark" action)?
  • does it work with virtual keys on mobile devices?
  • does it support multiple controllers? On all platforms (like Ouya controllers on Android)? How can I separate between them?
  • does it support mouse buttons as input?

  • 0

#3 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 07 July 2014 - 09:49 PM

does it support multiple keys for the same action (for example, have "Z" and "Y" do the "bark" action)?
No, you can attach the same key to multiple actions but not the other way around.
 
does it work with virtual keys on mobile devices?
No, although I'm not sure why you'd want to do that. Maybe I'll add some touchscreen specific stuff in the future.
 
does it support multiple controllers? On all platforms (like Ouya controllers on Android)? How can I separate between them?
This is the next thing I need to add, for sure! I have it working but I want to make the code as simple as possible.
 
does it support mouse buttons as input?
No. This is also sort of outside the scope but it's easy enough to add so I may do that today.

Edited by messhof, 07 July 2014 - 10:08 PM.

  • 0

#4 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 08 July 2014 - 12:09 AM

Ok, added multi-dog support (1-4 players)

 

I'm having issues uploading the new package version but it'll be up soon.


  • 0

#5 thaaks

thaaks

    GMC Member

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

Posted 08 July 2014 - 07:10 PM

 

does it support multiple keys for the same action (for example, have "Z" and "Y" do the "bark" action)?
No, you can attach the same key to multiple actions but not the other way around.
 
On german and french keyboards some keys are swapped (like "Z" and "Y" for example). So to use the same keyboard layout for my input keys I'd want to support both keys for the same action.
Or another simple reason for left and right handed persons support WASD and cursor keys at the same time.
Please consider adding this feature  :whistling:
 
does it work with virtual keys on mobile devices?
No, although I'm not sure why you'd want to do that. Maybe I'll add some touchscreen specific stuff in the future.
 
Mainly I asked to verify if virtual keys for mobile devices (that map to standard keyboard input) just work with your input routines. If I want to create a cross platform game I might use a gamepad or keyboard on the Windows executable and configure virtual keys for mobile devices that map to standard keyboard keys that should be handled by your input dog routines.
 
does it support multiple controllers? On all platforms (like Ouya controllers on Android)? How can I separate between them?
This is the next thing I need to add, for sure! I have it working but I want to make the code as simple as possible.
 
Great!
 
does it support mouse buttons as input?
No. This is also sort of outside the scope but it's easy enough to add so I may do that today.
 
Once more: great!
 

  • 0

#6 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 09 July 2014 - 06:09 AM

Mainly I asked to verify if virtual keys for mobile devices (that map to standard keyboard input) just work with your input routines. If I want to create a cross platform game I might use a gamepad or keyboard on the Windows executable and configure virtual keys for mobile devices that map to standard keyboard keys that should be handled by your input dog routines.

oh, then this will work. It still uses the keyboard_check functions

 

On german and french keyboards some keys are swapped (like "Z" and "Y" for example). So to use the same keyboard layout for my input keys I'd want to support both keys for the same action.

Or another simple reason for left and right handed persons support WASD and cursor keys at the same time.
Please consider adding this feature   :whistling:
Oh I see, my solution for this was just to allow users to set their own controls through an in-game menu (see this image). Adding alternate keys could be in a future update.

  • 0

#7 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 09 July 2014 - 07:08 AM

I did a similar system on Space Ranger... can you map a key to multiple scripts?
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#8 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 09 July 2014 - 07:14 AM

This system is more of a replacement for the keyboard_check functions, but you set up custom names that any key can be set to. I'm not defining a "roll" script, i'm just calling one of my custom keys "roll", and then using a check like if(inputDown("roll")) to see if it's pressed down. Players can then change which key is mapped to that virtual key.


  • 0

#9 conantbh

conantbh

    GMC Member

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

Posted 13 July 2014 - 03:29 PM

 

 

does it support mouse buttons as input?
No. This is also sort of outside the scope but it's easy enough to add so I may do that today.
 

 

 

Would totally buy with mouse input. If it had even mouse 3 and 4 it would be just lovely.


  • 0

#10 kburkhart84

kburkhart84

    Firehammer Games

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

Posted 17 July 2014 - 07:06 PM

One thing about this....if it is like mine(kbinput, not on the marketplace yet), it may be using GMStudio's input functions, wrapped up really nice for additional stuff.  If that is the case, then there will be limitations to what can be added depending on what all GMStudio's input system supports.  That can be worked around with DLLs/etc... but it is much more work than to simply use what GM is already providing for input.


  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#11 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 18 July 2014 - 06:17 PM

It makes adding support for joysticks, gamepads, and custom controls for everything really simple. If you send out your game and some players have older "directInput" joysticks or some have newer "xInput" gamepads and some only have a keyboard you only have to code your controls once. I'll add a video of this soon..


  • 0

#12 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 03 August 2014 - 08:33 AM

updated!

1.0.9 - simplified the code and renamed resources so that they wont conflict with your project
  • 0

#13 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 10 November 2014 - 02:06 AM

updated again!

 

1.1.1 - fixed a bug with joystick/gamepad reconnections


  • 0

#14 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 10 November 2014 - 08:58 AM

updated again again!

 

1.1.2 - added replay support for recording and playing back inputs


  • 1

#15 DetectiveButler

DetectiveButler

    GMC Member

  • New Member
  • 5 posts
  • Version:GM:Studio

Posted 19 November 2014 - 02:18 AM

Hey there, had a couple of questions:

 

How many directinput controllers can this handle at once?

How many axis per directinput?

How many buttons per directinput?

How many triggers per direct input?

How many dpads per direct input?

 

If two players plugged in a direct input controller, and two players plug in a xinput controller. Will it count and slot those controllers properly?

 

Thanks for any answers!


  • 0

#16 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 19 November 2014 - 04:29 AM

How many directinput controllers can this handle at once?
same as game maker, 2.
 
How many axis per directinput?
it just checks x/y and buttons 1-8 at the moment but it would be easy to add more. if you want to add them yourself it would be in the script called inputdog_check_gamepad_input() but I can update with more axis soon.
 
How many buttons per directinput?
8
 
How many triggers per direct input?
if you mean analog triggers, none currently
 
How many dpads per direct input?
2 (this is the same question as before, right?)
 
If two players plugged in a direct input controller, and two players plug in a xinput controller. Will it count and slot those controllers properly?
yes

  • 0

#17 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 03 December 2014 - 04:52 AM

Added some analog support so that you can use all the joysticks directions!


  • 0

#18 AdamJimenezUK

AdamJimenezUK

    GMC Member

  • New Member
  • 14 posts
  • Version:GM:Studio

Posted 17 December 2014 - 01:00 PM

Maybe this could support more than 4 controllers using Joydll:

http://gmc.yoyogames...howtopic=495788


  • 0

#19 kburkhart84

kburkhart84

    Firehammer Games

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

Posted 17 December 2014 - 03:28 PM

If it were to implement that DLL(assuming it works right with Studio), those features(and maybe the whole thing) would only be able to work on Windows. Unless the creator wants to write DLL alternatives for Mac and Linux(at the least since mobile is usually touch screen), I don't think it is a good idea to limit work to a single platform, especially since one of the great benefits to GM is the ability to export to all these different platforms.


  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#20 AdamJimenezUK

AdamJimenezUK

    GMC Member

  • New Member
  • 14 posts
  • Version:GM:Studio

Posted 17 December 2014 - 04:37 PM

I can confirm that it works in Studio.

 

It would be much better if GM had built-in support for >4 controllers.

Perhaps there could be an option to pick the input type with the caveat that this option is limited to Windows (for now).


  • 0

#21 clloses

clloses

    GMC Member

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

Posted 25 January 2015 - 12:32 AM

Hi I'm having issues with your asset. I've imported all scripts and objects except "ExampleDog" and all "Clickable Buttons". I've copy and pasted the same Step event into my player  object and copy and pasted too the Creation codes of the initRoom (to create the inputController instances) and gameRoom (global.editPlayerSlot = -1) but I got this error and don't understand why:

undefined value
 at gml_Script_inputdog_direction (line 20) -                             -inputdog_analog(INPUT_UP,PLAYER)+inputdog_analog(INPUT_DOWN,PLAYER)) == 0)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_inputdog_direction (line 20)
called from - gml_Object_obj_player_StepNormalEvent_2 (line 8) - var d = inputdog_direction("up","down","left","right",playerSlot);

Do you have any idea of what's happening?

 

Thanks for any help, I'm really interested into your asset ^^


  • 0

Marketplace assets:

signature2.png    signature3.png


#22 mnuriev

mnuriev

    GMC Member

  • New Member
  • 8 posts
  • Version:GM:Studio

Posted 06 April 2015 - 09:10 PM

Hi, 

when I compile windows application - it's OK

When I compile HTML5 app then i get error:  unable to find extension file inputdog.ext in extension Input Dog

So, this extension - is it HTML5-compatible ?

(I've also read Chrome support gamepads)


  • 0

#23 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 07 April 2015 - 09:02 PM

Hi, 

when I compile windows application - it's OK

When I compile HTML5 app then i get error:  unable to find extension file inputdog.ext in extension Input Dog

So, this extension - is it HTML5-compatible ?

(I've also read Chrome support gamepads)

 

I haven't tried it in html5, but it seems like it should work... I don't know enough about the html5 limitations, sorry!


  • 0

#24 NazGhuL

NazGhuL

    From NazTaiL

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

Posted 09 April 2015 - 11:38 AM

Hi!

Ps3 controller works?

Using gamepad functions or joystick functions?

I'm using Ps3 controller using Better DS3.


  • 0

tag_mtmapo.jpgtag_marketplace.jpgtag_fake_light.jpg


#25 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 11 April 2015 - 02:49 AM

I believe windows sees the ds3 as a "direct input" joystick, so it should work with input dog if you toggle direct input mode in the custom controls screen. I don't have a ds3 to test this.


  • 0

#26 poshu

poshu

    GMC Member

  • New Member
  • 9 posts
  • Version:GM:Studio

Posted 15 September 2015 - 07:42 PM

Hi I'm having issues with your asset. I've imported all scripts and objects except "ExampleDog" and all "Clickable Buttons". I've copy and pasted the same Step event into my player  object and copy and pasted too the Creation codes of the initRoom (to create the inputController instances) and gameRoom (global.editPlayerSlot = -1) but I got this error and don't understand why:

undefined value
 at gml_Script_inputdog_direction (line 20) -                             -inputdog_analog(INPUT_UP,PLAYER)+inputdog_analog(INPUT_DOWN,PLAYER)) == 0)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_inputdog_direction (line 20)
called from - gml_Object_obj_player_StepNormalEvent_2 (line 8) - var d = inputdog_direction("up","down","left","right",playerSlot);

Do you have any idea of what's happening?

 

Thanks for any help, I'm really interested into your asset ^^

 

I had te same problem, it came from a not initialising the inputforplayer object properly.

 

Otherwise, great tool, easy too implement, thanks!


Edited by poshu, 15 September 2015 - 08:16 PM.

  • 0

#27 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 21 October 2015 - 06:14 PM

Input Dog is now free and open source! Feel free to contribute to the source code here-- https://github.com/messhof/Input-Dog
  • 0

#28 iJohnF

iJohnF

    GMC Member

  • New Member
  • 1 posts
  • Version:GM:Studio

Posted 24 October 2015 - 09:00 PM

Sweet, thanks Messhof! Gonna have to try this out. Has anyone tried it with Playstation 3/4 controllers yet?


  • 0

@iJohnF | GamesByJohn.com | Game Designer @ SGN San Francisco by day, indie game dev by night


#29 messhof

messhof

    GMC Member

  • GMC Member
  • 76 posts
  • Version:Unknown

Posted 25 October 2015 - 03:32 AM

I've tried it with ps3 and it works.. I think you have to use direct input mode. Ps4 controllers should work, I haven't tried them.
  • 0

#30 programer786

programer786

    GMC Member

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

Posted 27 December 2015 - 12:34 PM

Hello,


How could I use virtual keys with Input dog ?
Virtual keys are coded like this :
global.vJUMP = virtual_key_add(560, 289, 96, 96, vk_shift)

I don't know what "vk_shift" must be replaced by so that the virtual key will work with the custom keys added to input dog.

I think it would be something like :
virtual_key_add(560, 289, 96, 96, ds_map_find_value(InputManager.customKeys, "jump"))


programer786.


  • 0

#31 ClassyGoat

ClassyGoat

    Goatee Connoisseur

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

Posted 31 December 2015 - 05:11 PM

I'm having trouble getting this system to work. I loaded the latest version into my game, and upon trying to run the included files without making any changes I get this error:


___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object ExampleDog:
 
Variable ExampleDog.inputsDown(100016, -2147483648) not set before reading it.
 at gml_Script_inputdog_analog (line 15) - return ds_map_find_value(INPUT_MANAGER.inputsDown, INPUT);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_inputdog_analog (line 15)
called from - gml_Script_inputdog_direction (line 20) -                             -inputdog_analog(INPUT_UP,PLAYER)+inputdog_analog(INPUT_DOWN,PLAYER)) == 0) 
called from - gml_Object_ExampleDog_StepNormalEvent_1 (line 4) - var d = inputdog_direction("up","down","left","right",playerSlot);
 

 

 


  • 0
7757C.png sharkhugs_banner.png