Announcement

Collapse
No announcement yet.

3 New Plugins - Joystick/HOTAS Support, Blueprint Easing Functions, Saitek X52 Pro

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    3 New Plugins - Joystick/HOTAS Support, Blueprint Easing Functions, Saitek X52 Pro

    Hey Everyone,

    Extremely excited to be posting this info tonight and I know a couple of you have been looking forward to this update. I apologize about the delay but it’s been hard to find the time while working on my new game since I am dealing with time constraints but I finished knocking these out and spent the past two days getting these ready for the community. I planned to launch a YouTube channel by now and would highlight these in the first couple vids but it’s going to get pushed back a little longer. But in the meantime, here they are and a tutorial for each to get you started. They are all nearly complete and should be perfectly stable if you end up using them. I am going to keep this all localized within a single post and I am looking forward to seeing what everyone thinks about these new plugins and also the feedback on what to do for the final version of each.

    NOTE: To install these all I believe you will do is unzip these within the Plugins folder of your UE4 install and you should be all good. Also, these plugins were developed in UE4.2 and may not work in a different version of the engine. I will keep you all posted on future versions of these plugins and let me know if you run into any issues. Also, I posted images with this post from my OneDrive account, let me know if you have problems seeing them. One other thing is I posted the new enumerations that these plugins bring and I had started dev on these at different points and haven't gone through and updated all the prefixes and metadata aside from the Easing Functions plugin since that was the most recent so please ignore if one starts with 'U' and another has 'E'. If you end up reliant on the enum type names, shoot me an update and I'll prioritize things to go through and standardize them for the Saitek and Joystick plugins to match the standard that Epic uses for all their enum type names, otherwise it will probably be in my next update to both plugins. It simply came down to a matter of time to get these out so you guys could try them out.

    Take Care And Enjoy

    -Matt

    New UE4.2 Plugin – Joystick Input


    Download: Joystick Input Plugin - BETA 0.9.6

    At the moment, this feature is supported through a plugin and cannot be mapped through the Input Properties as it would require modifying the Engine code (Maybe in the future). It is setup by binding Custom Events to Event Dispatchers to get data such as if a given Axis changes or a button is pressed. All of this functionality is provided by the new ‘JoystickState’ UClass.



    It’s recommended but not required to create a Blueprint that is based off of ‘JoystickState’. This way you can add functionality to the Blueprint if needed but whenever running the game either in ‘Play’ or ‘Simulate’, you can open up the Defaults Tab under your custom ‘JoystickState’ Blueprint and see the values that come back from the different Axis or buttons. It’s more for debugging purposes if you want a quick way to visualize what data is coming back from your Joystick or H.O.T.A.S Flight System.





    VERSION NOTE: Currently, only one Joystick can be accessed at a given time. This will likely be changed when I release the final version. Also, you cannot connect/disconnect your Joystick while the game is running, it must be from the start. I am assuming there is an interface I could inherit that would notify my class of device changes but I haven’t had the time to investigate that. If someone knows the answer, let me know.

    Here is an example of how to interface with a custom ‘JoystickState’ Blueprint…


    We start by creating a Blueprint node ('Create Joystick State') that can create an instance of that state whether it’s the base ‘JoystickState’ or your custom one...



    From there, we simply create some custom events that we bind to the Event Dispatchers we care about coming from the ‘JoystickState’.

    Here are a list of the delegates you need to map to as Custom Events. You can create your own name but make sure to map the parameters to the same type.
    Code:
    FJoystickStateAxisChangedSignature(JoystickAxisType Type, JoystickAxis Axis, float Value)
    FJoystickStateSliderChangedSignature(JoystickSliderType Type, JoystickAxis Axis, float Value)
    FJoystickStatePOVChangedSignature(uint8 Index, int32 Degrees, bool IsNeutral)
    FJoystickStatePOVButtonPressedSignature(uint8 Index, JoystickPOVButton Button)
    FJoystickStatePOVButtonReleasedSignature(uint8 Index, JoystickPOVButton Button)
    FJoystickStateButtonPressedSignature(uint8 ButtonIndex)
    FJoystickStateButtonReleasedSignature(uint8 ButtonIndex)
    New UEnums:

    Code:
    UENUM(BlueprintType, Category = "Joystick State|Enumerations")
    enum JoystickAxis
    {
    	XAxis = 0,
    	YAxis = 1,
    	ZAxis = 2,
    	UAxis = 3,
    	VAxis = 4
    };
    
    UENUM(BlueprintType, Category = "Joystick State|Enumerations")
    enum JoystickAxisType
    {
    	Position			= 0,
    	Rotation			= 1,
    	Velocity			= 2,
    	AngularVelocity		= 3,
    	Acceleration		= 4,
    	AngularAcceleration = 5,
    	Force				= 6,
    	Torque				= 7
    };
    
    UENUM(BlueprintType, Category = "Joystick State|Enumerations")
    enum JoystickSliderType
    {
    	SliderPosition	   = 0,
    	SliderVelocity	   = 1,
    	SliderAcceleration = 2,
    	SliderForce		   = 3
    };
    
    UENUM(BlueprintType, Category = "Joystick State|Enumerations")
    enum JoystickPOVButton
    {
    	POV_Unknown   = 0,
    	POV_Neutral   = 1,
    	POV_Top		  = 2,
    	POV_TopRight  = 3,
    	POV_Right	  = 4,
    	POV_DownRight = 5,
    	POV_Down	  = 6,
    	POV_DownLeft  = 7,
    	POV_Left	  = 8,
    	POV_TopLeft	  = 9
    };
    I believe that this object may get destroyed by the GC since it uses the UClass attribute and derives from UObject but just in case you need to manually dispose of the state, here is how you would do that…



    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    New UE4.2 Plugin – Blueprint Easing Functions



    Download: Easing Functions Plugin - BETA 0.9.9

    You can now utilize Easing Functions within Blueprints to give you more options for handling interpolation. The currently supported functions are the following: Linear, Quadratic, Cubic, Quartic, Quintic, Sinusoidal, Exponential and Circular. I was going to remove Linear since Lerp exists but just in case you want to be able to easily switch back and forth between the different functions, it made sense to keep it in. You can find these options in the Blueprints menu under Math -> Easing Functions.



    There are two kinds of easing function you can make a call to, one that takes a starting point and a delta...


    ...and one that interpolates between a start point and end point over a given easing curve using an Alpha value that ranges from 0 – 1 like the traditional Lerp.


    Easing functions also have 3 options for the path of the curve: In, Out, In/Out.

    New UEnums:

    Code:
    UENUM(BlueprintType, Category = "Math|Easing Functions")
    enum EEasingFunctionType
    {
    	
    	EEasingFunction_Linear		= 0 UMETA(DisplayName = "Linear"),
    	EEasingFunction_Quadratic	= 1 UMETA(DisplayName = "Quadratic"),
    	EEasingFunction_Cubic		= 2 UMETA(DisplayName = "Cubic"),
    	EEasingFunction_Quartic		= 3 UMETA(DisplayName = "Quartic"),
    	EEasingFunction_Quintic		= 4 UMETA(DisplayName = "Quintic"),
    	EEasingFunction_Sinusoidal  = 5 UMETA(DisplayName = "Sinusoidal"),
    	EEasingFunction_Exponential = 6 UMETA(DisplayName = "Exponential"),
    	EEasingFunction_Circular    = 7 UMETA(DisplayName = "Circular")
    };
    
    UENUM(BlueprintType, Category = "Math|Easing Functions")
    enum EEasingFunctionPath
    {
    	EEasingFunctionPath_In	    = 0 UMETA(DisplayName = "In"),
    	EEasingFunctionPath_Out     = 1 UMETA(DisplayName = "Out"),
    	EEasingFunctionPath_In_Out  = 2 UMETA(DisplayName = "In + Out")
    };
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    New UE4.2 Plugin – Saitek X52 Pro



    Download: Saitek X52 Pro Plugin - BETA 0.9.8

    For anyone out there with the Saitek X52 Pro H.O.T.A.S Flight System, you now have the ability to control the LED’s on the device as well as sending text to the MFD on the throttle.

    Here is the Saitek X52 Pro…


    Here are the options under Blueprints...


    And here is a tutorial on how we would setup the device and shut it down when the running instance has ended…


    The device works off of a page system. We need to first initialize the device with our ‘App Name’ and then add a page. Each ‘page’ of settings is stored in memory on the device. In the current version, there isn’t any functionality to switch the Active Page so only worry about creating one and make sure you check the box ‘Make Active’ if you don’t, you won’t see your calls make it to the device.

    The next step is to call to change the LEDs on the device before setting the text on the MFD. The Saitek X52 Pro doesn’t have multi-color LEDs and instead has a Red and Green one side by side under each button. To get either Red, Green or Amber, you need to turn on or off the appropriate Red or Green LED. Red and Green both on = Amber. Also, when you write text to the display (MFD), you have the option of writing it to either the top, middle or bottom lines.

    And, after we run the app, the light turns amber for a second (since my green led is already lit), then back to green. And then the MFD prints this out...



    New UEnums:

    Code:
    /**
    * This enumeration is responsible for representing the different LED states that are possible on the Saitek X52 Pro.
    */
    UENUM(Blueprintable, Category = "SaitekX52Pro|Enumerations")
    enum USaitekX52LEDID
    {
    	/*
    	* Values: 0 (off) or 1 (on) Fire button illumination on/off (color is controlled by the position of the safety cover)
    	*/
    	SafeFire       = 0,
    
    	/**
    	* 0 (off)or 1 (on)Fire A - red component
    	*/
    	FireA_Red      = 1,
    
    	/**
    	* 0 (off) or 1 (on) Fire A - green component
    	*/
    	FireA_Green    = 2,
    
    	/**
    	* 0 (off) or 1 (on) Fire B - red component
    	*/
    	FireB_Red      = 3,
    
    	/**
    	* 0 (off) or 1 (on) Fire B - green component
    	*/
    	FireB_Green    = 4,
    
    	/**
    	* 0 (off) or 1 (on) Fire D - red component
    	*/
    	FireD_Red	   = 5,
    
    	/**
    	* 0 (off) or 1 (on) Fire D - green component
    	*/
    	FireD_Green	   = 6,
    
    	/**
    	* 0 (off) or 1 (on) Fire E - red component
    	*/
    	FireE_Red	   = 7,
    
    	/**
    	* 0 (off) or 1 (on) Fire E - green component
    	*/
    	FireE_Green    = 8,
    
    	/**
    	* 0 (off) or 1 (on) Toggle 1/2 - red component
    	*/
    	Toggle12_Red   = 9,
    
    	/**
    	* 0 (off) or 1 (on) Toggle 1/2 - green component
    	*/
    	Toggle12_Green = 10,
    
    	/**
    	* 0 (off) or 1 (on) Toggle 3/4 - red component
    	*/
    	Toggle34_Red   = 11,
    
    	/**
    	* 0 (off) or 1 (on) Toggle 3/4 - green component
    	*/
    	Toggle34_Green = 12,
    
    	/**
    	* 0 (off) or 1 (on) Toggle 5/6 - red component
    	*/
    	Toggle56_Red   = 13,
    
    	/**
    	*  0 (off) or 1 (on) Toggle 5/6 - green component
    	*/
    	Toggle56_Green = 14,
    
    	/**
    	* 0 (off) or 1 (on) POV 2 - red component
    	*/
    	POV2_Red	   = 15,
    
    	/**
    	* 0 (off) or 1 (on) POV 2 - green component
    	*/
    	POV2_Green	   = 16,
    
    	/**
    	* 0 (off) or 1 (on) Clutch (i) - red component
    	*/
    	Clutch_Red	   = 17,
    
    	/**
    	* 0 (off) or 1 (on) Clutch (i) - green component
    	*/
    	Clutch_Green   = 18,
    
    	/**
    	* 0 (off) or 1 (on) Throttle axis illumination on/off (color is controlled by the throttle position)
    	*/
    	ThrottleAxis   = 19
    };
    
    /**
    * This enumeration is responsible for representing the different text locations that are possible on the Saitek X52 Pro MFD.
    */
    UENUM(Blueprintable, Category = "SaitekX52Pro|Enumerations")
    enum USaitekX52StringID
    {
    	/**
    	* 16 characters before display scrolls Top line on MFD
    	*/
    	Top_Line    = 0,
    
    	/**
    	* 16 characters before display scrolls Middle line on MFD
    	*/
    	Middle_Line = 1,
    
    	/**
    	* 16 characters before display scrolls Bottom line on MFD
    	*/
    	Bottom_Line = 2,
    };
    Last edited by MC Stryker; 06-25-2014, 05:47 AM.

    #2
    Thanks a lot! Just started working on some flight-based stuff and was worried about joystick usage.

    You're a legend.

    Comment


      #3
      Originally posted by HateDread View Post
      Thanks a lot! Just started working on some flight-based stuff and was worried about joystick usage.

      You're a legend.
      Haha! Thanks my man! Yea, me and a bunch of people here on the forums were asking about it right when UE4 launched and it seems like a lot of people were interested in this and keep asking about it. I am also making a game that utilizes flight controls so it was something I've been working on sporadically for the past 4 months and glad to get a working version out there to the community finally. One thing I am thinking about now that I may need to go back and make a little more user-friendly is the data coming back from the POV switches but I think right now they report back in fractions of a degree to indicate what direction the user clicked.

      But the Joystick plugin should support any Joystick or HOTAS combo out there. It automatically normalizes the Axis data so that should be good for any device and I'll probably need to go back and create a helper method to make the data on the POV come back a little clearer but let me know how this works out for you and if you run into any issues getting it working.

      EDIT: I completely forgot I fire off a callback for POV Button Pressed/Released so that should be great for most people but if anyone cares about the raw data coming back in a specific format, let me know
      Last edited by MC Stryker; 06-25-2014, 05:44 AM.

      Comment


        #4
        Straight Amazing....Thanks so much for Sharing....

        Streams: www.Twitch.tv/BlinkTheory
        Patreon: www.Patreon.com/BlinkTheory

        Comment


          #5
          How can I set up my Logitech G27 Racing Wheel for my driving game? There is MyCar blueprint. There is no DebugJoystickState function.

          Comment


            #6
            Originally posted by jeffmorris View Post
            How can I set up my Logitech G27 Racing Wheel for my driving game? There is MyCar blueprint. There is no DebugJoystickState function.
            Hey Jeff, my plugin only supports Joystick input and unfortunately doesn't support other types of input. Also the DebugJoystickState is simply a custom Blueprint that I created that is based off of JoystickState (not part of the plugin) so that during real-time, you can visualize the data coming back from the device, if you create a new Blueprint and base it on JoystickState, you can achieve the same thing but unless you have a Joystick or HOTAS setup, you won't see any data come back. Sorry bud but if in the future I add support for Racing Wheels, I'll let ya know

            Comment


              #7
              Originally posted by President View Post
              Straight Amazing....Thanks so much for Sharing....
              Your welcome!


              EDIT: I believe forum moderators moved this thread from the Blueprint Forums over to this forum. This post took me an incredible amount of time to put together and since this post doesn't actually provide the source code or is a mod to the engine, why was it moved from those forums over to this one? I feel like this thread is more related to that forum since all of these plugins are specifically accessed through Blueprints and for people who need this functionality may end up missing who are otherwise, non-programmers or people that modify the engine source and wouldn't have a reason to check this forum. This wasn't something I wanted to necessarily target at just programmers and I feel a lot of people may miss this if this is sitting on the GitHub/Engine Source thread since this doesn't actually have to do with either. If someone could move this back, I'd appreciate it.

              EDIT: Okay, Well I can see from the forum thread title that plugin dev is up on there. I'd like to suggest to Epic that they create a forum thread that is specifically targeted at Plugins. I think this thread title can be misleading. In my case, my plugins have no relation to GitHub and I did not modify Engine Source to achieve this and I think a lot of people who like I said don't program, they would have no reason otherwise to stop by here and I see a lot of people across the board potentially missing out on great plugins that add more value to the engine simply because of this. Just a suggestion... thanks
              Last edited by MC Stryker; 06-25-2014, 04:12 PM.

              Comment


                #8
                Click image for larger version

Name:	car04.PNG
Views:	1
Size:	369.7 KB
ID:	1052213

                I connected a Logitech Extreme 3D Pro joystick to my computer and it worked. I think that I got the backup lights and taillights working but I'm not sure. Please add support for racing wheels.

                Comment


                  #9
                  Originally posted by jeffmorris View Post
                  [ATTACH=CONFIG]5871[/ATTACH]

                  I connected a Logitech Extreme 3D Pro joystick to my computer and it worked. I think that I got the backup lights and taillights working but I'm not sure. Please add support for racing wheels.
                  Glad to hear it Jeff, that's awesome that it's working well! I wish I could bud but unfortunately I cannot spend the time for the moment on a Racing Wheel plugin. I'm working on a game prototype and have to finish things up around August and I only developed a plugin for Joystick input because it was something my prototype requires. Maybe in the future but I hope you understand.

                  If you happen to be a programmer yourself though or know any, you could easily achieve this spending some time with DirectInput. I don't think XInput supports racing wheels but DirectInput should be able to access a Racing Wheel and give you control over the data coming from the wheel and so forth.

                  Now that I think about it, I have an idea that may work for you for now. I think 3rd party programs out there exist to map one controllers input to another. I know there are ones that exist where a gamepad could be mapped to a keyboard and vice versa but I think you may be able to download one of these and simply map the axis of the steering wheel, brake, clutch etc to a virtual joystick or virtual gamepad, then that should work. This will only work in Windows however but if they exist and can do that, you should be okay for the time being.

                  Good luck Jeff!

                  Comment


                    #10
                    Hey Jeff,

                    I found this out while doing a little bit of searching... it may help you remap the inputs. Hope this helps.

                    http://vjoystick.sourceforge.net/sit...ahk-gui-script

                    EDIT: Here is another that may work...

                    http://joytokey.net/en/
                    Last edited by MC Stryker; 06-25-2014, 10:25 PM.

                    Comment


                      #11
                      Love that you added more easing functions to expand on the sometimes 'derp' lerp. Exciting stuff!

                      Comment


                        #12
                        Originally posted by Knobbynobbes View Post
                        Love that you added more easing functions to expand on the sometimes 'derp' lerp. Exciting stuff!
                        Hahaha... ah that made me laugh. Glad you like it. I agree, linear interpolation from one value to the next is great but having other easing functions at your disposal gives you an opportunity to make going from point A to B a little more organic and unpredictable. If you have ever spent time with Silverlight, these methods should be right at home with you from their animation system. But the good thing is that if lerp suits a certain section of your code better, you can simply switch to Linear and see what that would get without switching your nodes out for a lerp. Aside from the Linear option, every other one supports 3 different types of curves from in to out and also a combo that starts with in but ends with out. Also, both types of easing methods support floats, linear colors, rotators, vectors, and transforms. The first one (Ease) is more of a time based one if you like using those with a start, delta, and the duration and so forth whereas the other (Ease Lerp) is a lot more useable in most cases since it acts like lerp and takes an alpha between 0 and 1 and just interpolates on the curve you selected and has less variables to worry about in general. But there is both variants to suit both needs depending on how you calculate the values that end up as it's input.

                        Anyways Knobbynobbes, thanks for the feedback and let me know how it works out for you and if you run into any issues bud. I've tested them pretty thoroughly but just in case. Thanks again!
                        Last edited by MC Stryker; 06-26-2014, 07:05 AM.

                        Comment


                          #13
                          Wow, this is really awesome MC Stryker!! I have the X52 at home myself and can't wait to try this out with my "cockpit shooter" UE4 test game. I'll follow up about why your thread was moved as well and see if we can't get that fixed. Thank you for sharing your work with everyone!

                          --Mike

                          Comment


                            #14
                            Originally posted by Mike Fricker View Post
                            Wow, this is really awesome MC Stryker!! I have the X52 at home myself and can't wait to try this out with my "cockpit shooter" UE4 test game. I'll follow up about why your thread was moved as well and see if we can't get that fixed. Thank you for sharing your work with everyone!

                            --Mike
                            Thank you very much Mike!!! Let me know how it ends up working out for you and if you have any feedback on what to improve for the final version. BTW, thanks about moving it back, it took a couple days to put together for the community so I wanted to make sure it got the correct exposure from the people that can benefit most so thanks for your consideration. I think it would be great to create a centralized forum for Plugins. But again, thank you very much and keep up the great work on UE4 Mike, really looking forward to 4.3!!! Take care buddy.

                            Comment


                              #15
                              I tried to get VJoy working but it didn't work on Windows 7 Home Edition 64-bit. What I need is a program that translates DirectInput to XInput, not a program that emulates joystick input for programs that don't support joysticks.

                              Comment

                              Working...
                              X