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

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
    •  

AGS Joystick

Want to use a joystick or gamepad in your game? With this plugin you can, check it out!

or

20 October 2010
v1.2.0
Tutorial v2

20 September 2010
v1.1.0
Tutorial v1

20 Augustus 2010
v1.0.0

Have fun!

- cheers
« Last Edit: 27 Oct 2017, 13:40 by Wyz »
Life is like an adventure without the pixel hunts.

Chrille

  • Mittens Earl
    • Chrille worked on a game that was nominated for an AGS Award!
      Chrille worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #1 on: 20 Aug 2010, 21:15 »
Awesome! I'm developing my game with a gamepad in mind.
GASPOP software
http://www.gaspop.com

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 #2 on: 20 Aug 2010, 21:37 »
AWESOME!
I will be trying this as soon as possible. Something like this has been on my wish list for years!
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

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 #3 on: 20 Aug 2010, 22:22 »
YAY MISTER WYZ!!! :D

*plugs his personal logitech*
No more military army stuff. I'm alive and back.

Re: [PLUGIN] Joystick / Game controller support!
« Reply #4 on: 21 Aug 2010, 00:00 »
Aw shit, now I have to go buy that Xbox 360 Controller that I've been trying to avoid ;). Excellent work! It's crazy to see all the useful plugins being released these weeks - a lot of them doing exactly the things that I wanted to add to my own plugin - wonderful to have all those new options.

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 #5 on: 21 Aug 2010, 02:12 »
Aw shit, now I have to go buy that Xbox 360 Controller that I've been trying to avoid ;). Excellent work! It's crazy to see all the useful plugins being released these weeks - a lot of them doing exactly the things that I wanted to add to my own plugin - wonderful to have all those new options.

Some people just want that "innovation" award or "best plugin" a lot! :D

*please don't be insulted, I'm only fooling around*
No more military army stuff. I'm alive and back.

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Tracker Admins
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with making music
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!
      Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #6 on: 22 Aug 2010, 05:51 »
Brilliant.  I've been wanting to write a native plugin (without the need for a separate dll) for ages but until that's possible this should do the trick.  I should've just done what you did but hey, nice work!

ThreeOhFour

  • AGS Baker
  • Wild colonial boy.
    • Lifetime Achievement Award Winner
    •  
    • ThreeOhFour worked on a game that was nominated for an AGS Award!
      ThreeOhFour worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #7 on: 22 Aug 2010, 06:38 »
I've wanted to build a gamepad/keyboard game for a while but haven't and now if I do I could be able to use gamepads with it which would be rad.

What I'm saying is: thanks.

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 #8 on: 22 Aug 2010, 10:44 »
Thanks for all the comments! I hope the plugin works out for you :)

Well the idea started when Abstauber released his platform engine and I was playing it and thought by myself: That would be awesome with a gamepad. But then I still had tons of other stuff to do. ;)

@Duals: I actually forgot all about them; now you mentioned... ;)
Life is like an adventure without the pixel hunts.

Wonkyth

  • Liscence to Misspell.
    • I can help with AGS tutoring
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #9 on: 22 Aug 2010, 11:20 »
Who'd rather play a platformer on a gamepad...? 
"But with a ninja on your face, you live longer!"

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 #10 on: 22 Aug 2010, 11:32 »
Who'd rather play a platformer on a gamepad...? 

I would.

Plan to take over the world using AGS:
-3D
-Gamepad
-TCP/IP
-Alpha Blending
-Bilinear resizing
-PHP
-Porn Theme for AGS Editor
No more military army stuff. I'm alive and back.

LUniqueDan

  • Bladerunnerianism - A lifestyle, a vow, a religion
Re: [PLUGIN] Joystick / Game controller support!
« Reply #11 on: 22 Aug 2010, 16:31 »
Yess! Yess! I waas desesperately looking for this since november 08.
That's going to be cool...

Thankx Wyz
"I've... seen things you people wouldn't believe. Destroyed pigeon nests on the roof of the toolshed. I watched dead mice glitter in the dark, near the rain gutter trap.
All those moments... will be lost... in time, like tears... in... rain."

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #12 on: 23 Aug 2010, 00:32 »
Brilliant.  I've been wanting to write a native plugin (without the need for a separate dll) for ages but until that's possible this should do the trick.  I should've just done what you did but hey, nice work!

Progz what do you mean by native plugin?

Does AGS support embedding plugins or something? Sorry i'm confused.

Re: [PLUGIN] Joystick / Game controller support!
« Reply #13 on: 23 Aug 2010, 04:49 »
Progz what do you mean by native plugin? Does AGS support embedding plugins or something? Sorry i'm confused.

Glad it wasn't just me. I wanted to ask the very same thing but figured, since I'm still a C++ n00b maybe it was a stupid question. ProgZ said "until that's possible" though, so I guess he means AGS currently does not have the required features for what he had in mind - whether it's plugin embedding or something else.

Gilbert

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #14 on: 23 Aug 2010, 05:06 »
Confused me as such too, but I think his "until it's possible" part meant that "it's not possible with the current version of AGS yet, but I'll do such a thing when this can be done in a future version". However, if this can be done in a future version, that means AGS ould support joysticks natively already, unless that said dll-less plugin (which should be called a script module instead) does management jobs like whether a button is held for a while or whether a QCF motion is detected.

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 #15 on: 04 Sep 2010, 03:26 »
I know I'll be burned at the stake for this, but, Wyz, have you made a tutorial/example project yet? I really want to use this but, being the simpleton that I am, it confuses me. Even someone making a video tutorial would help.

Also, I noticed this hasn't been moved to the modules/plugins section yet... :-*
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: [PLUGIN] Joystick / Game controller support!
« Reply #16 on: 04 Sep 2010, 04:42 »
Personally I'd just use JoyToKey. :P Good idea for a plugin though. Without actually looking at it, I'm guessing it would probably allow in-game configuration which would look nicer and more streamlined than saying "use [insert 3rd party controller mapping software here] for controller support".
User was banned for this post.

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 #17 on: 04 Sep 2010, 11:15 »
I know I'll be burned at the stake for this, but, Wyz, have you made a tutorial/example project yet?

Yes, it is most definitely on the list. I've got a few project that I need to finish first though, sorry to keep you waiting. :)

Personally I'd just use JoyToKey. :P Good idea for a plugin though. Without actually looking at it, I'm guessing it would probably allow in-game configuration which would look nicer and more streamlined than saying "use [insert 3rd party controller mapping software here] for controller support".

Yes there are many advantages over something like JoyToKey. The plugin suffers less latency and is a bit more streamlined but the biggest advantage I guess is it supports analogue sticks and throttles. It gives a bigger degree of control then just left, right, down, down-right etc. It also supports up to 16 game devices, although 2 will usually do. ;)
Life is like an adventure without the pixel hunts.

monkey0506

  • AGS Project Tracker Admins
  • Tasting the banhammer. Strangely, tastes like ham.
Re: [PLUGIN] Joystick / Game controller support!
« Reply #18 on: 04 Sep 2010, 13:32 »
the biggest advantage I guess is it supports analogue sticks and throttles. It gives a bigger degree of control then just left, right, down, down-right etc. It also supports up to 16 game devices, although 2 will usually do. ;)

Everything you said here, JoyToKey supports. As for latency I experience none with JoyToKey. Just saying.. ::)
User was banned for this post.

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 #19 on: 04 Sep 2010, 13:38 »
In that case, what have I been wasting my time on ;)
Life is like an adventure without the pixel hunts.

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...

DoorKnobHandle

  • Mittens Serf
    • DoorKnobHandle worked on a game that was nominated for an AGS Award!
      DoorKnobHandle worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #40 on: 12 Oct 2010, 14:49 »
This is awesome, planning on using this in a couple of projects! Is there any way you can get force feedback functionality in there?

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 #41 on: 13 Oct 2010, 15:48 »
Thanks!
Well force feedback is a story apart, it is capable of doing a great number of effects and has a quite large interface. It will be better off in a separate plugin; I like the plugin to be clean and simple. Maybe if more people are interested I'll make a plugin for it in the future. :)
Life is like an adventure without the pixel hunts.

DoorKnobHandle

  • Mittens Serf
    • DoorKnobHandle worked on a game that was nominated for an AGS Award!
      DoorKnobHandle worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #42 on: 13 Oct 2010, 23:17 »
Are you planning on making this plugin open source? Because I don't think it makes too much sense to have two separate plugins, on for the controller support and the other for force-feedback. I have no experience with this (but with Direct3D and DirectInput I do have some) and I would give it a try. I won't have the time to write my own gamepad plugin from ground up though. Of course, I don't wanna force you to release your source code. :D

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #43 on: 13 Oct 2010, 23:50 »
Take a look at this, Wyz:
http://blogs.msdn.com/b/pstubbs/archive/2006/02/13/531008.aspx

Lighting up the LEDs on the Xbox360 controller seems possible.

Agreed with dkh. Force feedback is essential.

Cheers,
Spakry.
« Last Edit: 13 Oct 2010, 23:53 by subspark »

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 #44 on: 14 Oct 2010, 01:34 »
I'm not that interested in lighting up leds on a specific game controller. ;)
There is more to haptic feedback then simply letting the motors roll. If I want to implement such thing, then I want the developer to have full access to it's capabilities. I wouldn't call it essential if you are still able to play a game without it.

I'm not ready to release the source at this time, I already had in mind to release the framework so it can be ported to different platforms in the future. I don't want to be a jerk and shut my ears for suggestions by other people, it is more an advice since I did read into this material when I was plotting the plugin. I also see that other wrapper libraries separate the haptic feedback from the actual input module, it seems a natural thing to do. There is just a lot more to haptic feedback then people think. (site I stumbled on)

But hey if you're willing to give it a shot anyway, I can always try to make the plugin work together with it and help with it.
Life is like an adventure without the pixel hunts.

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #45 on: 14 Oct 2010, 13:48 »
Quote
If I want to implement such thing, then I want the developer to have full access to it's capabilities
Well that was the intention. Dkh and I are working on a Street Fighter'esque arcade fighter and would really love to work with you to help develop and improve haptic feedback under one kick-ass plugin.

I can understand the light thing for now but ultimately, exploring the led switches is an interesting notion to us and might be something to explore further into the future.
For now, I really want to home in on great controller support for optimal gameplay feel, which is something your plugin is starting to give us even now! 8)

Hope we can help you develop it further for the community.

Cheers,
Sparky.

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Tracker Admins
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with making music
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!
      Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #46 on: 16 Oct 2010, 01:00 »
I like this so far but my main issue with this plugin is the sheer amount of damage control you need to employ to be able to even use the gamepad.  Example:

If you are allowing gamepad and/or keyboard control, instead of just having something like if(IsKeyPressed(eKeyA) || joy.IsButtonDown(0)) you literally have to split it off into two functions, the joypad one doing this first:

Code: Adventure Game Studio
  1. if(joy!=null)
  2. {
  3.  
  4.  
  5. }
  6.  
  7.  
  8.  


Otherwise any bit of code 'potentially' looking for button presses or joystick states crashes the game on run should the person not have a gamepad, period.  This shouldn't happen.  If there is no joystick plugged in, the IsButton/POV/etc calls should self-manage the null state internally and simply do nothing so you don't need to micromanage every call in this way, it's simply not reasonable the way it is now.   Also, I don't think it's really necessary to separate the POV hat into a separate call; IsButtonDown could just as easily handle it.

Also, support for connecting up gamepads AFTER the game has started would be good.  I tried making a function to do this with the opendefaultjoystick but once the game begins it seems to no longer be able to poll the device to see if it has been plugged in.

Hopefully a future version will address this since I was in the middle of implementing gamepad support but this development has made me strip it out again.
« Last Edit: 16 Oct 2010, 01:38 by ProgZmax »

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 #47 on: 16 Oct 2010, 14:03 »
I'm using some kind of wrapper to avoid too much error checking

Code: Adventure Game Studio
  1. function isControlDown() {
  2.   if (IsKeyPressed(eKeyDownArrow)) return true;
  3.   if (joy!=null && joy.Valid() && joy.> 10) return true;
  4. }
  5.  

Once you have all those functions done, you never have to look back again :)

« Last Edit: 16 Oct 2010, 14:41 by abstauber »

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 #48 on: 16 Oct 2010, 14:44 »
Well that was the intention. Dkh and I are working on a Street Fighter'esque arcade fighter and would really love to work with you to help develop and improve haptic feedback under one kick-ass plugin.
(...)
Hope we can help you develop it further for the community.

Sounds great! What I think I do is branch off the current plugin to a version that supports haptic feedback or whatever you want to put in there ;D
When you have something I'll add it to the interface and static link it to the DLL and put it up for the crowds (if that's fine by you). There are some issues because I'm using the native windows API, and it does not support force feedback, so I need to find a way to hook it up to direct input or Xinput.

(...)
Hopefully a future version will address this since I was in the middle of implementing gamepad support but this development has made me strip it out again.

You should have let me know that sooner man, I could easily have done something about that.
Well the first issue can be resolved using a wrapper function like abstauber shows. You can even use the function to put in button mapping.
Though I could make a dummy joystick that can always be opened if that helps...

POVs are essentially different from buttons since they have no up and down state. A POV control either points to a certain direction or is centered. Sure you can pretend each direction is a button, and if you like to do it you can make an extender function that does it. But this way you can write shortcuts like (POV & ePOVDown) which is nice.

Well the plugin will detect all installed joysticks (either plugged in or not). I see that that would pose a problem with USB devices that install itself automatically when plugged in. There is no way for the plugin to know when this happens. I could make a function that would flush the entire plugin, but it would leave all pointers dangling, not a very elegant solution.
Life is like an adventure without the pixel hunts.

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #49 on: 16 Oct 2010, 14:48 »
Agree with you guys on all points. I too, would like to see nicer internal handling of joypad mechanics.

I also thought that we could run code when a USB controller was plugged in during runtime.
I even made a series of fading icons for it. Now if only we can get them to work properly! :)

Edit: Great to see you online at exactly the same time as I am, Wyz. Dkh and I will have to chat first about all this then come back to you with a definitive answer.

Cheers,
Sparky.
« Last Edit: 16 Oct 2010, 14:51 by subspark »

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Tracker Admins
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with making music
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!
      Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support!
« Reply #50 on: 16 Oct 2010, 19:37 »
I'd definitely like to see it provide a dummy joypad if one isn't connected so I don't need another wrapper function.

