User Tag List

Page 1 of 7 1 2 3 ... LastLast
Results 1 to 10 of 68

Thread: VACCiNE - a universal gamepad and debugger engine

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,245
    Mentioned
    87 Post(s)
    Tagged
    0 Thread(s)

    VACCiNE - a universal gamepad and debugger engine

    I'm pleased to release VACCiNE (Volnaiskra's All-purpose Customisable Controller & iNfo Engine). It's a combination of a couple of systems I've developed for my own game Spryke over the past couple of years. I figured they'd be useful to others too, so I've spent the past week or two cleaning it up, adding more features, and commenting everything.

    UPDATE Oct 2017: VACCiNE 2 is out. It's a greatly improved version of VACCiNE that looks better, runs faster, does more stuff, and is easier to use. The VACCiNE 2 forum thread is here. You can get VACCiNE 2 at the Clickstore for $3.99. The original VACCiNE still is, and always will be, free.


    What is VACCiNE? (the short version)

    VACCiNE is a handy bit of Fusion code that makes pretty much every gamepad under the sun work out-of-the-box and flawlessly with your Fusion PC game. It greatly simplifies the work required for your game to have robust gamepad and keyboard controls. It also provides a sophisticated in-game debugging panel that you can fill with useful info, to help you monitor the nuts and bolts of your game. VACCiNE does all this with regular, well-commented Fusion code, and regular Fusion Active Objects, meaning that you can easily enable/disable/customise/expand any part of it to suit your own project. It's designed to be as simple as possible, though an intermediate level of familiarity with Fusion is recommended.



    The following gamepads have been confirmed to work out-of-the-box with VACCiNE (tested on win 7 & win 10):
    Xbox 360
    Xbox One
    Xbox One Wireless
    Xbox One Elite
    Logitech F310
    PS4



    VACCiNE Overview (watch the video)




    What is VACCiNE? (the long version)

    Traditionally, getting gamepads to work reliably with Fusion has been a pain. The XBOX Gamepad object is severely limited. The more robust Joystick 2 object is a confusing mess. It's confusing enough with just an Xbox 360 gamepad, but once you throw Xbox One, PS3 & PS4 gamepads into the mix, plus multiple versions of Windows, it becomes a nightmare. Values are all over the place, data labels are meaningless, and everything works differently from everything else, resulting in conflicts and confusion. Let me give you a taste:

    *deep breath*

    The PS4 joystick gives you both 8-directional and 360-degree values. But you have to press the stick significantly harder to register the 8dir one. 8dir starts at 0 but 360deg starts at -1, and while one goes clockwise, the other goes anticlockwise. But at least they both start at east. Unless you're talking about the right joystick, in which case they both start at south. Just for fun, the dpad starts from north. If you want to know how hard you're pressing either of the sticks, you'll need to calculate it yourself from the X and Y values. The X and Y values from the left stick are given as RawX and RawY, and both go from -1000 to 1000. On the other hand, the X and Y values of the right stick are given as RawZ and RawZrotation. Like RawX and RawY, RawZ goes from -1000 to 1000, but RawZrotation (which actually has nothing to do with rotation) likes to really express itself, so goes from 0 to 65535. But at least the use of RawZRotation doesn't conflict with the Xbox gamepads, which the use of RawZ does, since RawZ is what Xbox uses for the triggers (well, unless a player is on Windows 10 with native drivers, in which case their right trigger is measured in RawZrotation). Anyway, the Xbox left stick works much like the PS4 one, complete with inconsistent measurement methods and mismatched deadzones. But the Xbox right stick missed the memo and doesn't bother giving you 8dir, 360deg or analog strength data at all. Well, not real data anyway - it does give you a permanent false positive for 'moving left', so there's that. But it provides X and Y info (from 0 to 65535) so stop interrupting its nap and work it all out for yourself (hope your trigonometry is up to scratch!). Oh, and it has absolutely no deadzone, so you'll need to program one in yourself unless you want erratic micro-movements pretty much nonstop.............Simple, right?

    Ok, so VACCiNE takes all that nonsense and consolidates it into logical, user-friendly alterable values. It gives each stick a small, consistent deadzone (big enough to prevent accidental movement; small enough to encourage nuanced analog movement). Then, whatever input the player uses, on whichever gamepad, VACCiNE gives you the appropriate info via these "neat" values:


    8-directions:

    LeftStickNeatDirection, RightStickNeatDirection, DpadNeatDirection
    Always from 0 to 7 (-1 for null), anticlockwise from east - just like Fusion's default behaviour

    360-degrees:
    LeftStickNeatDegrees, RightStickNeatDegrees, DpadNeatDegrees
    Always from 0 to 359 (-1 for null), anticlockwise from east - just like Fusion's default behaviour

    Analog Strength:

    LeftStickNeatStrength, RightStickNeatStrength
    Always from 0 to 1000


    That's much better already, right? But unless you actually need 360degree movement (eg. for a twin-stick shooter), it gets even simpler. VACCiNE elegantly combines gamepad and keyboard controls - with automatic support for both analog and binary controls - and boils everything down to simple values like these:

    movementLeft: 0 to 1
    movementRight: 0 to 1
    movementUp: 0 to 1
    movementDown: 0 to 1

    These four values will catch the DPAD and Left Joystick of virtually any gamepad, plus WASD and the arrow keys. Binary inputs (keyboard or dpad) will return 0 or 1. Analog inputs (joysticks) will return a decimal figure from 0 to 1 (for example: 0.487 would be almost halfway-pressed).


    You might not want the Right Stick controlling character movement, so by default, the Right Stick doesn't affect these movement values (movementLeft, movementRight, etc.). But you probably do want the right stick to work in menus, so it will - along with the left stick, dpad, WASD and arrows - affect a second set of values (menuLeft, menuRight, etc.).

    And if your game has camera control, you might want the Right Stick to affect that, so by default the Right Stick (but not the Left Stick, dpad, WASD or arrows) will affect a third set of values (cameraLeft, cameraRight, cameraUp, cameraDown) You'll probably want something on the keyboard to affect the camera too, so by default DEL, PGDN, HOME, END, have been assigned to those same values (cameraLeft, cameraRight, cameraUp, cameraDown)

    .... And so on. Basically, most common input types have already been coded in. Once VACCiNE is in your MFA, pressing various keys and buttons will trigger appropriate Alterable Values, ready for you to take advantage of them in your code.

    The youtube video will give you a good sense of how it all works. As will simply loading the mfa, hitting ~ to show the debugger and pressing stuff on you keyboard and gamepad to see how VACCiNE deals with it.

    That's the other part of VACCiNE: A sophisticated in-game debugger. It's kind of like Fusion's inbuilt debugger, but it's much more convenient because it's in-game (toggle it on and off with keyboard or gamepad), has performance benchmarking features, and is very customisable.


    LIST OF FEATURES (INPUT):


    * Makes practically any gamepad under the sun work, out of the box, in your PC Fusion game
    * Consolidates inputs from myriad gamepads, and keyboard, into a cohesive, universal system exposed in simple Alterable Values that are ready for you to use in your code
    * Has a system for movement controls, menu controls, common RPG keys and more.
    * Unifies data for all sticks and dpads to include both 360-degree & 8-directional info, using a uniform system that matches Fusion's default behaviour
    * Provides straightforward analog data for all sticks and triggers, making it easy to use (or ignore) analog controls in your game.
    * Automatically detects whether gamepad or keyboard is being used, and switches code accordingly
    * Uses Control X object for keyboard inputs (up to 10 times faster than default keyboard object)
    * Provides "stepping" mechanic that allows an input to be triggered repeatedly at short intervals without player needing to release button/key (useful for menus)
    * Automatically enables mouse button/wheel support in menus
    * Doesn't use problematic "Poll for new devices" option in Joystick 2 object (known to cause stability issues)
    * Allows PS4 gamepad to work in your game - no drivers or 3rd party software required
    * Heuristically detects incorrect drivers for Xbox One gamepad on Windows 10, and automatically corrects for it
    * Adds consistent and appropriate deadzones to all gamepad joysticks
    * Uses Joystick 2 object, but extrapolates its data to provide more useful information than was previously given (eg. analog strength of all sticks, 360-degree directional information for right xbox stick)
    * Links triggers on PS4 gamepad by default, to match behaviour of Xbox gamepads
    * Exposes correct names of all buttons on all major gamepads ("options" on PS4, "start" on 360, "menu" on One, "circle" on PS4 etc.) and stores latest-used one in alterable string
    * Well organised and well commented code makes it easy for you to modify/expand/remove whichever elements you want (intermediate understanding of Fusion recommended)
    * Is integrated with VACCiNE's debugger to show you real-time data for all gamepad and universal input activity
    * And more...




    LIST OF FEATURES (DEBUGGER):


    * Provides a powerful in-game debugger panel, toggleable with a key or gamepad button
    * Easy to customise - just place references to the things you want to monitor into the provided String objects.
    * Provides freeze-frame capability for monitoring debugger panel frame by frame
    * Provides independent performance benchmarking panel, including FPS, Tick duration, and its own measure, called VAC score.
    * Provides infrastructure for two toggleable tests: Place events in one of the provided folders, hit a key to toggle it in-game and see performance impact measurements
    * Less performance impact than built-in Fusion Debugger
    * Consumes virtually no resources when toggled off
    * A layered PSD of the debugger background is provided, to facilitate easy modification


    LIST OF FEATURES (GENERAL)


    * Almost 1000 lines of commented code - the vast majority of which you can happily ignore if you wish
    * All code is contained within a single umbrella group, for easy transportation/deactivation
    * All VACCiNE-specific components are on a separate layer, and use a unique visual style and naming convention, to remain separate from the rest of your project
    * VACCiNE is totally free to use and modify


    THINGS TO BE AWARE OF


    * VACCiNE is currently set up for single player games (as many gamepads can be plugged in as you like, but whenever one is used, the others are deactivated). If your game is a local multiplayer game that requires multiple gamepads at once, VACCiNE will still be helpful, but you'll need to customise it a bit.
    * VACCiNE is intended for PC games. I don't know how/if it works in the other exporters
    * VACCiNE is set up for use in a 1920x1080 game. For other working resolutions, you'll need to shift some stuff around
    * VACCiNE requires the Joystick 2 object, Xbox Gamepad object, Control X object, and Layer object
    * VACCiNE was designed with custom movements in mind - (it provides input data in the form of alterable values that you then need to make use of in your code). I don't know how useful it is for inbuilt movements, because I'm not very familiar with how they work.
    * VACCiNE uses one Qualifier ("Calculation"). If your game uses this qualifer too, you'll need to modify one or the other to use a different qualifier (otherwise stuff in your game will also be made invisible when toggling the benchmarking panel)
    * I'm sure I'll need to make updates to VACCiNE from time to time, so check back here occasionally.
    * For now, I'd like to restrict the availability of the download to my website (purely to keep updates simple for me). If one day I disappear entirely from the community (not gonna happen any time soon), I give permission for others to host it here or elsewhere and/or take over development of it
    * Fun Fact: For now, if you google "Volnaiskra Clickteam Gamepad", the first entry is one of the first threads I ever posted, asking for help with getting gamepads to work, as I had no idea. I've come far


    Download VACCiNE


    You can get VACCiNE for free at the Clickstore: http://clickstore.clickteam.com/vaccine_universal_gamepad
    It's a small ZIP that contains the MFA and an optional PSD file. Before you can use it, you'll need to install the Joystick 2 object, XBOX gamepad object, Control X object, and Layer object, using Fusion's Extension Manager



    Feedback

    Feedback, bug reports, etc. are welcome. Also, if you have a non-supported gamepad, let me know and I can try and get it working (it'd be helpful if you provide me with all the RAW values that your gamepad produces). You can contact me via this thread, via PM, or using the contact form on my webiste.

    I hope VACCiNE improves your Fusion gamedev experience!

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module

    Join Date
    Dec 2008
    Location
    Italy
    Posts
    404
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Wow, I haven't tested it yet, but it looks very useful for debugging purposes!
    Thank you for sharing

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    chrilley's Avatar
    Join Date
    Jul 2006
    Posts
    917
    Mentioned
    14 Post(s)
    Tagged
    1 Thread(s)
    Looks cool! I've been looking into a good way of implementing multiple gamepad support myself so this will be useful.

    There's some binary data that is not included though so you get spammed with some errors when loading the .mfa.

    I think these are all of them:
    O:\OneDrive\GAMES DEV\Spryke\resources\fonts\fonts to embed in EXE\Exo2.0-Medium.otf
    O:\OneDrive\GAMES DEV\Spryke\resources\fonts\fonts to embed in EXE\Monotype - AkkoPro-Bold.otf
    O:\OneDrive\GAMES DEV\Spryke\resources\fonts\fonts to embed in EXE\Monotype - AkkoPro-BoldItalic.otf
    O:\OneDrive\GAMES DEV\Spryke\resources\fonts\fonts to embed in EXE\Monotype - AkkoPro-Italic.otf
    O:\OneDrive\GAMES DEV\Spryke\resources\fonts\fonts to embed in EXE\Monotype - AkkoPro-Regular.otf
    O:\OneDrive\GAMES DEV\Spryke\resources\fonts\fonts to embed in EXE\S-Core - Core Sans N 55 Medium.ttf
    O:\OneDrive\GAMES DEV\Spryke\resources\fonts\fonts to embed in EXE\S-Core - Core Sans N 65 Bold.ttf

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,245
    Mentioned
    87 Post(s)
    Tagged
    0 Thread(s)
    Thanks for letting me know, chrilley! I've fixed that and uploaded a new version (1.02). That issue hopefully should be gone now.

  5. #5
    Clickteam Clickteam
    Jeff's Avatar
    Join Date
    Jun 2006
    Location
    Battle Ground Washington
    Posts
    11,822
    Mentioned
    7 Post(s)
    Tagged
    2 Thread(s)
    This is really pretty cool.
    Maybe put it in Clickstore sometime so people are sure to find it?

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,245
    Mentioned
    87 Post(s)
    Tagged
    0 Thread(s)
    UPDATE v1.03

    -Added optional 'stepping' mechanic (hold down a button to activate something continously but with short intervals - useful for menus)
    -Added demo functionality to opening page that shows 3 types of movement, including new 'stepping' movement
    -Added noDirectionInput Alterable Value that returns 1 on no movement/directional input at all



    @Jeff: Thanks! Once updates plateau a bit, I'll be sure to put it on the Clickstore

  7. #7
    Clicker Fusion 2.5 Developer
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    J3sseM's Avatar
    Join Date
    Feb 2013
    Location
    Finland
    Posts
    868
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is pretty awesome, great work Volnaiskra!

    I'm doing the same with my code as well, though not quite us comprehensive as yours.
    Anyway, I'm sure tons of people will find this useful.

  8. #8
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,245
    Mentioned
    87 Post(s)
    Tagged
    0 Thread(s)
    Update v1.035

    -Cleaned up some object and string names for better consistency
    -Added alterable value - whichLayer("VACdebugPanel") that makes it easier to move VACCiNE's components from the default layer 11 to another layer.
    -Minor cleanup changes


    @J3sseM: Thanks!

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,281
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    Wow! Nice work on this Volnaiskra. I had no clue all the gamepads had such differences inthe values they return. I can see why I have to resort to Joy2Key so often. I am starting development on a PC game soon so this could be a big boost in saving some time.. Cheers!

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Will definitely look at this on next PC gaming projects, thanks very much!

Page 1 of 7 1 2 3 ... LastLast

Similar Threads

  1. XBOX Gamepad object and non-XBOX Gamepad
    By Ran_TH in forum Fusion 2.5
    Replies: 6
    Last Post: 25th July 2014, 04:05 PM
  2. gamepad help
    By Volnaiskra in forum Fusion 2.5
    Replies: 0
    Last Post: 11th January 2014, 10:58 AM
  3. Gamepad
    By loglady in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 9th June 2012, 08:57 AM
  4. universal app bug
    By cfullerNY in forum iOS Export Module Version 2.0
    Replies: 0
    Last Post: 15th January 2012, 11:47 AM
  5. Gamepad bug?
    By Jarzka in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 25th November 2008, 03:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •