Toukiden: Kiwami

Toukiden: Kiwami

Not enough ratings
Mouse Emulation
By kei10 and 1 collaborators
Mouse support using both Autohotkey and GlovePie 4.5!
Wewewewewewew!
   
Award
Favorite
Favorited
Unfavorite
Introduction
... Greetings...

This is version 1 of my mouse emulation. I have created a second version, which emulates joystick (XInput) instead of Keyboard.

Version 2 is much smoother and better than version 1. I recommend using version 2.

Here is the link to my second guide.


http://steamcommunity.com/sharedfiles/filedetails/?id=838994126
* * *

My friend was raving about not having mouse support about the game. So I decided to try and implement a little mouse emulation.

He's the one that introduced me GlovePie, and I've used it to create this mouse emulation for the game.

All kudos to him!

The scripts are programmed for efficiency. So far, the mouse emulation script algorithm is the best I could think of. If you have any better approaches, please feel free to modify it, and/or share!

Additionally, if you're following the game, begin with default controls, as I will explain the points along the way of why, please bear with me! :D
Problems with the game
There are a few breahtroughs of the game that we have to concern about before then...
  • Windowed
    • Windowed mode of the game causes the framerate to drop in certain areas, especially in the villages and such. Thus we have to play the game in Full-Screen.

  • Full-Screen Alt+Tab
    • The next problem is that if we alt+tab out of the Full-Screen, now if you enter back into the game, any mouse clicks will cause the game to alt+tab back to the desktop.

      It's annoying and it just so happened that my friend gave me an idea of how to fix it; and that is by turning the game into Borderless while Full-Screen.

  • Steam Overlay
    • For some strange reason, Steam Overlay doesn't want to work. But with the help of turning the game into Borderless, it makes the Steam Overlay work -- it may not work sometimes, I have no idea why...

      Warning! The mouse emulation script causes problem with the overlay. It's annoying as you have to temporarily disable the script to use the overlay, or else... In any case, just use alt+tab if you were to chat.

  • Hard-coded controls
    • Many controls weren't rebindable in the game, they're probably hard-coded into the game, as I have no idea how to change them. This guide will begin with default control settings.

Warning! Do not alt+tab while the game is loading! It may freeze the game!
The required files
To begin, three files are required. I have compressed them into a single file.

https://www.dropbox.com/s/rte0nm5lj3rfg1h

The file contents contains the following:
  1. GlovePIE045Free
    • This is the folder that contains the GlovePie software that responsible for emulating the mouse controls and in-game camera.

  2. Window_Borderless_Toggle
    • This is the folder that contains the Autohotkey files that responsible for toggling borderless mode for the game. It contains files with the following extensions:
      1. .ahk
        • This is the Autohotkey source code for the borderless toggle.

      2. .exe
        • This is the compiled version of the borderless toggle. If you are feeling insecure of launching this, then you may go to https://autohotkey.com/download/ to get the software to launch and execute the .ahk source code instead.

      3. .ini
        • This is the main configuration file for the borderless toggle. It has a default setting that binds the hotkey for borderless toggle as Windows Key + B, and you can change it.

          For reference, please take a look at https://autohotkey.com/docs/KeyList.htm

  3. Mouse_Camera.PIE
    • This is the main script that fully responsible for the mouse emulation using GlovePie, you will have to load it up with GlovePie to execute it.
How to use
Here are the steps to make the mouse emulation work.

  1. Download the required files:
    https://www.dropbox.com/s/rte0nm5lj3rfg1h

  2. Extract the compressed file somewhere.

  3. Launch window_borderless_toggle.exe from Window_Borderless_Toggle directory.

  4. Launch PIEFree.exe from GlovePIE045Free

  5. Load up the Mouse_Camera.PIE within the GlovePIE - Programmable Input Emulator 0.45 interface by context menu File > Open, or hotkey Control + O, and look for the file.

  6. Launch game in Full-Screen mode, and make sure the controls are default for now, then load your save.

  7. In the game, press Windows Key + B to toggle the game into borderless. You must do this as soon as the game is launched before you do anything else.
    Close window_borderless_toggle.exe and launch it again in Administrator mode.
    Now you should be able to alt+tab and click inside the game without causing the game to alt+tab out with no reason.

  8. Alt+tab out of the game to return back to the GlovePie interface, run the script by clicking Run within the interface, context menu Run! > Run!, or press F9.

  9. Return back to the game, and press Equal (=) key to toggle the mouse camera script, and voila! You should be able to move the camera with your mouse, and use mouse clicks to perform the following consecutive keys for attacks:
    • Left Mouse Button is assigned as L, which is Attack1
    • Right Mouse Button is assigned as P, which is Attack2
    • Middle Mouse Button is assigned as ' (Apostrophe), which is Attack3 (Special Attack)

    If it doesn't work, disable the script (toggle again with the Equal (=) key to stop the mouse from centering the screen, then click the Stop within the GlovePie interface, from context menu Run! > Stop, or press Shift + P + I + E ), close GlovePie, relaunch it in Administrator mode, load the Mouse_Camera.PIE script, and follow the steps again.

Remember to disable the GlovePie script by clicking the stop button in the interface. Toggling off with the hotkey I added doesn't fully help, as it still seems to produce some kind of adverse effects.
How to use (tl;dr)
Allowing Steam Overlay, Alt+Tabbing, and prevent Alt+Tab when mouse clicking

The keybinding toggle for autohotkey window_borderless_toggle.exe is Windows Key + B, press it in-game to toggle it as soon as you launched the game to make it borderless, so that alt+tab and mouse clicks will not interfere within each other.

Mouse camera emulation, and mouse buttons for attacks

The keybinding toggle for GlovePie Mouse_Camera.PIE script is Equals (=) key, use it to toggle the mouse camera movement and mouse clicks LButton, RButton, and MButton which is binded to Attack1, Attack2, and Attack3 respectively.

Warning! When the mouse camera is enabled, your mouse will be kept centered to the screen for detection purposes.

Warning! The script heavily interferes with the steam overlay, since it mapped to the keyboard keys, it will spamming.
Keybindings and configurations
The Borderless Toggle autohotkey has a configuration file named window_borderless_toggle.ini, within there is a setting named window_borderless_toggle_hotkey, which is default to Windows Key + B.

Refer to this reference https://autohotkey.com/docs/KeyList.htm if you wish to rebind it to something else.

The Mouse_Camera.PIE script has been programmed to my own liking, I haven't got the interest to delve deeper into GlovePie, thus there are no configuration file for it, you'll have to modify the script yourself.

You may easily modify the line that are commented with // before it.

Here are the variables involved:
  • mouse_camera_threshold_x and mouse_camera_threshold_y (default is 1)
    • This variable is the threshold number for distance in pixels between the center of the screen and your mouse, if the distance is greater than this number, it will cause the script to send out respective keyboard keys to move in-game camera. This setting can be regarded as sensitivity.

      The default key binding for in-game camera controls are: horizontal for Q, and E); vertical for R, and F.

      You may calibrate this to your liking if you feel uncomfortable with the default setting.

  • mouse_camera_stop_speed_x and mouse_camera_stop_speed_x (default is 64)
    • This variable is the speed for stopping the camera. Lower number causes small movement of the mouse to move the camera bigger distance, and bigger number stops the camera faster when you stop your mouse.

      You may calibrate this to your liking if you feel uncomfortable with the default setting.

  • The toggle key
    //Toggle If Pressed(Key.Equals) {

    This is defaulted to Key.Equals (=), if you wish to change it, erase the .Equals, then type in a period/dot/fullstop (.) next to the Key to list all the keys you want it to rebind it with.

You may add other things into the script, but I am not going to disclose anything about it...
Formula and Target Lock fix
The move threshold and the stopping speed is inversely proportional to each other. Using this idea, we can easily calibrate the variables.

For my script, I have used 1 : 64 as the default.

For example...
Move Threshold : Stop Speed 1 : 64 (default) 2 : 32 4 : 16 8 : 8 16 : 4 32 : 2 64 : 1

For anyone that uses target lock will have tremendous trouble if they set their Move Threshold to too low.

Use the formula above to recalibrate properly but retain the same camera speed.

If the option above is not working well, consider changing from += to = of the following lines of code:
var.mouse_camera_delta_x += Mouse.CursorPosX - var.mouse_camera_origin_x var.mouse_camera_delta_y += Mouse.CursorPosY - var.mouse_camera_origin_y

to:

var.mouse_camera_delta_x = Mouse.CursorPosX - var.mouse_camera_origin_x var.mouse_camera_delta_y = Mouse.CursorPosY - var.mouse_camera_origin_y
In-game Keybindings and Settings
As of now I have mentioned that the guide starts with in-game default controls. However, that will be problematic as there is an extra key that isn't binded near the WASD controls.

One is the Dodge key, which is default to semicolon (;). Certain moves had to be performed along with the dodge key and the attack keys, such as evasive attacks, blocking, and parrying.

Here are my personal controls for the game that I find comfortable:
  • Dodge/Dive as Space
  • Communion/Purification/Run as Left Shift
  • Turn Target Locking On as Left Control
  • Eye of Truth as G

Set both Camera Rotation Speed to higest.

However, Targeting Rotation Camera Speed is the manual aiming, you can set this to whatever you desire.

Credits
Thanks to these softwares that existed:
  • GlovePie 4.5
  • Autohotkey
And thanks to my friend for testing the script!

Thank you for reading!
8 Comments
kei10  [author] Mar 24, 2017 @ 1:22am 
The guide for Toukiden 2 has been created with tweaks and changes.
http://steamcommunity.com/sharedfiles/filedetails/?id=889963575

Unfortunately it's version 2, not version 1, though.
Nine O'Clock Mar 23, 2017 @ 11:24am 
Great news then! Thx again for your work :)
kei10  [author] Mar 23, 2017 @ 8:54am 
Oh, thank you. Though, Price has bought the game. I suppose I will get to create the guide for Toukiden 2.
Nine O'Clock Mar 23, 2017 @ 8:48am 
By same control you mean the same keybindings? Like attack1/attack2? Unfortunately I didn't play the first game so I can't say if they have the same controls, but I can give you a list of the controls from the second game
Jepa.CaptPrice  [author] Mar 22, 2017 @ 10:33pm 
Not sure because both me and Kei don't own toukiden 2 as of yet , does it share the same control?
Nine O'Clock Mar 22, 2017 @ 6:55am 
Do you think it would be possible to make this work with toukiden 2? I've been looking for a way to make it works whit mouse/keyboard and your tool is the closest thing I was able to find
kei10  [author] Jan 4, 2017 @ 9:19pm 
Links fixed, looks like steam doesn't allow mediafire...
Jepa.Dowa Jan 4, 2017 @ 9:00pm 
I r8 8/8 m8