Also, it would be nice if the gamepad buttons could have the option to simulate a mouse click as there are so many things in ags that react purely to ORIGINAL MOUSE CLICKS (like guis and dialogs, which do not respond to processclick for some arbitrary reason).  Support for this would make it possible to have a fully gamepad driven adventure game which as of this moment is not possible for the aforementioned reason (I realize you can get around standard gui clicks with GetGUIControlAt but it's extremely messy and does NOT work for dialog clicks).  Indeed, similar support for keypresses would be welcome also!

Thanks for the reply!
« Last Edit: 16 Oct 2010, 19:50 by ProgZmax »

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 #51 on: 18 Oct 2010, 01:23 »
I'm working on a version that addresses some of your problems. I'll test it some more tomorrow and release it.
Life is like an adventure without the pixel hunts.

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: [PLUGIN] Joystick / Game controller support!
« Reply #52 on: 18 Oct 2010, 02:08 »
Sounds fantastic Wyz. I can't wait to pump it into our fighting engine!

Cheers,
Sparky.

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
    •  

Update!


V1.2.0
 - dummy joystick device added (#id is -1)
 - Click(...) static method added
 - IsOpen(id) static method added
 - JoystickRescan() function added (returns true when new devices were found)
 - minor optimizations

Also changed the tutorial a bit to include the new functionality.
« Last Edit: 18 Oct 2010, 14:59 by Wyz »
Life is like an adventure without the pixel hunts.

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!
Super-Wyz  strikes again  :=


Just in any case you feel like leaving that project please make sure that you find a successor for this wonderful plugin.

....if just scorporius would have done that with his rain plugin.

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Tracker Admins
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with making music
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!
      Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Hooray!  Now if only we could make Display respond to a button press then that would be everything!

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
    •  
Super-Wyz  strikes again  :=


Just in any case you feel like leaving that project please make sure that you find a successor for this wonderful plugin.

....if just scorporius would have done that with his rain plugin.

Don't worry, unless I get hit by a truck the plugin does not die with me.  ;D
When I've got the feeling I've done all I wanted to do with it I'll either release it to the public or put it in the capable hand of someone else.

Hooray!  Now if only we could make Display respond to a button press then that would be everything!

Yes, if someone has any brilliant ideas how to interrupt Display messages please let me know. At this point I don't even know if it is possible to do with the plugin API. For the time being you can use the workaround defined in the tutorial (Room 9).
Life is like an adventure without the pixel hunts.

Shane 'ProgZmax' Stevens

  • Mittens Serf
  • AGS Project Tracker Admins
  • GARBAAAAAGE DAAAAAAY!
    • I can help with animation
    •  
    • I can help with characters
    •  
    • Lifetime Achievement Award Winner
    •  
    • I can help with making music
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • Shane 'ProgZmax' Stevens worked on a game that was nominated for an AGS Award!
      Shane 'ProgZmax' Stevens worked on a game that won an AGS Award!
Well, using SetSkipSpeech(0) as abstauber suggested will allow mouse buttons to skip Display, but not with joy.Click().  My guess is because Display actually full-on pauses the game aside from checking for user input so none of the player made calls go through.

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
EDIT: You know it should be possible to invent our own display system that could respond to input and that doesn't actually pause the game in such a brute force manner.

Yeah 'Display' is one of those old-world leftovers from last decade thats still actually quite useful but, until recently, not in a way that has proved to be a potentially disruptive system to manipluate.
If a workaround isn't discovered, CJ, could we get some kind of plugin input access to toggle display messages off? :)

Damn fine work, Wyz!

Sparky.
« Last Edit: 20 Oct 2010, 02:48 by subspark »

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
    •  
Thanks!
Well just for convenience let my post the work around here:

Code: Adventure Game Studio
  1. // this function will wait for any button input, similar to the WaitMouseKey(...) function
  2. function WaitMouseKeyJoy(int time, Joystick *j)
  3. {
  4.   int buttons = j.buttons;
  5.  
  6.   while (time)
  7.   {
  8.     if ((j.buttons ^ buttons) & j.buttons)
  9.       return (1);
  10.     else
  11.       buttons = j.buttons;
  12.    
  13.     if (WaitMouseKey(1))
  14.       return (1);
  15.    
  16.     if (time > 0)
  17.       time--;
  18.   }
  19.  
  20.   return (0);
  21. }
  22.  
  23. // Assumes you have a global open joystick instance called: joy
  24. function JDisplay(String message)
  25. {
  26.   int sw = (System.ScreenWidth/4) * 3;
  27.   int w = GetTextWidth(message, eFontFont0) + 14;
  28.   if (w > sw) w = sw;
  29.   int h = GetTextHeight(message, eFontFont0, w) + 7;
  30.  
  31.   DynamicSprite *sprite = DynamicSprite.Create(w+6, h+6, false);
  32.  
  33.   DrawingSurface *s = sprite.GetDrawingSurface();
  34.   s.Clear(16);
  35.   s.DrawingColor = 15;
  36.   s.DrawRectangle(1, 1, w+4, h+4);
  37.   s.DrawingColor = 16;
  38.   s.DrawStringWrapped(3, 3, w, eFontFont0, eAlignLeft, message);
  39.   s.Release();
  40.  
  41.   w = (System.ScreenWidth - w) / 2;
  42.   h = (System.ScreenHeight - h) / 2;
  43.   Overlay *overlay = Overlay.CreateGraphical(w, h, sprite.Graphic, false);
  44.  
  45.   WaitMouseKeyJoy(-1, joy);
  46.  
  47.   overlay.Remove();
  48.   sprite.Delete();
  49. }
  50.  

Ps.
I'm also eager to see that fighting game. I'm actually also working on one since long, but still too early to disclose any information. ;)
Life is like an adventure without the pixel hunts.

subspark

  • Some things, you just can't unsee.
    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Quote
I'm also eager to see that fighting game.
Thanks Wyz. There will be a press release soon about it.

Cheers,
Sparky.

icey games

  • It's the time of ICEY!!!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #61 on: 10 Dec 2010, 02:19 »
I'm sorry but I really have no clue how to set this up and I really want to try this. Can some one show me a full code of were every thing goes and I am using 1 controller BTW.

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! v1.2.0
« Reply #62 on: 11 Dec 2010, 16:32 »
Do the tutorials!

Code: Adventure Game Studio
  1. // room script file
  2.  
  3. Joystick *joy;
  4.  
  5. Joystick * OpenDefaultJoystick()
  6. {
  7.   Joystick *j;
  8.  
  9.   JoystickRescan();
  10.   int count = JoystickCount();
  11.  
  12.   int i = 0;
  13.   while (i < count)
  14.   {
  15.     j = Joystick.Open(i);
  16.    
  17.     if ((j != null) && j.Valid() && !j.Unplugged())
  18.       return (j);
  19.    
  20.     i++;
  21.   }
  22.   return (Joystick.Open(-1));
  23. }
  24.  
  25. function ScaleAxis(int x, int min, int max)
  26. {
  27.   return min + ((x + JOY_RANGE) / ((JOY_RANGE * 2) / (max - min)));
  28. }
  29.  
  30. function room_AfterFadeIn()
  31. {
  32.   joy = OpenDefaultJoystick();
  33. }
  34.  
  35. function room_RepExec()
  36. {
  37.   mouse.SetPosition(ScaleAxis(joy.x, 0, System.ScreenWidth),
  38.                     ScaleAxis(joy.y, 0, System.ScreenHeight));
  39.  
  40.   if (joy.IsButtonDown(0))
  41.     player.Walk(mouse.x, mouse.y, eNoBlock, eAnywhere);
  42. }
  43.  
  44. function room_Leave()
  45. {
  46.   joy.Close();
  47.   joy = null;
  48. }
  49.  
Life is like an adventure without the pixel hunts.

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #63 on: 20 Jan 2011, 03:59 »
I've been playing around with this plugin and it's really great so far, I think I have a pretty good grasp of its capabilities.

Two things: I assume there's no way to simulate a mouse click or keypress? When I use Display("bla"); I can't get rid of the text window using the Joystick it seems which makes the plugin almost useless due to having to replace Display and Say with custom functions.

I wrote this as part of a button mapping feature:

Code: Adventure Game Studio
  1. int noloopcheck WaitForJoyButton(Joystick*j, int b) {
  2.   int bc = j.ButtonCount;
  3.   bool exit;
  4.   int i, pressed;
  5.   while (!exit) {
  6.     // return button
  7.     if (b == -1) {
  8.       i = 0;
  9.       while (i < bc) {
  10.         if (j.IsButtonDown(i)) {
  11.           pressed = i;
  12.           i = bc;
  13.           exit = true;
  14.         }
  15.         i++;
  16.         Wait(1);
  17.       }
  18.     }
  19.     // wait for specific button
  20.     else {
  21.       if (j.IsButtonDown(b)) exit = true;
  22.     }
  23.   }
  24.   // wait for button to be no longer pressed
  25.   exit = false;
  26.   while (!exit) {
  27.     if (b == -1 && !j.IsButtonDown(pressed)) exit = true;
  28.     if (b >= 0 && !j.IsButtonDown(b)) exit = true;
  29.     Wait(1);
  30.   }
  31.   return pressed;
  32. }

Pretty simple stuff and it does work fine. The thing is just that due to the first Wait(1) sometimes a button press isn't detected when I quickly tap it. If I remove the Wait(1), the game simply hangs. Looks like the plugin interface doesn't get a chance to relay button presses anymore.
Do I have to revert to using on_joy_press? Because that doesn't work inside an additional script, only in Global.asc.

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! v1.2.0
« Reply #64 on: 21 Jan 2011, 02:18 »
Yes simulating mouse clicks is still an unresolved issue, but since it's really annoying you can't use Display. Well, when I have an idea how to work around it, I'll update the plugin. :)

For the button poller, hmm something that might work is using j.Update(); The function will update the button/axes state recorded by the plugin (similar to mouse.Update()). I hope it does. :)
Life is like an adventure without the pixel hunts.

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #65 on: 21 Jan 2011, 02:35 »
It's still a great module and everything else works flawlessly. If I'm going to use it in an actual game I'm pretty sure I'm not going to use the built-in Display and Say functions anyway.

I tried using j.Update(), it didn't make much of a difference though. Then I tried setting the game speed to 200 temporarily, and that worked pretty well; it's almost impossible to make it not detect a tap now.

Thanks for a great job; I'm pretty sure there's no way to make JoyToKey transfer the analog stick's tilt.

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! v1.2.0
« Reply #66 on: 22 Jan 2011, 15:05 »
Hey the GameSpeed trick is very useful, thanks for the tip! :D
Life is like an adventure without the pixel hunts.

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #67 on: 16 Mar 2013, 05:15 »
Sorry for the bump but the file is missing.

Anyone got a mirror?

Khris

    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
    • Khris worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #68 on: 16 Mar 2013, 10:48 »
Here you go:
https://www.dropbox.com/s/vcsn2gpsfeyietb/agsjoy.dll

This is version 1.0.0 from august 2010 though.

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #69 on: 24 Mar 2013, 09:49 »

GoToHellDave

  • Falchion Games: www.gotohelldave.co.uk
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #70 on: 16 Apr 2013, 15:13 »
Does anybody still have access to the tutorial for this? I'd really like to check it out and the links appear to be dead.

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! v1.2.0
« Reply #71 on: 16 Apr 2013, 16:16 »
Oh fudge, I forgot all about this. :-[

I've updated all the links in the first post; they should work now! (Thanks goes to Peder for hosting this)
Life is like an adventure without the pixel hunts.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #72 on: 16 Apr 2013, 20:51 »
BTW, in case anyone interested, I was able to test this plugin without real joystick, using this: http://headsoft.com.au/index.php?category=vjoy

Just saying ;).

Grim

  • *Dreamer Of The Day*
    • Grim worked on a game that was nominated for an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #73 on: 07 Apr 2016, 11:46 »
Sorry for the bump.

I'm using xbox 360 wireless controller and in the tutorial demo it doesn't seem to do anything. It says in the beginning the controller has been detected and it has 10 buttons. I skip those messages (with keyboard) and change rooms with keys 1-9 but in none of them my controller is able to work. It works normally, when I play games with it, so I'm guessing there's some kind of problem with it being compatible with AGS and the Joystick plugin... Any ideas? ( I assume it is possible normally to use it in the tutorial?).

EDIT: Tried different controller. It works. It seems only wired controllers are compatible for this.
« Last Edit: 07 Apr 2016, 16:41 by Grim »

Vincent

  • Jump back into the pond
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #74 on: 09 Apr 2016, 12:24 »
Hi guys, I'm sorry for this dumb question.

I'm trying to find an alternative to the standard function (WaitMouseKey) since it does not react any buttons with the controller.
I'm using the fantastic function that Wyz suggested to do, since it works perfectly. (WaitMouseKeyJoy)
The only little issue that I can not understand is why if I press the Axis they are not counted as buttons pressed in the function. :-\
So I was interested to ask you if there is a way to include the Axis as Buttons pressed somehow.

Code: Adventure Game Studio
  1. function WaitMouseKeyJoy(int time, Joystick *j)
  2. {
  3.   int buttons = j.buttons;
  4.  
  5.   while (time)
  6.   {
  7.     if ((j.buttons ^ buttons) & j.buttons)
  8.       return (1);
  9.     else
  10.       buttons = j.buttons;
  11.    
  12.     if (WaitMouseKey(1))
  13.       return (1);
  14.    
  15.     if (time > 0)
  16.       time--;
  17.   }
  18.  
  19.   return (0);
  20. }

Any kind of help is very welcome, many thanks guys in advance.

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! v1.2.0
« Reply #75 on: 10 Apr 2016, 01:54 »
Hmm yes that function does not regard axes as it is. :D It is possible to do so however but it is not trivial; you need to check for movement rather than a position. I've come up with a function but I did not have time to test it so let me know if it works or not.

Code: Adventure Game Studio
  1. // Amount of movement that triggers it, play with this
  2. // Find a middle ground that does not only work for your controller
  3. #define JOY_THRESHOLD 8192
  4.  
  5. function WaitMouseKeyJoyAxes(int time, Joystick *j)
  6. {
  7.   int buttons = j.buttons;
  8.   int p[] = new int [j.AxesCount];
  9.  
  10.   int i = j.AxesCount;
  11.   while (i > 0)
  12.   {
  13.     i--;
  14.     p[i] = j.GetAxis(i);
  15.   }
  16.  
  17.   while (time)
  18.   {
  19.     if ((j.buttons ^ buttons) & j.buttons)
  20.       return (1);
  21.     else
  22.       buttons = j.buttons;
  23.    
  24.     i = j.AxesCount;
  25.     while (i > 0)
  26.     {
  27.       i--;
  28.      
  29.       int axis = j.GetAxis(i);
  30.       int disp = axis - p[i];
  31.      
  32.       if (disp < 0)
  33.         disp = 0 - disp;
  34.      
  35.       p[i] = axis;
  36.      
  37.       if (disp >= JOY_THRESHOLD)
  38.         return (1);
  39.     }
  40.    
  41.     if (WaitMouseKey(1))
  42.       return (1);
  43.    
  44.     if (time > 0)
  45.       time--;
  46.   }
  47.  
  48.   return (0);
  49. }

