🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Input Devices, a work in progress.

Published May 12, 2020
Advertisement

Welcome back to Creating Valkyrie, and thanks for everyone that follows this blog, as it passed 25,000 views this week. Posting here is helpful to me to vent during the stress of the creative process and hopefully it helps some of you in your own struggles as well. Whatever your reason for following this, thank you. The Valkyrie.Controls library is starting to take shape and is in test-driven development, and the runtime handlers for different input devices are mostly in place in the App. What remains now is drilling to the bottom of some confusing issues concerning the acutal peripherals and how to access their data

Gamepads

Through a little research I have found that Microsoft has released a freeware implementation of its XNA4 API called MonoGame, and this has excellent built-in support for Gamepads. XNA4 has been likened to the successor of DirectX, and seems to have been targeted primarily at the indy game ecosystem. I am unsure weather I can use this code outside of a MonoGame executable though. It does not come installed in Visual Studio 2019 by default so I am downloading the 3.7.1 executable now and will see what I can learn about it.

Keyboards

I have found that there is a Xamarin.Forms.Keyboard class, although its documentation is limited nad I'm not sure if this will automatically map to a hardware / USB keyboard or display a pop-up vitual one. I did at least learn that Xamarin.Essentials can determine which "idiom" its native runtime environment is. For instance Desktop (in which case the default input is now Keyboard) or Phone, in which case the default input is the virtual gamepad.

Virtual Gamepad

The buttons I put on the GamePage.xaml are at least already there and just waiting for me to come up wiht a better way to route their input to control 1 specific Actor in the GPVM.Actors List. I have come up with a way to recognize chains of input like the SF:II Hadoken combo "D, DR, R +B". There's a short time window in which successive button presses will be considered simultaneous ("A + B"). A second broader window which will consider them sequential ("A, B"). And finally a 250ms window after which input recognition resets.

I'm getting tripped up on the lower level input handling. In GamePage's main loop, each actor in GPVM.Actors will have its input string evaluated and game logic permitting, will start to be moved or animated and have actions like attacks resolved. But how do I differentiate movement commands from action commands, and can I evaulate both at once? This calls for some kind of Command class I think, but I haven't been able to sit down and just think about this one lately – I've had a house full of kids. I let them watch Chitty Chitty Bang Bang a few months ago and it struck me as a much different movie now, all these years later. How did Mr Potts have time to invent anything? Easy, his kids were playing in junkyards and traffic and he could just leave them with Grandpa for a week at a time while he worked :\

Next Entry Time Out
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement