home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Sauerbraten Game Controller Support

by dbox on 03/22/2006 20:48, 39 messages, last message: 05/26/2006 09:53, 16986 views, last view: 11/02/2024 02:19

I thought I would start a new thread to announce the game controller support enhancement I recently just finished. You can check it out here (source code included):

http://www.quadropolis.us/node/171

I'm really curious to get feedback to see if there would be any other interest in this feature (and to know if it works for anyone else). If so, I would be happy to donate what I've done so far back to the project and expand on what is there now.

My general approach was to translate joystick events (button presses, hat and axis movements) into sauerbraten "keypress" events. This way you can use the bind command to map joystick events to actions. (There are examples of this in the quadropolis posting).

I did my best to add this without much modification to the existing code. I put all of the joystick event and logic into a single class (joystick.h) and only touched 3 other files:

main.cpp - added 4 calls to joystick class

engine.h, physics.cpp - added joymove() method (very similar to mousemove)

Go to first 20 messagesGo to previous 20 messages    Board Index   

#20: Re: Joystick for Cube

by CC_machine4 on 03/26/2006 23:56, refers to #19

this mod is way cooler than yours, you mean.

reply to this message

#21: Config update

by dbox on 03/29/2006 09:56

I've added a small feature to the joystick support mod that should make it a bit easier to configure. If you set the new "joyshowevents" property to 1, all of the joystick events will be displayed in the console as they are fired. This will help you know which button to bind to which action and which axes to use for your direction and field of view control.

You can check out all of the details and download the updated mod here:

http://www.quadropolis.us/node/172

reply to this message

#22: Survey

by dbox on 03/29/2006 09:58

Has anyone tried out this mod yet?

If so, what's the make and model of your game controller? How did it work for you?

reply to this message

#23: Menu-driven configuration

by dbox__ on 04/05/2006 08:05

So is everybody ready for a non-controversial post? Well here you go:

I've just uploaded the latest update to my joystick support mod. You can now completely configure the joystick using dynamically generated menus. If you have your joystick plugged in this new menu will show up under options->joystick.

You can read all about it and download the latest version over at Quadropolis:

http://www.quadropolis.us/node/172

reply to this message

#24: Heh

by pushplay on 04/06/2006 07:32

Actually I'm pretty surprised that the joystick mod hasn't caused more controversy. Usually it's a debate between the people who think it's obviously an inferior control scheme and the sooner everyone gives it up the better, versus the people who want to give everytone whatever controls make them happy.

reply to this message

#25: ..

by makkE on 04/06/2006 14:22

Well, I don´t mind what controllers people use, I think it´s cool he does it.
Wouldn´t mind that being official (and also add turning keys)
If someone wants to use keyboard or joysticks, why not?
Better for my score, lol.

reply to this message

#26: Just out of curiosity...

by dbox__ on 04/26/2006 01:13

This question is for Aardappel or another source contributor...

I know you guys aren't really joystick fans but have you guys considered including my joystick support in the official release?

reply to this message

#27: some testing

by rancor on 04/26/2006 02:19

OK, so I went and tried out the joystick mod with a xbox 360 controller, and while it shows a good deal of promise, particularly with the dynamic menus, several issues made it almost unuseable. The primary issues were with axises being confused, as in it seemed like axis 3(the triggers) and axis 4(up/down right stick) were interfering with each other. The other major issue was that the dpad directions seemed partially rotated clockwise one position, as in things bound to JOYHAT1N ran when JOYHAT1NE was pressed. Additionally, I may have just missed it, but there does not appear to be a way of making thing bound to the maximums of an axis execute on a threshhold lower then the maximum. This is an issue in that moving the joystick all the way out to the limit of its range of motion is both uncomfortable and more likely to trigger additional, spurious, directions.

reply to this message

#28: Re: Just out of curiosity...

by Aardappel_ on 04/26/2006 02:25, refers to #26

I think you answered the question yourself.. the use of joysticks with sauerbraten is so pointless in the general case, that I see no reason for it to be in the main code. We generally want to keep to code small & simple, no room for code thats not used. In addition to that, we want to promote those few console-only people that are stubborn about using a mouse to try it :)

reply to this message

#29: Re: some testing

by dbox__ on 04/26/2006 02:50, refers to #27

Thanks for the feedback! The major challenge in doing joystick support is I only have so many joysticks to try it on. So I appreciate you trying it out.

I'll look again at the way I've implemented the hat control. It sounds from your experience that I've possibly made an erroneous assumption about how this is set up for all joystick types.

As far as the axes seeming to interfere with one another... I'm not sure what could be causing that offhand. You might just double check to make sure you don't have the same axis bound to more than one action. I'll look into this as well.

Finally, there is a setting which controls the range of axis motion required when mapping min/max movements to actions. Here's the snippit from the quadropolis posting:

