PDA

View Full Version : Tip for Linux users: Fast casting using the keyboard ;)


Jimaklass
12-30-2011, 12:01 PM
I had always the problem of casting the right spell at the right moment, especially on critical game situations where danger was getting too close to me. Using the mouse to cast spells has an obvious disadvantage: you lose precious time and you lose control of your character's facing. Having watched some videos of good players on youtube, i noticed that they were able to use the keyboard for most spells but i simply lack this ability for spells bound to keys 6 to 0 (the last 5 spells of the spell bar). On top of that was the burden of changing bars with mouse wheel (lose even more time) since my keyboard doesn't help me with the keys F1-F2 (they are kinda high for me so i had to lift my hand off the keyboard and i could barely coordinate all actions at once). The result was slow casting, even pressing the wrong buttons sometimes, which ended with me casting the wrong spell and in general: awkward gameplay.

The obvious solution was to bind those spells (6, 7, 8, 9, 0) and shortcuts (F1, F2) to other keys more suitable for myself so i could have instant access to them with minimal errors. Unfortunately, the game does not allow to bind those keys to different alternatives, either through the gui or in the game.cfg file. It seems those keyboard bindings are hardcoded to the game. The workaround is to think the opposite way. So you may not be able to change those bindings but you can change your keyboard behavior ;)

This thread (http://www.regnumonline.com.ar/forum/showthread.php?t=47793) deals with similar issues and maybe one could extend that work to patch his/her own keyboard behavior. Here i propose a different approach for what it's worth, one that does not require you to patch and compile anything. My workaround might not resolve all issues of the above thread and this is not my purpose. The goal is to have several keys you need in a position that will allow you to instantly access them.

The idea is to instruct your keyboard to produce output different than the default. For example, in my setup i use the keys Q and E instead F1 and F2 and the keys Z, X, C, R, F instead 6, 7, 8, 9, 0. Here is the procedure you need to follow in order to setup your keyboard as needed:

Open a terminal and issue the command
xmodmap -pke > xmodmap-default

This will create a file named "xmodmap-default" containing the instructions of your current keyboard settings. Edit this file with a text editor and delete all the lines except for the ones that correspond to the letter keys (the file should then contain exactly 26 lines). Save the file:

keycode 24 = q Q semicolon colon periodcentered
keycode 25 = w W Greek_finalsmallsigma Greek_SIGMA
keycode 26 = e E Greek_epsilon Greek_EPSILON EuroSign
keycode 27 = r R Greek_rho Greek_RHO registered
keycode 28 = t T Greek_tau Greek_TAU
keycode 29 = y Y Greek_upsilon Greek_UPSILON
keycode 30 = u U Greek_theta Greek_THETA
keycode 31 = i I Greek_iota Greek_IOTA
keycode 32 = o O Greek_omicron Greek_OMICRON
keycode 33 = p P Greek_pi Greek_PI
keycode 38 = a A Greek_alpha Greek_ALPHA
keycode 39 = s S Greek_sigma Greek_SIGMA
keycode 40 = d D Greek_delta Greek_DELTA
keycode 41 = f F Greek_phi Greek_PHI
keycode 42 = g G Greek_gamma Greek_GAMMA
keycode 43 = h H Greek_eta Greek_ETA
keycode 44 = j J Greek_xi Greek_XI
keycode 45 = k K Greek_kappa Greek_KAPPA
keycode 46 = l L Greek_lamda Greek_LAMDA
keycode 52 = z Z Greek_zeta Greek_ZETA
keycode 53 = x X Greek_chi Greek_CHI
keycode 54 = c C Greek_psi Greek_PSI copyright
keycode 55 = v V Greek_omega Greek_OMEGA
keycode 56 = b B Greek_beta Greek_BETA
keycode 57 = n N Greek_nu Greek_NU
keycode 58 = m M Greek_mu Greek_MU

Back to terminal:

cp xmodmap-default xmodmap-regnum

Now you have a copy of that file with the name "xmodmap-regnum". Again, use your text editor to edit this file. Each line of this file is an expression that instructs your windowing system on the desired behavior of a certain key of your keyboard. The expression, depending on the key, is one of the following forms:

keycode XXX = keysym1 keysym2 keysym3 keysym4
keycode XXX = keysym1 keysym2 keysym3 keysym4 keysym5


We will be editing only the first 2 keysyms of each line. The 1st corresponds to the output of the key when pressed alone and the 2nd to the output of the key when pressed with SHIFT (or with CAPS LOCK on). For the setup i mentioned above you just need to edit the keysyms of the keys Q, E, Z, X, C, R, F as in this example:

keycode 24 = F1 q semicolon colon periodcentered
keycode 25 = w w Greek_finalsmallsigma Greek_SIGMA
keycode 26 = F2 e Greek_epsilon Greek_EPSILON EuroSign
keycode 27 = 9 r Greek_rho Greek_RHO registered
keycode 28 = t t Greek_tau Greek_TAU
keycode 29 = y y Greek_upsilon Greek_UPSILON
keycode 30 = u u Greek_theta Greek_THETA
keycode 31 = i i Greek_iota Greek_IOTA
keycode 32 = o o Greek_omicron Greek_OMICRON
keycode 33 = p p Greek_pi Greek_PI
keycode 38 = a a Greek_alpha Greek_ALPHA
keycode 39 = s s Greek_sigma Greek_SIGMA
keycode 40 = d d Greek_delta Greek_DELTA
keycode 41 = 0 f Greek_phi Greek_PHI
keycode 42 = g g Greek_gamma Greek_GAMMA
keycode 43 = h h Greek_eta Greek_ETA
keycode 44 = j j Greek_xi Greek_XI
keycode 45 = k k Greek_kappa Greek_KAPPA
keycode 46 = l l Greek_lamda Greek_LAMDA
keycode 52 = 6 z Greek_zeta Greek_ZETA
keycode 53 = 7 x Greek_chi Greek_CHI
keycode 54 = 8 c Greek_psi Greek_PSI copyright
keycode 55 = v v Greek_omega Greek_OMEGA
keycode 56 = b b Greek_beta Greek_BETA
keycode 57 = n n Greek_nu Greek_NU
keycode 58 = m m Greek_mu Greek_MU

Notice that i use the 2nd keysym to produce non-capital letters for all the letter keys. This way i cannot type any capital letters at all with this setup :D This is the downside of this configuration. Since i changed the 1st keysym to work as i need it i lost the ability to type with that key. For this reason i moved the default key behaviour to the 2nd keysym (so i can type in chat the letters q, e, z, x, c, r, f) and i changed the 2nd keysym of all keys accordingly so i don't have to selectively press SHIFT just for those keys. That's ok, i can live with it :tonguey:

With those 2 files you can now switch between the 2 configurations:
xmodmap xmodmap-regnum
gives you the altered behavior, while
xmodmap xmodmap-default
reverts your keyboard to what it should be ;)

Some notes:

If your account password includes capital letters don't use the altered behavior before you log in.
You must have the CAPS LOCK key on in order to type in chat box. In fact, it is best if you have CAPS LOCK on all the time when you use the altered behavior. Even then you will not be able to type capital letters.
In order to circumvent the above issue i use "yakuake". It is a KDE terminal application that remains hidden on the top of your screen until you press a button (like the console of quake-like games). With it i can switch keyboard behaviors on the fly as i play the game in windowed mode. Another solution would be to use "xbindkeys" to assign the "xmodmap" commands to mouse events.
If you use the exact configuration i mention above, you also need to use alternative keys for autorunning and resting. I use G and T respectively.
If you have a mouse with extra buttons (gaming mouse) you can use the programs "xbindkeys" and "xvkbd" to assign keystrokes to mouse events. I don't need such a workaround myself since my mouse (http://www.roccat.org/Products/Gaming-Mice/ROCCAT-Kova-/) is fully supported under linux but i can write here a how-to if people are interested ;)


I hope this approach helps people to improve their gameplay experience. It does not mess with your system libraries, it doesn't require you to patch and compile code, it only uses the "xmodmap" program and 2 plain text files to switch between keyboard configurations. Regards ;)

OpperVaagheid
12-30-2011, 01:13 PM
If you have a mouse with extra buttons (gaming mouse) you can use the programs "xbindkeys" and "xvkbd" to assign keystrokes to mouse events. I don't need such a workaround myself since my mouse (http://www.roccat.org/Products/Gaming-Mice/ROCCAT-Kova-/) is fully supported under linux but i can write here a how-to if people are interested ;)



Thnx for this tip! Maybe i now can finally go and look at the Razer Naga Epic (http://store.razerzone.com/store/razerusa/en_US/pd/productID.220156700/categoryId.35208800) mouse =]

Zodar
12-30-2011, 03:09 PM
Nice tip - I use xmodmap to set things like XF86Standby/XF86Sleep, but never thought of using it for anything else!

Kitsuni
12-30-2011, 05:17 PM
Keep in mind this might still be classified as using a third party tool, as other players don't always have the ability to do this.

Jimaklass
12-30-2011, 05:31 PM
Every linux user can use this and windows users *may* be able to use this through cygwin. xmodmap is a GPLed application, and an X-server can be run on windows too. Besides, if someone uses the mouse or keyboard driver to modify mouse / keyboard configuration then he/she uses a third party tool that others can't use. This is not a hack. This is not coding. This is configuration. This does not affect the game executable and/or system memory in any way. This is not an unfair cheat.

Zodar
12-30-2011, 08:00 PM
This is not an unfair cheat.

I would also add that a number of joysticks have configurable buttons that can be programmed to perform exactly the same kinds of function, so I don't really see the difference to be honest.

standistortion
12-30-2011, 09:18 PM
a number of joysticks have configurable buttons that can be programmed to perform exactly the same kinds of functiontt
plenty of programable mice and keyboards too

Kitsuni
12-31-2011, 03:29 AM
Don't get your undies in a bunch, that is not what I said. I simply said it could be considered a third party tool.

The game does not implement this functionality, therefor it is third-party.

NotScias
01-01-2012, 06:38 PM
Nice topic, quite long tho making it appear difficult but it's really simple to do.
Too bad it applies to the whole desktop and not only regnum :/

The game does not implement this functionality, therefor it is third-party.

Behold the stunning logic.

The game doesn't allow to talk to people from other realms (besides xmas event), but MSN/IRC/mumble do, therefore they are considered third-party (?)

This tool absolutely doesn not give any tactical or in-game advantage and is a general purpose tool that can configure key bindings for the whole desktop and not only RO. People having gaming keyboards/mice should get banned because they can cast more comfortably than regular users ?
We're talking about comfort here, and anyways every user can do it. It's not giving an unfair advantage like scanmem or bots/auto-target tools that don't respect the game rules.
It's quite obvious the rules are directed towards these unfair utils and not legit ones like this or mumble.

standistortion
01-01-2012, 10:22 PM
This tool absolutely doesn not give any tactical or in-game advantage and is a general purpose tool that can configure key bindings for the whole desktop and not only RO. People having gaming keyboards/mice should get banned because they can cast more comfortably than regular users ?
We're talking about comfort here, and anyways every user can do it. It's not giving an unfair advantage like scanmem or bots/auto-target tools that don't respect the game rules.
It's quite obvious the rules are directed towards these unfair utils and not legit ones like this or mumble.
I've been planing to hack mumbles overlay to give clickable icons around the curser to use instead of a spellbar, that might give an edge in battle and so an unfair advantage. I would share it happily (could be an embarising hack and slash job I would never get around to cleaning up though) but that still leaves others without this advantage (if it would be one).

Its the same situation with re-mapping keys, playing keypress sequences with apps or devices etc etc. An API to the interface would level out this imbalance, there are plenty of geeks playing who would take pride in helping to make the best interface RO could have and seeing other folks use it.

Another simple example is piping out the current chat to festival or another text to speech backend. A droning simulated monotone would be a PITA at CS but would make a big difference when trying to watch everything in war. Maybe there is a command line option to pipe out chat...
./rolauncher --help
Segmentation fault
...ok, guess not.