I hope it helps. :)
« Last Edit: 10 Apr 2016, 19:24 by Wyz »
Life is like an adventure without the pixel hunts.

Vincent

  • Jump back into the pond
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #76 on: 10 Apr 2016, 11:25 »
Greetings Wyz, I would like to thank you very much for taking the time looking into this.
I have thoroughly enjoyed, thank you very much :)

I tried to test your new function but unfortunately it give me a persistent error.
Even change the value of our constant JOY_THRESHOLD it give the same error.
The script appears to be hung (a while loop ran 150001 times) the problem may be in a calling function.
Here is the line which generates the error :

Code: Adventure Game Studio
  1. #define JOY_THRESHOLD 8192
  2.  
  3. function WaitMouseKeyJoyAxes(int time, Joystick *j)
  4. {
  5.   int buttons = j.buttons;
  6.   int p[] = new int [j.AxesCount];
  7.  
  8.   int i = j.AxesCount;
  9.   while (i > 0)
  10.   {
  11.     i--;
  12.     p[i] = j.GetAxis(i);
  13.   }
  14.  
  15.   while (time)
  16.   {
  17.     if ((j.buttons ^ buttons) & j.buttons)
  18.       return (1);
  19.     else
  20.       buttons = j.buttons;
  21.    
  22.     i = j.AxesCount;
  23.     while (i > 0)
  24.     {
  25.       i--;
  26.      
  27.       int axis = j.GetAxis(i);
  28.       int disp = axis - p[i];
  29.      
  30.       if (disp < 0)
  31.         disp = 0 - disp;
  32.      
  33.       p[i] = axis;
  34.      
  35.       if (disp >= JOY_THRESHOLD)
  36.         return (1);
  37.      
  38.       i++;
  39.     }                              // <---------------------------- hung stuck
  40.    
  41.     if (WaitMouseKey(1))
  42.       return (1);
  43.    
  44.     if (time > 0)
  45.       time--;
  46.   }
  47.  
  48.   return (0);
  49. }


I tried it and perform the noloopcheck keyword between the function but in vain :)
I would be very glad if you can have the time to look into it.
Many thanks Wyz in advance, again. :)

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! v1.2.0
« Reply #77 on: 10 Apr 2016, 14:07 »
You need to add a noloopcheck thingie on the function.
No more military army stuff. I'm alive and back.

Vincent

  • Jump back into the pond
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #78 on: 10 Apr 2016, 15:23 »
Greetings Dualnames, thank you very much for your suggestion. :)
After further retested with the noloopcheck generates the same error.
It is strange because it hung even if I press a button instead of axes.
In both cases (with or without noloopcheck) the function crashes. :(

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! v1.2.0
« Reply #79 on: 10 Apr 2016, 19:27 »
Hah, teaches me not to post code that is untested. There is a copypasta mishap on line 38; get rid of the i++ there and it should work. :)
Life is like an adventure without the pixel hunts.

Vincent

  • Jump back into the pond
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #80 on: 10 Apr 2016, 21:29 »
Ciao Wyz. :)
I am gladly happy to say that the function doesn't crash anymore and the axes have their own reaction now. :)
I much appreciate the fantastic work that you have done. Thank you very much. :)

I hope you don't mind if I ask you another question. :-[

I think that there's a underlying issue that I hope is fixable.
When the axis is pressed there's no waiting actually. :(
Instead, when a button is pressed it works fantastically as it should be.

There is a way to wait for the axis to be pressed again to return with the script ?
(eg: as it happens with the buttons ?)

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! v1.2.0
« Reply #81 on: 13 Apr 2016, 17:14 »
Sorry for the bump.

I'm using xbox 360 wireless controller and in the tutorial demo it doesn't seem to do anything. It says in the beginning the controller has been detected and it has 10 buttons. I skip those messages (with keyboard) and change rooms with keys 1-9 but in none of them my controller is able to work. It works normally, when I play games with it, so I'm guessing there's some kind of problem with it being compatible with AGS and the Joystick plugin... Any ideas? ( I assume it is possible normally to use it in the tutorial?).

EDIT: Tried different controller. It works. It seems only wired controllers are compatible for this.

Is there a reason why this is happening i just had the issue reported on my side. Also can anyone/Grim run a figurative test to see what values the axis and the buttons get? Any ideas?

Actually nevermind, they do work, the problem lies with the Steam Controller, which cannot be detected through XInput, any ideas on that, does anyone actually own one?
« Last Edit: 14 Apr 2016, 03:53 by Dualnames »
No more military army stuff. I'm alive and back.

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #82 on: 20 Jul 2017, 02:23 »
Hey, is the source of this plugin available somewhere? Is it still working as of 2017, with PS4 gamepads and such?

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! v1.2.0
« Reply #83 on: 25 Jul 2017, 17:21 »
I noticed that the links in the first post were broken so I have re-uploaded both the plugin and the tutorial. Feel free to check them out! :) Oh, and if you do, please let me know as well; I'm curiousness myself whether they still work.

As for the source code: that is currently a complete mess so I can't really release that. I will probably revisit that someday in the future, there is also half an Linux port in there, but still a lot of work to get it up and running unfortunately. :(
Life is like an adventure without the pixel hunts.

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #84 on: 28 Jul 2017, 14:21 »
I use Linux too, half a Linux port that already builds a .so ?

Vincent

  • Jump back into the pond
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #85 on: 25 Aug 2017, 10:56 »
Hello to all AGSer and Wyz, I have found this kind of error recently. There is a way to fix it?
http://www.adventuregamestudio.co.uk/forums/index.php?topic=55164.0

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #86 on: 12 Sep 2017, 23:43 »


Hey, I have this error trying to run the tutorial project in the AGS Editor... Is it built with an ancient AGS version? :O

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #87 on: 13 Sep 2017, 00:41 »
Hey, I have this error trying to run the tutorial project in the AGS Editor... Is it built with an ancient AGS version? :O

This looks like a bug in AGS Editor.

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #88 on: 13 Sep 2017, 01:53 »
I opened each room .asc files, looked the source on notepad (ok, gedit) and built a game from scratch and it worked. It also worked on Windows. Yey. The error above is only for the provided tutorial game so I wouldn't worry about.
« Last Edit: 13 Sep 2017, 14:30 by eri0o »

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #89 on: 13 Sep 2017, 11:48 »
It appears that the old editor version string in this project has "SP1" added to the version digits, which cause exception at parsing. This will be fixed in 3.4.1 then.


BTW, Wyz, there is a crush dump file in the tutorial archive.
« Last Edit: 13 Sep 2017, 11:50 by Crimson Wizard »

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! v1.2.0
« Reply #90 on: 16 Sep 2017, 14:19 »
Yes the plug-in is 7 years old, so is the tutorial. Thanks for fixing the backwards compatibility CW!
I need to update and re-upload it someday (without crash dumps :-[) but still my time is fairly limited. I rather first make a complete port, which is a little more involved. For now you'll have to do with the files as is, sorry. :(
Life is like an adventure without the pixel hunts.

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #91 on: 16 Sep 2017, 17:08 »
Hey Wyz, I updated your tutorial code to load and run on AGS 3.4.1-7. I also switched the .dll for the one you shared with Vincent, from here. Maybe this is useful for someone else diving into your plugin.

Download AGSJoy Tutorial Game - AGS 3.4.1-Beta7

Also Wyz, if you ever find time to script, if you could add some code on what you would recommend to run before saving a game and after restore, that would be awesome.

Warning: To anyone wanting to load this tutorial, remember to copy the agsjoy.dll from the root project directory and place on your AGS Editor root folder (Ex: c:/Program Files/Adventure Game Studio 3.4.1).
« Last Edit: 16 Sep 2017, 17:27 by eri0o »

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! v1.2.0
« Reply #92 on: 18 Sep 2017, 01:16 »
Thanks for the updated version! I'll add the link to the first post if you don't mind.

Yes, after the last update the problems with storing and restoring games should be fixed. Additional code before saving and after loading games should technically not be required.
But indeed I do recommend a bit of code when games are restored. I find it hard to provide a general solution as it really depends on how you design your game. But let me give two examples; maybe this helps someone.

Game A
Game A is a single play game which can be played either by keyboard or optional a game controller. When the game starts it scans for available game controllers, and opens every one it finds. The keyboard inputs and the inputs from all controllers are mapped to the same outputs; for instance ASWD, the arrow keys, the d-pad of whichever joypad is connected, or the stick of some joystick connected: they all control the character's movement. In short, no configuration, the kind of setup I would describe as "just works". ;)
Now imagine the player restores a saved game; at this point game controllers may have been connected or unplugged. If you don't do anything "just works" becomes "doesn't work" :-D because Joystick objects from unavailable game controllers stop firing events, and newly connected ones are not being considered.
In that case I recommend you'd close all open Joystick objects, and run the same scan as at the beginning of the game again.

Game B
Game B is a multi-play single screen game which can be played by mouse, keyboard, or game controllers. At the beginning of the game each player selects an input device from a list of available ones (mouse, keyboard, optional game controllers). During the game players can open a menu which allows them to reconfigure (change the meaning of buttons of) their selected input device, or pick another one.
Now imagine the players load a stored game; at this point game controllers may have been connected or unplugged. It could be the case that one of the players uses a device no longer available.
In that case I recommend showing a warning when one of the Joystick objects has become invalid (scan through them at game restore), or perhaps open the configuration screen automatically.

Other options are possible of course; these are just examples. :)
Life is like an adventure without the pixel hunts.

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #93 on: 18 Oct 2017, 01:12 »
Wyz! The d-pad (POV) in my wired Xbox360 joystick doesn't work. Do you have any idea why?

Is there any possibility of releasing the joystick plugin source? I would like to play with maybe porting it to Linux.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #94 on: 19 Oct 2017, 17:31 »
Thanks for the updated version! I'll add the link to the first post if you don't mind.

"Premium Access Only
The free hosting period for this file has now expired, only premium users can download it.

Subscribe to a plan to download ($5/month)"

....maaaaybe you should find a different host for that :)

The one in the top post is still the 2010 version.

Aviva

    • I can help with animation
    •  
    • I can help with play testing
    •  
    • I can help with story design
    •  
    • I can help with translating
    •  
    • I can help with web design
    •  
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #95 on: 21 Oct 2017, 14:45 »
Wyz! The d-pad (POV) in my wired Xbox360 joystick doesn't work. Do you have any idea why?

Is there any possibility of releasing the joystick plugin source? I would like to play with maybe porting it to Linux.

The tutorial doesn't even recognize my Xbox 360 controller at all. So I can't test it at all as of now.
Working on "Drained", a distopian RPG

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! v1.2.0
« Reply #96 on: 21 Oct 2017, 20:58 »
Yes, I've heard about problems with Xbox 360 controllers left and right, and it is really puzzling because: one day it's all working fine, and then suddenly it is not. I even had people with multiple Xbox controllers where one never worked, and then suddenly it started working but the other one stopped. I'm not really doing anything special, and I'm simply using what Windows provides. There is something weird going on with the combination of AGS and the Windows drivers, but it is extremely difficult to pin down. Even more so since I don't own a Xbox controller, so I can not test it myself.

Wyz! The d-pad (POV) in my wired Xbox360 joystick doesn't work. Do you have any idea why?

Is there any possibility of releasing the joystick plugin source? I would like to play with maybe porting it to Linux.

The POV value does not respond to the D-pad at all? Hmmm, sometimes the D-pad is implemented as an analogue stick, so be sure to check all the axes. In rare cases the D-pad is implemented using buttons; be sure to check those as well. If none of the above respond to the D-pad something is amiss. Could be more Xbox controller shenanigans. :P

....maaaaybe you should find a different host for that :)

Sure; do you have suggestions?
Life is like an adventure without the pixel hunts.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
    • Radiant worked on a game that was nominated for an AGS Award!
      Radiant worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #97 on: 21 Oct 2017, 22:48 »
....maaaaybe you should find a different host for that :)

Sure; do you have suggestions?

Github? Same as the Steam plugin, seems to work fine for them.

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! v1.2.0
« Reply #98 on: 22 Oct 2017, 11:05 »
Unfortunately, GitHub is only free to use for open source projects, which this is as yet not, for reasons mentioned before.
Any other suggestions perhaps?
Life is like an adventure without the pixel hunts.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #99 on: 22 Oct 2017, 15:54 »
Unfortunately, GitHub is only free to use for open source projects, which this is as yet not, for reasons mentioned before.
Any other suggestions perhaps?

https://bitbucket.org/ allows private repositories with the limit of contributors access (up to 5 people, including you, I think).
It has a page for distributive uploads, but I do not remember if download links will work without private access, this is something to test out first.
« Last Edit: 22 Oct 2017, 16:12 by Crimson Wizard »

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #100 on: 22 Oct 2017, 18:20 »
Just put it on Dropbox?

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #101 on: 23 Oct 2017, 12:55 »
Hey Wyz, found a repo in github that may contain interesting code github.com/ThemsAllTook/libstem_gamepad

my storage suggestion is Google Drive if you already have gmail.

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! v1.2.0
« Reply #102 on: 24 Oct 2017, 11:06 »
All of my Dropbox accounts are filled to past the brim unfortunately. Hmmm,... Google Drive might be an option; I can make a new gmail account for that I guess. I'll look into that! Thanks all for the suggestions. :)

edit:
All updated! I've counted: this is the fifth time I had to swap over files to another host; pretty please Google, don't fail me. I can't stand doing it once more. (roll)
« Last Edit: 27 Oct 2017, 13:44 by Wyz »
Life is like an adventure without the pixel hunts.

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #103 on: 08 Apr 2018, 22:34 »
Dear Wyz,

if you ever have time, please share the code for the joystick plugin . :] I really would like to take a stab at making a Linux .so version . (roll)

Edit: Recently I discovered that launching a game from steam (you can add non-steam games to steam) makes steam filter the joystick first, like, a PS4 joystick for instance, is converted in a joystick that feels like Xbox360 when looking from the Joystick plugin!
« Last Edit: 28 Apr 2018, 18:22 by eri0o »

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #104 on: 30 Apr 2018, 00:50 »
I recently wanted to add joystick support in the Linux version of my game. I saw Until I Have You in my Steam library had it. Dualnames pointed me to qcaptain Nemo, and qcaptain Nemo was kind enough to provide me the source he wrote. He told me I could do what I want, and if I shared, I should stick a MIT license in it... So, here it is.

Github Repo | Release

When launching your game from command line, it will happily state Plugin 'agsjoy' loading succeeded, resolving imports... !

Just place the libagsjoy.so in your <Game Name>/Compiled/Linux/data/lib64 folder - I haven't yet built for 32-bits. :/

libagsjoy.so (64 bit)

Bear in mind this code uses SDL2, so your game will be dependant on SDL2 .

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #105 on: 30 Apr 2018, 01:33 »
Finally, good to know someone did this, I was about to suggest you writing your own using SDL, but looks like this is no longer needed :).

BTW, is it really Linux-only code? If that's SDL it could work on Windows too... probably.
« Last Edit: 30 Apr 2018, 01:35 by Crimson Wizard »

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #106 on: 30 Apr 2018, 04:29 »
Hey! You were right CW.  Now I just need someone to help me figure out how to fuse both Windows and Linux version in the same code and which ifdef can save me.

agsjoy.dll (SDL2 edition) | SDL2.dll (you need to download this one too!)

libagsjoy.so

I created a folder called WindowsVersion in my repo. Source available on Github (requires VS 2017 )

Note that feature parity with Wyz plugin hasn`t been reached yet.

Note: Build your game using Wyz's .dll and then switch in the game folder for this fall and SDL2.dll if you want to test it.

Edit:
I think to add each ePOV enumerator to the editor, to be compatible with Wyz's agsjoy, I would need to use something like editor->RegisterScriptHeader . The values I got from experiementing, but I don't know if I should get them from somewhere...

Edit2: has someone ever written a plugin for OSX? How does one build for it?
« Last Edit: 30 Apr 2018, 17:07 by eri0o »

Re: [PLUGIN] Joystick / Game controller support! v1.2.0
« Reply #107 on: 19 May 2018, 23:59 »
New 0.2.1 release | github repository

Windows build: agsjoy.dll (SDL2 edition) | SDL2.dll (you need to download this one too!)

Linux build: libagsjoy.so

MAC OSX build: libagsjoy.dylib

feature parity with Wyz plugin hasn't been reached yet.

Note:
  • For Windows Build your game using Wyz's .dll and then switch in the compiled game folder for this agsjoy.dll and SDL2.dll if you want to test it.
  • For Linux, just place libagsjoy.so in the same folder as the binary ags (if you are building the Engine yourself) or in Compiled/Linux/data/lib64 if you are using prebuilt Linux right from the Editor. SDL2 must either be installed through your package manager or the game should be loaded through Steam.
  • For MAC OSX I don't know yet, but it should be working. Requires SDL2 too.

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! v1.2.0
« Reply #108 on: 21 May 2018, 16:43 »
Ok, I've just read the developments here. I have been disconnected from the world for a while, my apologies. I saw your PM earlier eri0o; I have responded to it.
Let me state a couple of things I wrote him.

I have just released my incomplete refactor of the Joystick plugin what was going to be version 1.3.0. As the name suggests it is in an unfinished state; life happened unexpectedly, and I had to stop working on it.
This version has a nice build system and supports building multi-platform. That also allows adding SDL as a platform bypassing any unfinished code. So I've prepped for this and put it up on GitHub.

However, this version does not help reverse engineering the plugin I guess; so if you want sources for 1.2.x, please PM me. I don't want to release them though.

I do want to finish it in the future, but it seems unfair to let you all wait. I hope this helps at least.

And the repo: https://github.com/FTPlus/agsjoy
Life is like an adventure without the pixel hunts.