"joyaxisminmove
This property sets up the minimum amount of movement that is required to trigger an event when binding axis movements to actions. The range for this setting is 1-30. If set to 1 you basically just have to breath hard on the stick and it will trigger the event. If set to 30 you'll have to push it practically to the edge. The default is 8."

Please let me know if adjusting this property doesn't help.


reply to this message

#30: Re: Just out of curiosity...

by dbox__ on 04/26/2006 02:51, refers to #28

Ok, fair enough.

reply to this message

#31: Re: some testing

by rancor on 04/26/2006 05:43, refers to #29

No, there definitely wasn't multiple binds happening. Here's exactly what I did: I bound the right stick (x=axis 5, y=axis 4) to look, axis 3 min (right trigger) to fire, and axis 3 max (left trigger) to jump. When an extreme was reached on axis 4, one of the actions on axis 3 was performed(sorry, can't rememeber which one). And thanks for telling me about joyaxisminmove, I guess I just overlooked it :-). Although, it seems to me that it would be really useful to have this be set per axis as opposed to globally.

reply to this message

#32: Re: Just out of curiosity...

by rancor on 04/26/2006 05:54, refers to #28

Ok, just for the record, the reason that I've been following this closely is for the exact purpose of demonstrating to my hardcore console gamer friend that in fact controllers are pretty worthless for playing FPS. Unfortunately, the only good way of doing that is finding a PC FPS that also has solid gamepad support, which is actually sort of hard. If dbox gets this well debugged, it will be much better then the support in the other games that I've looked into. Also, as makkE mentioned, it does add the periodically requested ability to bind turning to keys, and the dynamic menu implementation could be useful both as a method of editing all binding interactively as well as for things like map menus and changing resolutions.

reply to this message

#33: Re: some testing

by dbox__ on 04/26/2006 06:38, refers to #31

Ok, thanks for the additional info. I thought of a couple of things you could do to help me track it down, if you have the time:

1.) Email me your config.cfg file. (This will show me the current state of all of the joystick properties).
dwbox@hotmail.com

2.) Go to the joystick menu and set show events to 'yes'. Then, without touching either trigger, move axis 4 to its min and max positions. As you do watch the console messages in the upper left. You should see messages that look something like this:

JOYAXIS4 -1024
JOYAXIS4 -2039
JOYAXIS5 220
JOYAXIS4 -5000
etc.

Let me know if you see any JOYAXIS3 messages show up. That will indicate that those events are actually being fired.

Just out of curiosity, are you on windows? and if so, have you gone through the game controller configuration wizard in the Control Panel to calibrate the controller?

Thanks

reply to this message

#34: Re: Seriously

by enigma_0Z on 04/26/2006 21:14, refers to #8

Team mouse for sure...

Really though, I am pretty excited about the Nintento Rev. Controller, and don't let anyone tell you otherwise!!!

BTW: (While i'm on the subject of future consoles, and I don't mean this as flamebait) but... n/m It doesn't belong here...

reply to this message

#35: testing

by dbox__ on 04/27/2006 07:10

rancor,

Did you see my additional request for info in post #33? (I thought perhaps you might have missed it with all of the posts about the new sauer release.)

reply to this message

#36: Re: testing

by rancor on 04/27/2006 08:33, refers to #35

Sorry, I've been really busy, and the computer I tried it out on isn't exactly mine. For that matter, neither is the 360 controller :-(
This was actually on windows, since I'm not sure about a couple of the gamepad I have access to WRT linux support. And unfortunately, the driver for the 360 controller doesn't work with the kernel I have to use. And yes, I did go calibrate it at least once.
As far as 2), although I don't have the controller ATM, I remember looking for precisely that in the output, and not seeing it.

reply to this message

#37: Re: testing

by dbox__ on 04/27/2006 23:23, refers to #36

Thanks, I got your email with the config. I'll look at that later and see if I can determine what was causing the problems for you.

reply to this message

#38: sauer 4/26/06 compatible

by dbox__ on 05/26/2006 06:09

I know you've all been anxiously awaiting this :)... I finally got around to updating the joystick mod to be compatible with the latest official sauer release.

http://www.quadropolis.us/node/172

rancor,
In the process I discovered what was causing the errors you were seeing. I had included an older copy of the keymap.cfg that had a typo. Basically, it threw all of the bindings off by one after a certain point. Hence, the hat controls seemed to be rotated clockwise, etc.

If you get a chance, get the latest version and see if that fixes the problem for you.

Enjoy.

reply to this message

#39: Re: sauer 4/26/06 compatible

by rancor on 05/26/2006 09:53, refers to #38

Cool, I'll see if the friend who owns the controller in question can try it out, since I sadly do not own the xBox 360 or its associated controller.

reply to this message

Go to first 20 messagesGo to previous 20 messages    Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
58334961 visitors requested 76286792 pages
page created in 0.021 seconds using 10 queries
hosted by Boost Digital