Author Topic: [PLUGIN] Joystick / Game controller support! v1.2.0  (Read 23553 times)

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on a game that was nominated for an AGS Award!
      Dualnames worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #20 on: 04 Sep 2010, 16:46 »
Honestly, I'd rather use a plugin for that. And the absence of any games using JoyToKey pretty much states the statement itself. I think Wyz made possible what was only a dream. ;)
No more military army stuff. I'm alive and back.

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #21 on: 04 Sep 2010, 23:29 »
There's no "absence of games using JoyToKey", because JoyToKey is completely separate from the games; you can use it with any game, indeed any application, to allow joystick/gamepad input.

I recently used it with Psychonauts to map auto-fire (or more precisely, auto-douse) onto an unused button, and with the Prince of Persia games for all actions. I don't remember if Dreamfall and Fahrenheit had built-in controller support; otherwise I used it for those as well.

JoyToKey is pretty much everything you could ever want for game-controller input. The only drawback is that a lot of people aren't aware of it. I say just distribute it with your game.

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #22 on: 06 Sep 2010, 11:08 »
Wow! Thanks for creating this awesome plugin!

I somehow missed this thread during my vacation. Let's see how it works for that platform engine.

Time to search for my Gravis Gamepad  Pro :)

Re: [PLUGIN] Joystick / Game controller support!
« Reply #23 on: 06 Sep 2010, 12:14 »
Will you release the source?

icey games

  • It's the time of ICEY!!!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #24 on: 06 Sep 2010, 21:07 »
yes! now i can add to my game!

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on a game that was nominated for an AGS Award!
      Dualnames worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #25 on: 07 Sep 2010, 02:30 »
There's no "absence of games using JoyToKey", because JoyToKey is completely separate from the games; you can use it with any game, indeed any application, to allow joystick/gamepad input.

I recently used it with Psychonauts to map auto-fire (or more precisely, auto-douse) onto an unused button, and with the Prince of Persia games for all actions. I don't remember if Dreamfall and Fahrenheit had built-in controller support; otherwise I used it for those as well.

JoyToKey is pretty much everything you could ever want for game-controller input. The only drawback is that a lot of people aren't aware of it. I say just distribute it with your game.


I stand corrected. Still, this plugin just pretty much adds to what is considered "basic" for games out there. And that's of course a personal opinion. I just never used JoyToKey cause I never found a use for it, all of the games I've played had in-game controller support, and that's a very useful thing for an AGS game in my personal opinion. I will be certainly using it on TROICA. :D
No more military army stuff. I'm alive and back.

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: [PLUGIN] Joystick / Game controller support!
« Reply #26 on: 07 Sep 2010, 03:33 »
I didn't mean to hijack this thread..::)..as was said, JoyToKey is completely independent of games..you can even use it to control the cursor/keyboard in the OS if you really want to (how you set that up is entirely up to you). For streamlined, built-in controller support, that you can edit at run-time from within your AGS game, there's this plugin. For everything else, there's JoyToKey. ;)

[/JoyToKey posts in this thread already!!] :P
« Last Edit: 08 Sep 2010, 03:16 by monkey_05_06 »
User was banned for this post.

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on a game that was nominated for an AGS Award!
      Dualnames worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #27 on: 07 Sep 2010, 10:19 »
I'm not ditching JoyToKey, heaven forbid, lots of people are using it in their games. I'm just fairly happy with the existence of a plugin. There I said it in one sentence. That said, let's leave this to a more gen-gen approach.
No more military army stuff. I'm alive and back.

Snake

  • @_@
    • I can help with making music
    •  
    • I can help with story design
    •  
    • Snake worked on a game that was nominated for an AGS Award!
      Snake worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #28 on: 07 Sep 2010, 16:10 »
I say NAY to resorting to JoyToKey with AGS.
It is indeed a great program, which I've used numerous times, but with a non-adventure AGS game, in-game joystick/gamepad support is a must (depending on the game, of course).
I would not want to make a game intended to be played with a gamepad or joystick and tell the player, search for a program called JoyToKey and follow the instructions, etc, to play with a gamepad/joystick.
It's absurd to suggest this when there is an in-game default available.

