This page contains information for creating and replaying tool assisted speedruns of Teslagrad.
TAS Tools and Programs[]
- TeslagradTAS is a tool that records and plays .tas text files that contain frame and button pushing info. Desyncs when executing Moonwalking and Moonjumping.
- LibTAS is a tool for making TASes of Linux games.
LibTAS Setup[]
We are running LibTAS and Teslagrad on Windows 10 via the Windows Subsystem for Linux, version 2.
We are currently using Ubuntu 20.04.2 LTS and LibTAS 1.4.2.
Refer to this guide for installing WSL2, Ubuntu, LibTAS, and Steam for Linux.
Install Teslagrad via Steam for Linux.
Install an additional dependency for Teslagrad: sudo apt-get install libglu1
Launch Teslagrad natively from Steam and set it to Windowed mode in Options -> Graphics.
This is needed because LibTAS enforces windowed mode, and Teslagrad does not display correctly through LibTAS if it's configured in fullscreen mode.
Launch LibTAS and set properties as follows:
- Game Executable:
~/.steam/debian-installation/steamapps/common/Teslagrad/Teslagrad
- Command-line options:
-force-gfx-direct
- Runtime menu -> Check Virtual Steam Client
- Input menu -> Uncheck Mouse Support
- Frames per second: 120
TAS Knowledge[]
- Teslagrad for Linux does not have v1.3.1 available on Steam, so a TAS is going to be following the Current route instead of Legacy.
- Teslagrad appears to update physics and poll input at a rate of at least 120 Hz. This is likely why desyncs were occurring in earlier TAS efforts. Therefore we are recording the TAS at 120 fps.
- Synchronization is partially dependent on the capabilities of the host computer; high CPU and Memory usage can cause frame lag that can desynchronize playback if the movie is attempted to be played back near realtime. Frame advancing the playback mitigates the risk of desyncs. Avoid using LibTAS's fast-forward feature. This is especially important on load frames (whenever the game is loading something).
- Boursin has created a Lua script to throttle the playback framerate. Long pauses (2 sec) on load frames, and short pauses (0.25 sec) on normal frames is enough (on his machine) to play and even encode a movie without desyncs.
- The Memory Addresses for Linux are not the same as for Windows. And due to the dynamic memory allocation of Mono / Unity, they do not even remain consistent from run to run.
- Cheat Engine can be installed on Linux:
- Download the Cheat Engine 7.3 installer for Windows, and the Cheat Engine 6.5 Server for Linux (ceserver_linux_x86_x64.zip) and copy both files to the Linux partition.
- Unzip the Cheat Engine Server to a directory.
- Run the Cheat Engine installer with wine:
wine CheatEngine73.exe
- Open three separate terminals for executing the next steps.
- In terminal 1, run LibTAS and launch Teslagrad.
- In terminal 2, navigate to the Cheat Engine Server directory and run
./ceserver
- In terminal 3, launch Cheat Engine with wine:
wine ~/.wine/drive_c/Program\ Files/Cheat\ Engine\ 7.3/cheatengine-x86_64.exe
- In Cheat Engine, click Open Process, then click the Network button, then click the Connect button. The Linux processes will be listed.
- LibTAS's and Cheat Engine's Pointer Scans are not helpful in producing durable pointer addresses, thanks to the complexity of the Unity engine. This led to the desire to monitor the Unity internals via Mono, but Cheat Engine's Mono features are currently not supported on Linux.
Memory Knowledge[]
Since the memory cannot be reliably traced by address, the plan has changed to trace them by value, by looking for known values and searching memory for those values.
Information below for finding potentially useful memory values and understanding their object-oriented structures.
Position[]
Position is represented as a UnityEngine.Vector3 object consisting of an (X,Y,Z) array of floats. It is stored in Teslagrad's Unity object Player.player.transform.position
When starting a new game via Opening Cutscene Skip Teslakid spawns at (-1115.06494140625, 14.091270446777344, 0)
Velocity[]
Velocity is also represented as a Vector3 and stored in the Unity object Player.player.rigidbody.velocity
.
Normal horizontal walking is capped at exactly 7.5 velocity when walking right and -7.5 velocity when walking left, which makes it easy to memory search. Once vX is found, add 4 to the address to find vY.
Animation Space[]
Teslakid's animation posture is stored in the Unity object Player.player.currentAnimation.space
and is an enumeration of the following states:
- Grounded = 0
- Airborne = 1
- Climbing = 2
- Ceiling = 3
- Nowhere = 4
Booleans![]
The Player
class has many Boolean values, but here are some we may be interested in: haveGlove, haveBlink, haveSuit, haveStaff, ignoreKillZones, activeSuit, launching, superJump, wallLaunching, wallClimbing, wallHangingOut, wallResting, punchingUp, punchingDown, punchingForward, shooting, ledgeLanding, ledgeLandClimbing, byWall, byClimbableWall, canBlink, blinking, dying.
Scene & Checkpoint[]
SceneIndex and CheckpointIndex are int32s representing the Scene Index and Checkpoint within that scene you are located in. These are written to the save file via Teslagrad's SerializedSavedGame class.