[SOLVED] GamePad - Erratic Dpad Input

So, to start, I’ve tried this with multiple different gamepads as well as multiple linux machines (one was Arch Linux the other Ubuntu). This is in MonoGame 3.5.1 with the mono 4.6.1 installed.

To start I’ll post the code I’m using to generate the output I will list.

GamePadState state = GamePad.GetState (PlayerIndex.One);
Console.WriteLine ("Right: "+state.DPad.Right);
Console.WriteLine ("Down: "+state.DPad.Down);
Console.WriteLine ("Left: "+state.DPad.Left);
Console.WriteLine ("Up: "+state.DPad.Up);

The behavior is kinda confusing, but there is sort of a pattern. I’ll just post the results.

When I hold Right:

Right: Released
Down: Pressed
Left: Released
Up: Released

When I release Right:

Right: Pressed
Down: Released
Left: Released
Up: Released

When I hold Down:

Right: Pressed
Down: Released
Left: Released
Up: Released

When I release Down:

Right: Released
Down: Pressed
Left: Released
Up: Released

And that’s basically how the pattern goes. If you hold a direction down, it thinks you are holding a different direction, then when you release the direction button, it think’s you are holding it down untill you press another button.

Does anybody have any thoughts on this? I can play other games as well as navigate steam big picture with my gamepad so I know it’s nothing to do with the gamepad or the linux configuration.

Thanks

So MonoGame 3.5 was using OpenTK for gamepad input, which was really flawed in many ways and didn’t have that many predefined configs. With MonoGame 3.6 (the development branch right now) OpenTK has been replaced with SDL, which should support any major brand controller out of the box. This also means that it will pick up any gamepad you configure in Steams big picture mode (in case the game is launched from Steam), and you can also call SDL_GameControllerAddMapping in case you want to add a custom mapping.

That sounds awesome!

So I guess that just leaves me with a question. I’m starting to port a game of mine to MonoGame, should I just keep using 3.5 until 3.6 is released? Or is the development branch stable enough that I could go ahead and use that now?

I would recommend using the development branch.

Hmm, I’ve been trying to get it working for a while with no luck.

I saw in another post it requires MonoDevelop 6.0, I’m on Arch Linux, there’s no 6.0 package yet and I’m having no luck compiling it from source.

Is there any super simple instructions to using the developer branch of MonoGame in my project? I’m still fairly new to using C# in general.

Coincidently I am also using Arch Linux :slight_smile:

Anyway use https://aur4.archlinux.org/packages/monodevelop-stable/ and in case you don’t want to build from source, look at the pinned comment, it gives you a repo you can add to the /etc/pacman.conf file.

Create a new project and copy your files to it, it’s the easiest way to convert a project to a different version of MonoGame. I would also recommend doing: linux - Setup project Cross-Platform with Monogame - Stack Overflow

That’s funny that you give me that info on the monodevelop-stable. I was trying to build using https://aur.archlinux.org/packages/monodevelop-git/ and you can see my comments there as asojka09 where I talk about the build failure error (which I also experience when I try monodevelop-stable). But now that I understand it’s available without building from source I’ll do that.

Thanks for the info, I’ll try it later and post back if/when I get it working.

Neat, I set up Arch on my machine last week and ran into the same issue. Thanks @harry-cpp! :slight_smile:

If you install as described in the pinned comment, make sure you install pkgbuild-current/monodevelop or you’ll get the (outdated) one from the official repository. I tried to build first too and ran into the same issue as you, but with the prebuilt package it works :slight_smile:

Alright, I finally got around to installing the latest version of MonoDevelop and MonoGame and I can confirm that it does indeed fix my gamepad issue. Thank you very much!