\\--EDIT--//
If this reply seems a little awkward, it's because I didn't realize there was a second page...
« Last Edit: 07 Sep 2010, 16:17 by Snake »
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Wyz

  • AGS Project Tracker Admins
  • anno 1986
    • I can help with making music
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #29 on: 08 Sep 2010, 18:43 »
I'm glad that is settled ;D
I still working on the example + documentation, but in the mean time please feel free to PM me if you have questions. I'm looking forward to the first implementations!
Life is like an adventure without the pixel hunts.

mode7

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • I can help with web design
    •  
    • mode7 worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #30 on: 14 Sep 2010, 09:10 »
I'm glad that is settled ;D
I still working on the example + documentation, but in the mean time please feel free to PM me if you have questions. I'm looking forward to the first implementations!

An example would be great. I'm still quite unexperienced with coding and can't quite figure out how it works.


         

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #31 on: 16 Sep 2010, 12:12 »
Just take a look at the readme file. It's contains almost everything you need to know.
Also the autocompletion hints added by wyz are really helpful.

As for an example, I've almost done including the plugin to my platform engine. I'll upload it this evening, so you can take a look.

Wyz

  • AGS Project Tracker Admins
  • anno 1986
    • I can help with making music
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #32 on: 17 Sep 2010, 16:43 »

Update!


V1.1.0
 - Unplugged() member function added
 - Joysticks IDs now number from 0 on (this is a bit more consistent with the other functions)
 - EnableEvents() scope parameter added (now possible to add event function in roomscript)
 - buttons property made accesible
 - minor fixes
Life is like an adventure without the pixel hunts.

mode7

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • I can help with web design
    •  
    • mode7 worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #33 on: 19 Sep 2010, 17:54 »
Thanks a lot Wyz, for this great plugin.
Finally I managed to get it working and it works great.

There's only one thing I can't figure out now. Can I somehow assign a deadzone for the joysticks? Because e.g. joy.x always seems to return 1 or -1 which means that when I touch the stick a only a little the character will start moving.

I tried with

if (joy.x > 128)

but that doesn't seem to work.

Wyz

  • AGS Project Tracker Admins
  • anno 1986
    • I can help with making music
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #34 on: 20 Sep 2010, 00:46 »
You're welcome!

I guess the thing is that joy.x also is negative at some point. The value is between -JOY_RANGE and JOY_RANGE. JOY_RANGE is a constant you can use, it is a very big number, but you can do a conversion like this:
Code: Adventure Game Studio
  1. int x = joy.x / (JOY_RANGE / 256);
  2.  

x will then be between -256 and 256.

I hope that helps you :)

- Cheers
« Last Edit: 20 Sep 2010, 02:24 by Wyz »
Life is like an adventure without the pixel hunts.

Wyz

  • AGS Project Tracker Admins
  • anno 1986
    • I can help with making music
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #35 on: 20 Sep 2010, 02:17 »
I've made I tutorial with plenty examples:
- Finding joysticks
- Using the inputs
- Mapping inputs
- Analog to digital stick conversion
- Game lobby
- Point & Click games
and more :D

check it out:
AGSJoy Tutorial v1
« Last Edit: 12 Jan 2014, 14:30 by Wyz »
Life is like an adventure without the pixel hunts.

Snake

  • @_@
    • I can help with making music
    •  
    • I can help with story design
    •  
    • Snake worked on a game that was nominated for an AGS Award!
      Snake worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #36 on: 20 Sep 2010, 03:39 »
YAY!!

I will check it out soon :D Thank you VERY much!
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
    • tzachs worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #37 on: 20 Sep 2010, 17:42 »
This looks pretty cool, I will probably add this to AGS Footballer.
Too bad I have neither joystick nor a gamepad, so no way to test this...

<Noobish question>
I'm guessing there's no way to plug in your PS2/Wii controllers to the computer and use them as gamepads, right?
</Noobish question>

Wyz

  • AGS Project Tracker Admins
  • anno 1986
    • I can help with making music
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #38 on: 20 Sep 2010, 19:22 »
That's a good question actually. ;D
For PS2 controllers you need to buy an USB adapter. For Wii controllers however, if you have a bluetooth device installed you can download a piece of software to use it as gamepad.
Life is like an adventure without the pixel hunts.

tzachs

  • AGS Baker
  • Mittens Vassal
  • Parking Goat- games that goats like!
    • I can help with translating
    •  
    • tzachs worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #39 on: 20 Sep 2010, 22:34 »
Thanks for the reply, I'll have to look into it when I've got the time...