[PLUGIN] Joystick / Game controller support! v1.2.0

Started by Wyz, Fri 20/08/2010 19:43:43

Previous topic - Next topic

Wyz



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
Life is like an adventure without the pixel hunts.

Chrille

Awesome! I'm developing my game with a gamepad in mind.
GASPOP software
http://www.gaspop.com

Snake

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

YAY MISTER WYZ!!! :D

*plugs his personal logitech*
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

GarageGothic

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

Quote from: GarageGothic on Sat 21/08/2010 00:00:47
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*
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Shane 'ProgZmax' Stevens

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

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

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

Who'd rather play a platformer on a gamepad...? 
"But with a ninja on your face, you live longer!"

Dualnames

Quote from: wonkyth on Sun 22/08/2010 11:20:09
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
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

LUniqueDan

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

Quote from: ProgZmax on Sun 22/08/2010 05:51:21
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.

GarageGothic

Quote from: Calin Leafshade on Mon 23/08/2010 00:32:39Progz 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

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

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

Wyz

Quote from: Snake on Sat 04/09/2010 03:26:44
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. :)

Quote from: monkey_05_06 on Sat 04/09/2010 04:42:20
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

Quote from: Wyz on Sat 04/09/2010 11:15:46the 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.. ::)

Wyz

In that case, what have I been wasting my time on ;)
Life is like an adventure without the pixel hunts.

Dualnames

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. ;)
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Snarky

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

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 :)


Icey


Dualnames

Quote from: Snarky on Sat 04/09/2010 23:29:05
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
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

monkey0506

#26
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

Dualnames

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.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Snake

#28
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...
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Wyz

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

Quote from: Wyz on Wed 08/09/2010 18:43:18
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

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



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

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

#34
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: ags

int x = joy.x / (JOY_RANGE / 256);


x will then be between -256 and 256.

I hope that helps you :)

- Cheers
Life is like an adventure without the pixel hunts.

Wyz

#35
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
Life is like an adventure without the pixel hunts.

Snake

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

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

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

Thanks for the reply, I'll have to look into it when I've got the time...

DoorKnobHandle

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

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

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

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

Wyz

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

QuoteIf 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

#46
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: ags

if(joy!=null)
{


}





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.

abstauber

#47
I'm using some kind of wrapper to avoid too much error checking

Code: ags

function isControlDown() {
  if (IsKeyPressed(eKeyDownArrow)) return true;
  if (joy!=null && joy.Valid() && joy.> 10) return true;
}


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


Wyz

Quote from: subspark on Thu 14/10/2010 13:48:02
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.

Quote from: ProgZmax on Sat 16/10/2010 01:00:22
(...)
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

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

Shane 'ProgZmax' Stevens

#50
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!

Wyz

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

Sounds fantastic Wyz. I can't wait to pump it into our fighting engine!

Cheers,
Sparky.

Wyz



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.
Life is like an adventure without the pixel hunts.

abstauber

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

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

Wyz

Quote from: abstauber on Mon 18/10/2010 15:13:15
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.

Quote from: ProgZmax on Tue 19/10/2010 07:05:50
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

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

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.

Wyz

Thanks!
Well just for convenience let my post the work around here:

Code: ags

// this function will wait for any button input, similar to the WaitMouseKey(...) function
function WaitMouseKeyJoy(int time, Joystick *j)
{
  int buttons = j.buttons;
  
  while (time)
  {
    if ((j.buttons ^ buttons) & j.buttons)
      return (1);
    else
      buttons = j.buttons;
    
    if (WaitMouseKey(1))
      return (1);
    
    if (time > 0)
      time--;
  }
  
  return (0);
}

// Assumes you have a global open joystick instance called: joy
function JDisplay(String message)
{
  int sw = (System.ScreenWidth/4) * 3;
  int w = GetTextWidth(message, eFontFont0) + 14;
  if (w > sw) w = sw;
  int h = GetTextHeight(message, eFontFont0, w) + 7;
  
  DynamicSprite *sprite = DynamicSprite.Create(w+6, h+6, false);
  
  DrawingSurface *s = sprite.GetDrawingSurface();
  s.Clear(16);
  s.DrawingColor = 15;
  s.DrawRectangle(1, 1, w+4, h+4);
  s.DrawingColor = 16;
  s.DrawStringWrapped(3, 3, w, eFontFont0, eAlignLeft, message);
  s.Release();
  
  w = (System.ScreenWidth - w) / 2;
  h = (System.ScreenHeight - h) / 2;
  Overlay *overlay = Overlay.CreateGraphical(w, h, sprite.Graphic, false);
  
  WaitMouseKeyJoy(-1, joy);
  
  overlay.Remove();
  sprite.Delete();
}


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

