Precision strikes in ShellShock Live!
ShellShock Live is a strategy multiplayer online artillery game on steam, similar to the childhood game of Bouncer. As we all know, this type of game has a realistic physics engine, so of course the trajectory of its hitting shells can be calculated.
🚢 Physical Modelling
The flight of a cannonball is a simple parabolic motion (without taking wind into account)
And the problem lies in finding the following parameters in the game
- Gravity Acceleration ()
- Correspondence between velocity () and force (0-100)
Regarding these two points, ilyaki explains them in great detail in a guide Perfect accuracy with CALCULATIONS (opens in a new tab) on steam, and calculates the parameters in the game by measuring the flight time of the shells and a number of other methods, and gives a final formula for them
where is the horizontal offset, is the vertical offset, is the launch angle, is the gravitational acceleration, and is a constant.
With this formula it is possible to give the strength that should be used given the launch angle by the coordinates of the start and end points.
⚙️Code
The code is mainly based on the GitHub project henrydatei/ShellShockLiveAimbot (opens in a new tab).
First calculate the strength using the formula above
# calculate velocity
def calcVelocity(x_diff, y_diff, angle):
# from https://steamcommunity.com/sharedfiles/filedetails/?id=1327582953
g = -379.106
q = 0.0518718
try:
v0 = -2 / (g * q) * math.sqrt((-g * x_diff * x_diff) / (
2 * math.cos(math.radians(angle)) *
math.cos(math.radians(angle)) * (
math.tan(math.radians(angle)) * x_diff - y_diff)))
except ZeroDivisionError:
v0 = 0
return v0
But the strength in the game, ranges from 0 to 100, so we have to find out the angle we can hit at
Here we calculate two angles, one is the minimum angle that can be hit, the other is the maximum angle (which is the maximum strength) to adapt to the changing environment (portal, rebound, etc.)
Take the minimum angle as an example
def calcOptimal(x_diff, y_diff, wind):
smallestVelocity = 100
bestAngle = 0
global velocity
global angle
for possibleAngle in range(1, 90):
try:
if wind == 0:
v0 = calcVelocity(x_diff, y_diff, possibleAngle)
else:
v0 = calcVelocityWithWind(x_diff, y_diff,
possibleAngle, wind)
if v0 < smallestVelocity:
smallestVelocity = v0
bestAngle = possibleAngle
except Exception as e:
pass
print("Smallest Velocity")
print("Velocity = " + str(smallestVelocity))
print("Angle = " + str(bestAngle))
velocity = smallestVelocity
angle = bestAngle
The final thing you need to do is to get the coordinates of you and the target, here you use the third party library pynput
def posPlayer(x, y, button, pressed):
if pressed:
print("Your position: " + str(x) + ", " + str(y))
global YourX
YourX = x
global YourY
YourY = y
return False
REEQUIREMENT:
- Python 3
- pynput
- pyautogui
RUNNING:
- open the game using Steam and run it using windowing
- run the script using
python shellshock.py
on the command line - enter the window width at the prompt (to adjust the acceleration of gravity in the programme)
- press p on the keyboard and use the mouse to click on your tank's position
- Press e with the keyboard and use the mouse to click on the target location.
- The command line will give you two popups for strength and angle, corresponding to the flattest and highest throws, and will automatically click on the high throw for you (not quite accurate enough to fine-tune it yourself)
Only tested on Windows. Not fully tested, but should work for MacOS/Linux. (You may face some problems caused by system permissions in macOS, especially when using pyautogui
.)
Download the full version code.
⚠️Notice
This is a technical cheat, but it is still cheating, so please do not use it in online mode. You can use it to hit your friends with precision for a surprise effect, or to target boss in single player mode.
©LI JiazeRSS