SHO GTR2 Memory Operations Tool

From Simwiki.net
Jump to navigation Jump to search

What is SHO GTR2 Memory Operations Tool?

  • A Windows app that reads GTR2 memory, not just shared memory, in the hopes of being able to affect game operation in ways not possible otherwise
  • Made in Visual Studio with C#
  • Credit to T-Shirt's python memory operations scripts shared on the Simwiki Discord
  • My personal goal is to get to a place where I can create an algorithm that modifies AI weight penalties, or other AI difficulty values, to accomplish my Automatic AI - Performance-based Dynamic AI Scaling ideas.

Status

  • Work In Progress
  • Early exploratory and proof of concept experiments
  • Successfully reading memory and values like grid, vehicles, driver names, weight penalties, etc.(Feb 2026)
  • Successfully writing memory for values like weight penalties - just a proof of concept bit of code (Feb 2026)

Download

Release Notes

Coming Soon..?

Plans

Next:

  • Map out all grid data fields in a way that I can dynamically go find them in memory
    • For example, a list of field names and their offsets in memory so that I can loop over the list and grab them all and put them in a list I can then use, update, etc.
  • Helpers for memory writing. Already have WriteFloat().
  • Review Cheat Engine for its use in exploring GTR2 memory and enabling ways to discover where values are in memory

Later:

  • Port to a Windows GUI App.
    • Currently just a Windows Console App.
    • But a GUI app could have proper standard menus, a tabbed interface, easy access to logging, and an intuitive UX experience to execute and repeat certain operations interactively.
  • Add CCGEP Monitor's shared memory reading logic
    • Add a GUI tab to display the various views (GTR2Data.cs):
      • MM_TELEMETRY_FILE_NAME = "$GTR2CrewChief_Telemetry$";
      • MM_SCORING_FILE_NAME = "$GTR2CrewChief_Scoring$";
      • MM_PITINFO_FILE_NAME = "$GTR2CrewChief_PitInfo$";
      • MM_EXTENDED_FILE_NAME = "$GTR2CrewChief_Extended$";
      • MM_HWCONTROL_FILE_NAME = "$GTR2CrewChief_HWControl$";
    • Compare CCGEP Monitor's logic with T-Shirt's python scripts. See if there's any valuable differences.

Future:

  • Dynamic AI Adjustment Algorithm
    • Based on Automatic AI - Performance-based Dynamic AI Scaling
    • AI adjustment might adjust AI Driver Strength (AI Difficulty), Race Ability, CorneringAdd, AIW Best/Mid/WorstAdjust, PLR AI Brake Power / Brake Grip / Corner Grip, and/or weight penalty
      • I'm leaning towards just relying on Weight Penalty since it's officially supported by the engine, itself, and because it's the way BOP Balance of Power is done in real life which is effectively what I want to do: BOP AI drivers around the Player.

Development Notes

  • 2026-02-26
    • Learned how to make a Windows WPF GUI App with standard file menus and a tabbed interface. This puts me in a good spot to port the console app code over and begin an app that will be more interactive than a console app could be.
  • 2026-02-25
    • Improving the data structure list of values in memory so that in the future reading memory will be more dynamic rather than static kind of reads
    • Each day I wrap my head around the code and memory being read better, it helps to refactor the code to be more accurate about what I'm doing with regards to naming of constants, variables, functions, and classes.
      • Given that this code started from sketchy AI generated code, there's some code that is causing confusion. Anyway, much cleaner and makes more sense now.
      • One improvement I made over the original Python code is that the logic to find the base memory region, where all the data we want lives, is found more dynamically. That is, I loop through all the GTR2.EXE virtual memory regions and match signatures within those memory regions: If all the signature match in a single region, that is the base memory region. Then, handy memory offsets allow me to find the exact sub-regions that contain different categories of values.
    • Started a local git repo. Will put it up on github/gitlab at some point.
  • 2026-02-24
    • Started building out helper classes to contain memory regions and the fields within those regions
      • For example, the Grid Data region contains slots and each slot contains fields like slot id, pit group id, driver name, weight penalty, and many more
      • This will help to write later code that just consumes all the available fields and displays them all in a nice GUI. That will help in visually identifying and working with the memory data.
  • 2026-02-23
    • Now reading slot id, pit group id, driver name, weight penalty, car file path
    • Developing helpers functions to modularize reading memory (strings vs floats vs ints, etc.)
      • Higher level functions that find named values in memory
      • Higher level functions call lower level functions that specific value types in memory (strings, floats, ints, etc.)
      • Eg. FindSlowWeightPenalty() calls FindSlotFloatValue() calls ReadMemoryFloat() calls ReadProcessMemory()
      • The idea is to gradually build out helpers, utility functions, and high level functions that can then be used by higher level algorithms and presented in some kind of UI rather than just the console app it is now
    • To-dos:
      • Helpers for memory writing. Already have WriteFloat().
  • 2026-02-22
    • Console app
    • Working proof of concept code to connect to GTR2.EXE process, find grid data region of memory, find weight penalties, write weight penalties and read them back to prove writing worked
    • Used AI to help me convert static memory offsets into logic that dynamically finds the right region of memory based on 'signatures' of expected memory bytes data
    • All based on T-Shirt's python mem ops scripts shared on the Simwiki Discord
      • He has mapped out many named values in memory and tables of values and memory offsets are included in the scripts

Scratchpad

==
260226

Windows Console App vs GUI App:
- How far can I go with just the console app?
- I can build out functions to read the memory in bulk, structure things nicely for future display, etc.
- But it's not really serving the goal until I move to a GUI app
- So, probably time to move to a GUI app

==