QuoteI'm also eager to see that fighting game.
Thanks Wyz. There will be a press release soon about it.

Cheers,
Sparky.

Icey

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

Well since I've had this request before a simple JustWorksâ,,¢ implementation. But still Do the tutorials!

Code: ags

// room script file

Joystick *joy;

Joystick * OpenDefaultJoystick()
{
  Joystick *j;
  
  JoystickRescan();
  int count = JoystickCount();
  
  int i = 0;
  while (i < count)
  {
    j = Joystick.Open(i);
    
    if ((j != null) && j.Valid() && !j.Unplugged())
      return (j);
    
    i++;
  }
  return (Joystick.Open(-1));
}

function ScaleAxis(int x, int min, int max)
{
  return min + ((x + JOY_RANGE) / ((JOY_RANGE * 2) / (max - min)));
}

function room_AfterFadeIn()
{
  joy = OpenDefaultJoystick();
}

function room_RepExec()
{
  mouse.SetPosition(ScaleAxis(joy.x, 0, System.ScreenWidth), 
                    ScaleAxis(joy.y, 0, System.ScreenHeight));
  
  if (joy.IsButtonDown(0))
    player.Walk(mouse.x, mouse.y, eNoBlock, eAnywhere);
}

function room_Leave()
{
  joy.Close();
  joy = null;
}
Life is like an adventure without the pixel hunts.

Khris

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: ags
int noloopcheck WaitForJoyButton(Joystick*j, int b) {
  int bc = j.ButtonCount;
  bool exit;
  int i, pressed;
  while (!exit) {
    // return button
    if (b == -1) {
      i = 0;
      while (i < bc) {
        if (j.IsButtonDown(i)) {
          pressed = i;
          i = bc;
          exit = true;
        }
        i++;
        Wait(1);
      }
    }
    // wait for specific button
    else {
      if (j.IsButtonDown(b)) exit = true;
    }
  }
  // wait for button to be no longer pressed
  exit = false;
  while (!exit) {
    if (b == -1 && !j.IsButtonDown(pressed)) exit = true;
    if (b >= 0 && !j.IsButtonDown(b)) exit = true;
    Wait(1);
  }
  return pressed;
}


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

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

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

Hey the GameSpeed trick is very useful, thanks for the tip! :D
Life is like an adventure without the pixel hunts.

Calin Leafshade

Sorry for the bump but the file is missing.

Anyone got a mirror?

Khris



GoToHellDave

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

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

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

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.

Vincent

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: ags

function WaitMouseKeyJoy(int time, Joystick *j)
{
  int buttons = j.buttons;
  
  while (time)
  {
    if ((j.buttons ^ buttons) & j.buttons) 
      return (1);
    else
      buttons = j.buttons;
    
    if (WaitMouseKey(1))
      return (1);
    
    if (time > 0)
      time--;
  }
  
  return (0);
}


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

Wyz

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: ags

// Amount of movement that triggers it, play with this
// Find a middle ground that does not only work for your controller
#define JOY_THRESHOLD 8192

function WaitMouseKeyJoyAxes(int time, Joystick *j)
{
  int buttons = j.buttons;
  int p[] = new int [j.AxesCount];
  
  int i = j.AxesCount;
  while (i > 0)
  {
    i--;
    p[i] = j.GetAxis(i);
  }
  
  while (time)
  {
    if ((j.buttons ^ buttons) & j.buttons)
      return (1);
    else
      buttons = j.buttons;
    
    i = j.AxesCount;
    while (i > 0)
    {
      i--;
      
      int axis = j.GetAxis(i);
      int disp = axis - p[i];
      
      if (disp < 0)
        disp = 0 - disp;
      
      p[i] = axis;
      
      if (disp >= JOY_THRESHOLD)
        return (1);
    }
    
    if (WaitMouseKey(1))
      return (1);
    
    if (time > 0)
      time--;
  }
  
  return (0);
}


I hope it helps. :)
Life is like an adventure without the pixel hunts.

Vincent

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: ags

