Difference between revisions of "SEN:P-AI"

From Rigged Wiki
Jump to navigation Jump to search
Line 26: Line 26:
  '''Note:''' SEN:P-AI makes some assumptions about the TDT's location that have a small/rare chance to be wrong and make the table unfindable. However, {{tt|the TDT stays in the same place for the entire time PES is running|Why this isn't the case for everything else is a mystery to me}}, which means that it only has to be found once, but if it's not you will need to restart PES to get things to work.
  '''Note:''' SEN:P-AI makes some assumptions about the TDT's location that have a small/rare chance to be wrong and make the table unfindable. However, {{tt|the TDT stays in the same place for the entire time PES is running|Why this isn't the case for everything else is a mystery to me}}, which means that it only has to be found once, but if it's not you will need to restart PES to get things to work.


[[File:SEN P-AI Screenshot3.jpg|right|thumb|200px]]
* From this point on to until PES is closed, SEN:P-AI will be searching for the '''Player Stats Table''' (PST) using the player IDs it got from the TDT. The PST appears in memory the instant before the first touch of the match. Once SEN:P-AI detects the PST, it will fill the cells in the table of the previously created empty match with the current stat values (mostly zeros). If there is no empty match (because you selected the same two teams as the previous match) it will create a new one and use that instead.
* From this point on to until PES is closed, SEN:P-AI will be searching for the '''Player Stats Table''' (PST) using the player IDs it got from the TDT. The PST appears in memory the instant before the first touch of the match. Once SEN:P-AI detects the PST, it will fill the cells in the table of the previously created empty match with the current stat values (mostly zeros). If there is no empty match (because you selected the same two teams as the previous match) it will create a new one and use that instead.



Revision as of 00:08, 13 February 2018

SEN:P-AI logo, chosen cause I thought it was funny. Feel free to suggest something better.

Stats and Events for Nerds: PES - Autism Incarnate (SEN:P-AI) is a program that reach into PES memory and find, extract, and record real-time changes to PES's internal player stats table, all with little to no user intervention required.

The latest release can be found here: https://github.com/Two-Scoops/SEN_P-AI/releases

What the hell is this good for?

The powerful ability to read PES memory brings many potential use cases including but not limited to:

  • Detecting important events such as goals and relaying them to other programs such as Rigdio
  • Automatically recording all player stats for use in Fantasy Sports and other such autism
  • Automatically updating the cup wiki page and creating detailed stats pages
  • Automatically splitting stream recordings into matches (for archiving) and highlights (for hyp material) using recorded event timestamps
  • Driving an IRC/Discord bot which provide live updates to filthy mobile users people stuck at work or with 3rd world internet
  • Providing a better way to view and analyze players and matches when testing tactics or rule changes
  • Driving an IRC rigging bot which can report useful information to live-managers and potentially do automated rigging via commands

It currently works with Pro_Evolution_Soccer_2017

How the fuck do I use this shit?

SEN P-AI Screenshot1.png

Running

Once you download and extract the file, you will have a single file "SEN_P-AI.exe" that should work out of the box with no installation or extra files required.

Every time you run SEN:P-AI it will open the Windows Admin Permissions prompt, this is necessary to get the ability to read the memory of another process, otherwise SEN:P-AI will not open. (I may make this optional in the future)

Recording Stats and Events

  • Once SEN:P-AI is running, it will begin searching the process list for a program with the name "PES2017.exe". It does not matter if you start SEN:P-AI before or after you start PES, in fact you may open and close PES multiple times at any time and SEN:P-AI will just revert back to its process search and continue to work.
SEN P-AI Screenshot2.jpg
  • After SEN:P-AI has found PES2017.exe, it will start searching through its memory for the Team Data Table (TDT). The TDT should be detected by SEN:P-AI as soon as you select two teams and enter the pre-match setup screen, at which point SEN:P-AI will create a new tab with an empty match for the two teams you just selected, as well as every new set of teams you select from then on.
Note: SEN:P-AI makes some assumptions about the TDT's location that have a small/rare chance to be wrong and make the table unfindable. However, the TDT stays in the same place for the entire time PES is running, which means that it only has to be found once, but if it's not you will need to restart PES to get things to work.
  • From this point on to until PES is closed, SEN:P-AI will be searching for the Player Stats Table (PST) using the player IDs it got from the TDT. The PST appears in memory the instant before the first touch of the match. Once SEN:P-AI detects the PST, it will fill the cells in the table of the previously created empty match with the current stat values (mostly zeros). If there is no empty match (because you selected the same two teams as the previous match) it will create a new one and use that instead.
  • All of the above requires no user interaction with SEN:P-AI but understanding how it behaves should allow you to see if anything has gone wrong.
For the same reasons as the note above there is a small chance that SEN:P-AI will not find the PST on its own. Except unlike the TDT, the PST is being removed and reallocated with every new match, increasing the chances that the search will fail the longer PES is running. Since restarting PES at this point would be a pain in the ass, if you notice that SEN:P-AI does not fill a table with numbers after a match starts then you can press the button labeled Try Harder at the top of the window next to the status message. This will activate a brute force search of PES's entire memory space to find the PST.

Additional note about the Try Harder button: since the stats table isn't in memory until the first touch, clicking the button before then will not work. However, if you're running the same teams multiple times in a row, the brute force search might find a fake copy of the stats table from the previous match that PES keeps around until the next match for some reason. This isn't a huge problem since SEN:P-AI will just stop the fake match and resume searching once PES overwrites the table with unrelated garbage, but if you're running in a streaming environment this will cause false information to be reported to other programs, you'll also have a garbage match sitting in your tabs.

NumbersNUMBERS.gif

Numbers NUMBERS

  • During a match, SEN:P-AI will be continually reading PES memory and interpreting its changes. In the stats table each row will be highlighted with the color of the corresponding player's team (since there's currently no way get the appropriate team colors, I just use the same Home/Away colors that Rigdio uses) recently updated stats will flash to red and then fade back to black. You can select a rectangular range of table cells and copy them into your clipboard using "Crtl+C" formatted for pasting into spreadsheets.
  • Important events such as goals and cards will be reported in the text box in the bottom left, which can be resized (vertically). You can use this to see who was actually credited for goals, assists, and cards instead of trying to guess before the name is flashed on screen after the cutscene and without having to go to the match events screen.
  • A typical two 4CC teams playing each other have 46 players total, but only 22-30 will actually play in a match. To hide/show benched players who never stepped on the pitch, you can toggle the Show Benched Players checkbox near the top right. If hidden, SEN:P-AI will automatically make newly subbed players visible during the match. The checkbox applies to all tabs
SEN P-AI Screenshot.png
  • If there are TOO MANY NUMBERS or NOT ENOUGH NUMBERS or you need DIFFERENT NUMBERS in a DIFFERENT ORDER you can click the Columns button near the top right to open a dialog where you can toggle individual stat visibility, as well as reorder them by dragging the label up and down. The checkboxes on the right in the "Log" column currently serve no purpose as I've disabled the statlog functionality I used in testing. While there are many useful stats in this list, there are even more stats in the table that have yet to be conclusively identified (they're not displayed anywhere in PES). If you wish to see them in this list, you can check the Show Unknown Stats box at the top of the dialog. These settings apply to all tabs. Changes will only be applied if you click OK;
  • In the top right of the main window, inside the "Memory Reader" box, there is a real-time UTC clock along with a small QR Code containing the corresponding timestamp. This is intended to be used for synchronizing the stream recording with automated archiving processes. If it bothers you for whatever reason, you can hide it by unchecking the adjacent show time checkbox. The QR timestamp encodes a UTC Unix Timestamp with Numeric mode, ECC set to High, version fixed at 1, and an automatically selected mask pattern, all rendered at 1 pixel per module.
    If a streamer intends to use this feature they can capture a sub-region of the SEN:P-AI window, scale up the QR code (with scale filtering set to "Point" in OBS), and stick it in one or more corners at the very beginning of their stream (maybe even make some kind of test card out of it). Currently there is not yet any automated stream archiving functionality to use this with, but you can still set up as if there was so maybe we can test some shit using your stream.

Matches, Saving, and Loading

SEN P-AI Screenshot4.png
  • Whenever SEN:P-AI detects a new match (when either two new teams or a new stats table is detected) it will insert a tab labeled Current Match at position 0 of your match tabs. Once the match has ended (you exit the postmatch screen and SEN:P-AI no longer detects the stat table) the tab will be renamed to /[home team]/ vs /[away team]/. You can press the X on any tab except the one labeled "Current Match" to close it.
  • Both during a match and after it has ended, a * will appear before the tab name to indicate that it is unsaved in its current state. If you close a tab that starts with * or close SEN:P-AI with any of these tabs, the collected stat and event data for that match will be lost forever.
  • To save this data into a ".sen" file where it can be reloaded, click the Save or Save as button near the top left of the window and the match in the currently selected tab will be saved and the * will disappear from the tab name. The Save as button will always open a file save dialog for selecting the location and name of the file, while the Save button will only open the file dialog if there is not already a filename stored for this match.
  • The Open button can be used to load one or more saved matches to be viewed in the SEN:P-AI window. Once you have selected your file(s) and accepted the dialog, SEN:P-AI will load each match and add a tab for it. The tab text will be set to the name of the file (without any of the file path) and you can use any of the features listed above with it.

Autosaving and other Settings

SEN P-AI Screenshot5.jpg

Near the top of the window, to the far right is the Settings button, which will open the settings dialog. Changes to the settings will only be applied if you click OK.

  • At the top of the dialog is the file location of the Event Log File, which is currently disabled, so this setting does nothing.
  • Next is the Autosave Matches settings. You can choose to autosave At Match End and/or Every X seconds (if you're worried everything is going to crash and burn). In either case, the text box below specifies the name and location of the autosaved file (if it doesn't end in ".sen" that will be fixed when the file is saved).
  • Anywhere in the filename/path you can insert %HOME or %AWAY and it will be replaced with the name of the corresponding team (without slashes or other URI-incompatible characters). You can also use the time specifiers documented for the strftime function. This is also works for the log file.
  • The final option is the Match Update Interval which is how often SEN:P-AI pulls data from PES memory and processes it. Lower values mean higher stat/event recording accuracy while higher values mean less CPU usage. I feel that 100ms (10 times per second) is a good value for keeping CPU reasonable without sacrificing too much accuracy.

Using with Rigdio

(Work In Progress)

Development Feedback

You can browse the source code and report bugs here: https://github.com/Two-Scoops/SEN_P-AI

You can also contact me (User:Two_Scoops) wherever if you'd like to suggest something or report a bug and I'll add it to my continually growing list of things I might do.