View unanswered posts | View active topics


Forum lockedPost a reply
Previous topic | Next topic 

User avatar   Captain CryDev Captain CryDevMember since: 02.08.2005, 19:01Posts: 2226Location: Crytek HQ Likes: 39
 

 Post Topic: [RELEASED] [FGPlugin] Joystick
PostPosted 10.02.2009, 16:10 
Image


This is a small plugin for the original Flowgraph Plugin System by Cry-Vlok, still work in progress though. It adds a new flownode (Input:Joystick) which will return some useful joystick informations similar to the Mouse:MouseInfo node. The X,Y,Z joystick axis output ports are working properly at the moment and i'm planning to add LUA support and of course the button states too. Maybe this node is useful for some modifications, especially some flight simulator modifications.

[YOUTUBE]BOhSXhqU120[/YOUTUBE]


I've attached a picture which shows a flowgraph using the new flownode. It lets you control the player with a plugged in joystick.

[UPDATE]:

The node itself has now 1 input port for the joystick you want to use (if more than one joystick is plugged in). By default the first plugged in joystick is used though. There are several output ports for the different joystick values too:

  • X: X-axis, usually the left-right movement of a stick.
  • Y: Y-axis, usually the forward-backward movement of a stick.
  • Z: Z-axis, often the throttle control. If the joystick does not have this axis, the value is 0.
  • X-Rotate: X-axis rotation. If the joystick does not have this axis, the value is 0.
  • Y-Rotate: Y-axis rotation. If the joystick does not have this axis, the value is 0.
  • Z-Rotate: Z-axis rotation (often called the rudder). If the joystick does not have this axis, the value is 0.
  • Slider: Two additional axis values (formerly called the u-axis and v-axis) whose semantics depend on the joystick.
  • POV: Direction controllers, such as point-of-view hats. The position is indicated in hundredths of a degree clockwise from north (away from the user). The center position is normally reported as - 1. For indicators that have only five positions, the value for a controller is - 1, 0, 9,000, 18,000, or 27,000.
  • Button Pressed: Indicates which button was pressed
  • Button Released: Indicates which button was released
The axis min/max values are normalized to -1000/1000. I've also added basic LUA support (global scriptbind name: Joystick), so it is possible to retrieve the joystick values or select a joystick via LUA too.
  • Joystick.GetXAxis();
  • Joystick.GetYAxis();
  • Joystick.GetZAxis();
  • Joystick.GetXRotate();
  • Joystick.GetYRotate();
  • Joystick.GetZRotate();
  • Joystick.GetButtonState(button);
  • Joystick.SetJoystick(joystick);
  • Joystick.GetNumButtons();
  • Joystick.GetPOV();
  • Joystick.GetSlider();
Many thanks to cwright who tested the first version :)




Last edited by Cry-JR on 13.02.2009, 14:26, edited 3 times in total.

User avatar   Honourable Member Honourable MemberMember since: 21.12.2007, 04:15Posts: 6350Location: Western Australia Likes: 11
 

 Post Topic:
PostPosted 10.02.2009, 16:58 
Another nice one James, those guys who were recently discussing this will be happy :)


Image
Intel i7 3930k | EVGA GTX Titan | 120Hz Trio
User avatar   Has no life Has no lifeMember since: 27.12.2007, 01:50Posts: 6478Location: Nottingham Likes: 2
 

 Post Topic:
PostPosted 10.02.2009, 18:52 
Very nice too! Great job James, its community Christmas time at the moment :)


Associate Producer - New World Interactive
User avatar   Uber Modder Uber ModderMember since: 15.11.2007, 20:40Posts: 1069Location: The Netherlands Likes: 0
 

 Post Topic: RE: [FGPlugin] Joystick
PostPosted 10.02.2009, 21:28 
Awesome plugin James-Ryan! :D
I alway found that Crysis needed joystick support.


  Experienced Modder Experienced ModderMember since: 17.10.2008, 01:57Posts: 551 Likes: 0
 

 Post Topic: RE: [FGPlugin] Joystick
PostPosted 11.02.2009, 05:43 
Lua support would be excellent james ;)
There is also a need for it to work in multiplayer at least for a few projects. :)


Last edited by Melekai on 11.02.2009, 06:30, edited 3 times in total.
User avatar   Has no life Has no lifeMember since: 13.10.2008, 19:48Posts: 6496Location: Squiggers' kitchen Likes: 0
 

 Post Topic:
PostPosted 11.02.2009, 11:47 
wow, this is awesome ! :D



Might wanna add a detection system or so ? Like if people could choise between joystick or mouse :D


- It's all about the bread.
  Trainee TraineeMember since: 21.11.2007, 23:13Posts: 175 Likes: 11
 

 Post Topic: RE: [FGPlugin] Joystick
PostPosted 11.02.2009, 11:51 
This is great! keep up the great work!!!! Do you think this could support more than one joystick? Thew wiimote has accelerometers + the analog joystick on the nunchuck, which can be properly seen by something like ppjoy... anyhow, it would be great if it can detect all the axis/buttons from directinput. Graet work anyways, keep it up!!


Last edited by kimba23 on 11.02.2009, 11:57, edited 1 time in total.
  Uber Modder Uber ModderMember since: 11.08.2004, 12:38Posts: 2142 Likes: 37
 

 Post Topic: RE: [FGPlugin] Joystick
PostPosted 11.02.2009, 12:42 
James,
that's fantastic news! Just a few days ago Melekai and I dropped a subtle hint, and now here it is. I look forward to testing it. Many thanks.
Just a thought. For my project I need both mouse and joystick control, particularly as not everyone will have a joystick, steering wheel or flight yoke. MouseInfo is working great for flight control, clickable panel controls, view panning and weapon control. But there are a couple of minor issues: you have to enable it for the x,y outputs to work, so the cursor appears - confusing, as my system also generates a cursor for clickable panels! Also, the x,y values are screen coordinates. A general rolling value (i.e. no limit on the values) would be much better as it would allow, for example, unlimited view panning or weapon rotation in one direction (i.e. as you would expect with normal game mouse panning).
If MouseInfo could output x,y data when the cursor isn't enabled, that would be very useful. Or - shoot me down in flames if not possible - could the new plugin be a general purpose node that gives both mouse and joystick data. As I said, just a thought. I'm sure that whatever you release will be really useful. Many thanks.
Chris
User avatar   Has no life Has no lifeMember since: 21.01.2008, 11:28Posts: 6198Location: 52°21'25.06"N 4°56'48.42"E Likes: 0
 

 Post Topic:
PostPosted 11.02.2009, 12:46 
Wow, yet another one...nice job! Let the flight sims come!
  Uber Modder Uber ModderMember since: 11.08.2004, 12:38Posts: 2142 Likes: 37
 

 Post Topic:
PostPosted 11.02.2009, 13:09 
Just another thought occurred....
several years ago I released a utility named AutoJoy for Far Cry. It allowed you to use joystick control for driving ground vehicles. It worked by automatically 'pressing' the A and S keys, depending on joystick data - it used pulse width modulation to give a linear steering response. It worked, but a direct method as with this new joystick addon is much, much better.
So I'm thinking: how would you use this addon to drive default ground vehicles - or the VTOL and helicopter? In Far Cry the vehicle Lua files had a huge amount of functionality and it may have been possible to adapt them to work with this addon. But in Crysis the Lua files are very small with essentially no functionality. James did mention Lua support. Maybe this will make joystick control of the default game vehicles possible.
Of course, for my aircraft project, adapting the code to use the joystick plugin will be easy. I'll also add a bit of code so you can use the third axis for throttle control.
Chris
  Experienced Modder Experienced ModderMember since: 17.10.2008, 01:57Posts: 551 Likes: 0
 

 Post Topic:
PostPosted 12.02.2009, 08:12 
in finals at school at the moment.
but
i had a look around in the code. again. mp support is gonna be tough (for me) to get in. mighty be tough for anyone :P its osomething i would like to see as well.
User avatar   Uber Modder Uber ModderMember since: 14.04.2008, 14:24Posts: 1754 Likes: 3
 

 Post Topic:
PostPosted 12.02.2009, 11:33 
Mind you, making a Multiplayer:LocalPlayer?

But this is totally awesome, i love the nodes!


Image
User avatar   Captain CryDev Captain CryDevMember since: 02.08.2005, 19:01Posts: 2226Location: Crytek HQ Likes: 39
 

 Post Topic:
PostPosted 13.02.2009, 14:34 
The first version is ready. Special thanks goes to cwright who tested the first test version of the flownode. Infos about the flownode are added to post 1.


  Experienced Modder Experienced ModderMember since: 17.10.2008, 01:57Posts: 551 Likes: 0
 

 Post Topic:
PostPosted 13.02.2009, 14:37 
excellent james thanks muchly! :)

james. do you think you could release the source of this? partly cause i wanna see how much i got right and what i missed, and partly becuase id like to see how you exposed it to lua. pleease? :)


Last edited by Melekai on 13.02.2009, 14:53, edited 1 time in total.
  Uber Modder Uber ModderMember since: 11.08.2004, 12:38Posts: 2142 Likes: 37
 

 Post Topic:
PostPosted 14.02.2009, 13:46 
Yes, this is truly excellent. Many thanks to James!
James has told me that the latest version of MouseInfo gives x,y data without needing to enable the modal mode, so now the cursor won't be visible. That's another little problem solved. I'll test this shortly. Unfortunately, immediately after running a virus scan yesterday, I found that Sandbox crashed when I tried to open the FG editor. Fortunately I've just got it working again, so I'll be able to test the new MouseInfo shortly.
The combination of MouseInfo and Joystick is perfect for flight simmers!
.
I wonder if it will be possible to use the joystick plugin for driving default vehicles such as the LTV?
Chris


@Melekai,
your inbox was full, so here's my reply:
Hi Melekai,
I only use SP and I know very little about MP, but I would be interested to know whether my aircraft work in MP. As they're standard entities they probably should, but maybe some of the Lua 'tricks' I used might not work in MP.
I'll probably release Lua updates in the next few days that include the new mouse/joystick support.
Chris


Last edited by cwright on 14.02.2009, 13:55, edited 1 time in total.