#define JOY_THRESHOLD 8192

function WaitMouseKeyJoyAxes(int time, Joystick *j)
{
  int buttons = j.buttons;
  int p[] = new int [j.AxesCount];
  
  int i = j.AxesCount;
  while (i > 0)
  {
    i--;
    p[i] = j.GetAxis(i);
  }
  
  while (time)
  {
    if ((j.buttons ^ buttons) & j.buttons)
      return (1);
    else
      buttons = j.buttons;
    
    i = j.AxesCount;
    while (i > 0)
    {
      i--;
      
      int axis = j.GetAxis(i);
      int disp = axis - p[i];
      
      if (disp < 0)
        disp = 0 - disp;
      
      p[i] = axis;
      
      if (disp >= JOY_THRESHOLD)
        return (1);
      
      i++;
    }                              // <---------------------------- hung stuck
    
    if (WaitMouseKey(1))
      return (1);
    
    if (time > 0)
      time--;
  }
  
  return (0);
}



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

You need to add a noloopcheck thingie on the function.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Vincent

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

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

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

#81
Quote from: Grim on Thu 07/04/2016 11:46:31
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?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

eri0o

Hey, is the source of this plugin available somewhere? Is it still working as of 2017, with PS4 gamepads and such?

Wyz

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.

eri0o

I use Linux too, half a Linux port that already builds a .so ?

Vincent

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

eri0o



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

Quote from: eri0o on Tue 12/09/2017 23:43:10
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.

eri0o

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.

Crimson Wizard

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

Wyz

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.

eri0o

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

Wyz

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.

eri0o

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

Quote from: Wyz on Mon 18/09/2017 01:16:15
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

Quote from: eri0o on Wed 18/10/2017 01:12:33
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

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.

Quote from: eri0o on Wed 18/10/2017 01:12:33
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

Quote from: Radiant on Thu 19/10/2017 17:31:56
....maaaaybe you should find a different host for that :)

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

Radiant

Quote from: Wyz on Sat 21/10/2017 20:58:30
Quote from: Radiant on Thu 19/10/2017 17:31:56
....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

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

#99
Quote from: Wyz on Sun 22/10/2017 11:05:40
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.

Snarky


eri0o

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

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)
Life is like an adventure without the pixel hunts.

eri0o

#103
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!

eri0o

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

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

eri0o

#106
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?

eri0o

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

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.

Vincent

Hello guys and Wyz, I think I have find an issue which I don't know how to fix at the moment. One of my friend which I am working with has sent me a saved game data of our game for testing purpose. Now whenever I try to load the saved game data I get these message from Ags (3.2.1).

If I try to load the game when the editor is opened:




If I try to load the game from the .exe file:


Wyz

Hmm which version of the plug-in are you using? Do you perhaps know if the game was using more than one Joystick at the time the savegame was made?
I can see how the second error might occur, but the first one is a bit puzzling. :-\
Life is like an adventure without the pixel hunts.

Crimson Wizard

Idk what kind of game setup you have there, but the first error may also mean that the save was done running a game with different exe name, and it tries to find and run that game data.

Vincent

@Wyz: I am using the version 1.2.1.0 it is dated 01/09/2017. I remember you have done a fixed version for me two years ago or something and it is what I am using right now. When the game was saved from my friend no joystick were plugged in. If I try to load the game with a joystick plugged in then I got a different message from Ags (if you would like I can provide this error message too). The first problem is a bit puzzling for me too since in my game I am not calling any "RunAgsGame" function so I am just wondered why this is happening!?

@Crimson Wizard: What you mean by what kind of game setup I have? Me and my friend are using the same version (Ags 3.2.1) same name of the game and same scripts. I'm really surprised that this isn't working. This must have something to do with the plugin problem, maybe if we can cure it then the game can loaded correctly.

Wyz

Hmm I see. Yes that error message would probably help a lot, thanks! :)
Well, save games are a delicate thing, and moving them between machines could unearth all sorts of subtle and hard to reproduce errors. ;)
Life is like an adventure without the pixel hunts.

Vincent

Yes I can understand what you mean. If somehow it cannot be solved then is just okay. If I try to load the game with a joystick plugged in while the editor is opened I still get the same message regarding "RunAgsGame". But if I try to load the game with a joystick plugged in from the .exe file then I get this error message:


Crimson Wizard

