Sunday, March 13, 2016

bike home trainer and Fallout 4

I bought my bike home trainer a few months before the release of Fallout 4, but according to Steam and my list of training exercises I have spend much more time playing Fallout 4 than I have spend on the home trainer.

So this is about to change....

The main idea is to couple the bike home trainer to Fallout 4 in some way. As documented in  my previous post (https://technikgebastel.blogspot.de/2016/02/bike-home-trainer-i.html) I have succeeded in getting measurements from the bike home trainer to my linux laptop.
Now there are two major problems/questions to solve:
0. How to get the measurements from the home trainer?
1. Which aspect of the game should my performance on the bike trainer influence?
2. How do I make the necessary modifications in the game and feed in the data?
3. How to play comfortably while exercising on the bike?

0. home trainer:

In a previous post (https://technikgebastel.blogspot.de/2016/02/bike-home-trainer-i.html) I have shown how to measure the rotations speed of the bike home trainer with a USB-io-card. My fork of the Python tolls for the LabJack U3 can be found at https://github.com/ravenschade/LabJackPython. The script Examples/u3allio_ergometer.py measures the rotation speed and records them to a text file, i.e. python Examples/u3allio_ergometer.py ~/ergometer_log

1. game property:

There were several options for the first problem:
a. total game speed
b. AP recovery rate
c. HP recovery rate
d. movement speed

I chose the movement speed option, because it is most immersive. It can be modified by the effect Fallout4.esm/Magic Effect/AbFortifyActorSpeedMult, which takes a positve or negative percentage of change. Now all that has to be done is to create ingame items with this effect. I choose the ring-slot. In order to put the items somewhere in the game, where they can easily be picked up, I started form the mod Strongman's Rings by OmegaDir (http://www.nexusmods.com/fallout4/mods/5593), that puts a dave with some ring in the control station outside of vault 111. My mod uses this mod as a master file and adds a lot of rings, which have AdFortifyActorSpeedMult-modifiers from -100 to 300 in steps of 10, i.e.  -100% to 300% change of movement speed. The names are ".speed [percentage]".

2. external input to the game:

For the second problem Bethesda was very helpful, because they made the Pipboy-app for smartphones and tablets, so that one can use it as a secondary screen and modify the equpiment status and several other things. Luckily other people have already reverse engineered the protocol (special thanks to matzman666 https://github.com/matzman666/PyPipboy).
My fork can be found at https://github.com/ravenschade/PyPipboy. The relevant script is examples/equip.py.
It takes one command line argument, which is the file name of the log file produced by the ergometer logger, i.e. python3 examples/equip.py ~/ergometer_log.
This script then tries to connect to a Fallout 4 game in the same network, keeps reading the log file and submits movement speed changes in the form of item equip/uneqip commands to the game.

equip/unequip sound problem:

One problem here is that there is a noise if we equip/unequip and armor piece even when done via the app. The solution is to place empty sound files in Steam/steamapps/common/Fallout 4/Data/sound/FX/ITM/ for the files: ITM_Clothing_Down_01.xwm, ITM_Clothing_Down_02.xwm, ITM_Clothing_Up_01.xwm, ITM_Clothing_Up_02.xwm and modify the Fallout 4 ini to include the path.

3. How to play comfortably while exercising on the bike? 

The interface works pretty well. There is a delay of about a second between changes in the rotation speed on the bike and the corresponding change of the movement speed in the game. This is mainly due to the fact, that the bike only generates a pulse on a full rotation of the pedals.
So in principle everything works, one remaining challenge is to modify the bike, mouse and keyboard so that I can play comfortably while exercising.

The current setup is shown in the following pictures:





The book and box under the mouse are there so that the hands rests higher and there is no force on the joint of the hand.

If you are interested in my work, please leave a comment below.




1 comment: