2025-01-30 02:21:04 -06:00
2025-01-30 02:02:47 -06:00
2025-01-30 14:49:39 -06:00
2025-01-30 14:00:52 -06:00

autopon

A python script to automatically drum commands for Patapon games

Overview

Autopon is a python script that automatically issues commands to your troops by specifying a sequence of inputs. It uses high-resolution perf timers to ensure it stays on-beat. It avoids a common footgun of other macro solutions in that I've already done the headache work of figuring out that Patapon is slightly slower than the 120BPM everybody says it is.

This script's purpose is primarily to aid in grinding, mostly for Patapon 3 class skills but potentially (or eventually) other things as well, like material/hunting missions, experience grinding, etc.

Requirements

  1. ydotool must be installed, in $PATH, and its socket configured appropriately. If necessary, specify the envvar YDOTOOL_SOCKET per ydotool(1)

  2. PPSSPP must be installed and running the game (obviously)

  3. Bindings for PPSSPP must be their default: SQUARE on A, TRIANGLE on S, CIRCLE on X, and CROSS on Z

  4. PPSSPP must have focus while the script runs

Usage

Invocation

See ./autopon.py -h for a full list of usage options.

The short invocation is like so:

./autopon.py L-L-L-R-

Autopon will then prompt you to hit Enter on a drumbeat, after which you have 1 measure to change focus to the game. You'll need to tune the startup delay as well.

Exiting

Tab over to your terminal on a rest measure and give it Ctrl+C. Additionally, Autopon will exit if it hits 0 remaining iterations: see Iterations/Repeating.

Iterations/Repeating

By default, Autopon will repeat a sequence 10,000 times, which is enough for about 11 hours of nonstop usage for a single command. If you would like to increase or decrease this value, use the --iterations flag.

Song Encoding

Songs are encoded as a sequence of characters where each character corresponds to an eighth note. The script will automatically provide a full measure of rest at the start of invocation and between every command, keeping up with the call-and-response syntax of Patapon's commands:

An example sequence of "March of Mobility" looks like this:

L-L-L-R-

Which will be automatically processed by the program into this looping sequence:

--------L-L-L-R-

The letters for each drum correspond to their cardinal direction on the face of a PlayStation controller:

Drum Character
Pata L
Pon R
Don D
Chaka U
Rest -

Thus "Aria of Attack" would be "R-R-L-R-", and "Song of Miracles" would be "D-DD-DD-".

Several commands can be chained in sequence to, for example, automate charge-attacking:

./autopon.py R-R-U-U- R-R-L-R-
[...]
Song sequence: --------R-R-U-U---------R-R-L-R-

All default Patapon 1/2/3 command songs are supported. Freestyling is currently prohibited, so using this program to summon Djinns in Patapon 1/2 or power one up in 3 is currently impossible.

Tuning

Several components of this program are timing sensitive.

Game BPM

As it turns out, Patapon (all of them) doesn't actually run at a round 120BPM. Instead, The actual observed BPM is 119.880BPM, and the program is hardcoded to only issue commands at this cadence. This value was refined through testing and ultimately picked by beating up the door at Castle of Justice for over 4 hours and measuring observed deviation, which was zero. There may still be an unknown figure, but 6 digits of precision is enough for most purposes.

DO NOT change the Game BPM if you are running the game at double-speed. To that end, use the --bpm argument to add a multiplier.

Startup Delay

The striking rhythm, while consistent, has some level of processing overhead due to needing to call out to an extra binary. Thus there will be a consistent, unavoidable delay between the rhythm that the script keeps and the rhythm observed by the game. In order to sync these two rhythms up, a startup delay will need to be tuned, for which Autopon provides a mechanism.

The startup delay can be tuned by passing the --startup-delay parameter. Adjust this value by gutfeel until hitting Enter when prompted to sync the game up nails a perfect measure.

Key Delay

The default value is such that you're unlikely to need to tune it, but if you need to, you can adjust how long a key is held by specifying --key-delay. Adjust this value if your game drops inputs -- Patapon is typically picky about anything under 50ms. Values too high may result in mistimed inputs.

Glossary

Term Definition
command [song] A four-drum sequence that corresponds to a directive for the Patapon army. For a list of all command songs in the games, see here.
drum One of four face buttons on the PlayStation controller. The act of hitting a drum is often called "striking" it.
sequence A sequence of eighth-note characters that is specified by the user and later decoded by this program to determine what drums to hit. Is intended to represent, but is not necessarily, a command song.

TODO

Features I'd like to add:

  • Specifying a separate set of setup commands, so you could gain fever, charge-defend, and then defend forever to continue a hero mode or something

  • Set up pre-defined sequences for common tasks, like running P3's defense minigame

  • Creating a table of Djinn minigame answers for Patapon 1/2 and letting the user drop them in easily after a Djinn command

  • Automatic return-to-hideout, re-run functionality for Patapon 3

  • Figure out how the fuck I'm supposed to do Patapon 3's Djinn and its faster BPM on-the-fly (the answer is probably "don't")

Description
No description provided
Readme 78 KiB
Languages
Python 100%