#115
Quote from: Vincent on Mon 08/04/2019 09:12:36The first problem is a bit puzzling for me too since in my game I am not calling any "RunAgsGame" function so I am just wondered why this is happening!?

RunAGSGame is also called automatically under following condition: if the save was made when main game file (for example - exe) had one name, but you are loading it with another. It's some old logic that had its reasons.

It may be easier to find out what's going on if you open your savegame in a hex editor, or even simple text editor, and search for anything that looks like a filename, it should be somewhere at the beginning of the file.

Vincent

Quote from: Crimson Wizard on Mon 08/04/2019 11:18:31
RunAGSGame is also called automatically under following condition: if the save was made when main game file (for example - exe) had one name, but you are loading it with another. It's some old logic that had its reasons.

I don't know if all of this has something to do with the joystick plugin but the exe file it is called in the same way.

Quote from: Crimson Wizard on Mon 08/04/2019 11:18:31
It may be easier to find out what's going on if you open your savegame in a hex editor, or even simple text editor, and search for anything that looks like a filename, it should be somewhere at the beginning of the file.

I have opened the savegame with a text editor and this is what I have:







I can see the name of the game and the description we used into the saved game file but I can't see anything which is wrong with them.

Crimson Wizard

#117
I don't think this particular error (with RunAGSGame) is related to plugin, but I may be wrong.

Regarding save contents: try to search for ".exe" or ".ags" or "*.dat". There should also be engine's version nearby, something like 3.21.1111 or with slightly different numbers).

Vincent

I was just able to find a line from the search ".exe" but nothing regarding the other two.


Crimson Wizard

Ok, so "Tales of Jayvin.exe" is your real current exe name?

Dumb question, do you have any extra files in Compiled folder, _Debug folder or project root, that may be left from other games or other version of this game?

Vincent

#120
Yes that's the real current name of the exe file. Me and my friend are using the same project file. I dont have any other extra files apart from agsjoy.dll and a .dat file.

@Wyz: My apologies. When the saved game was made a joystick was plugged in.


Now my friend on his version is trying to load the game without joystick and he is getting this error message:



I also just realize that this exactly the same problem we had two years ago: https://www.adventuregamestudio.co.uk/forums/index.php?topic=55164.0

Wyz

Ah yes, this is a rather generic error something along the lines of: "You tried to use an object that no longer exists". Could it be the same problem as before? Have a look out for any piece of code that might use a Joystick object that is invalid (so .Valid() would return false). There could perhaps something in repeatedly_execute that runs before the game restore event has a chance to do checks; I don't exactly know the order of events in AGS. There might still be a bug in the plugin though; just checking. :)
Life is like an adventure without the pixel hunts.

Vincent

Quote from: Wyz on Mon 08/04/2019 16:48:30
Ah yes, this is a rather generic error something along the lines of: "You tried to use an object that no longer exists". Could it be the same problem as before? Have a look out for any piece of code that might use a Joystick object that is invalid (so .Valid() would return false). There could perhaps something in repeatedly_execute that runs before the game restore event has a chance to do checks; I don't exactly know the order of events in AGS. There might still be a bug in the plugin though; just checking. :)

The problem seems to be really similar to the one we had some time ago. I remember that the problem was fixed when you shared a new version of the plugin. I am still using the new version of the plugin which you provided so I am sure that we are using the latest version of the plugin but now it doesn't seems to work anymore for some strange reasons. My friend pointed out to me that somehow the numbers that come out in the error message are different from those reported two years ago.

Indra Anagram

Good morning/afternoon/evening/night to all AGSers!

People, does anyone have all this plugin versions and tutorials? The links in the original post lead to Google Drive page that doesn't allow me to download anything, saying I've got no access  :~(

Please share the files or a working link to the repository. I've read there were modified versions made by other developers, but I'm talking about the original versions that work in AGS Editor 3.1, 3.2, 3.4 and 3.5. Not so sure about mods  :-\
Did the old man and woman abuse Gingerbread Man?

deadsuperhero

Quote from: Indra Anagram on Tue 09/08/2022 14:04:32
People, does anyone have all this plugin versions and tutorials? The links in the original post lead to Google Drive page that doesn't allow me to download anything, saying I've got no access  :~(

Hey, I don't think this is actively developed anymore. Your best bet might be to instead use this plugin developed by Dualnames.
The fediverse needs great indie game developers! Find me there!

SMF spam blocked by CleanTalk