M HYPE SPLASH
// news

Modifying the speed at which a process runs ( Cheat Engine alternative as a Flash Game Speed Hack)

By John Campbell

In Windows, there is a tool for Flash games called Cheat Engine which can speed up/down a process by X amount, making the time needed for a task in a game to go faster or slower than in the real world. This is specially helpful for time based games that make you wait for an X amount of time for a building to get finished, a harvest to get completed, etc... This also applies to games that you need them to go slower so you can defend against several enemies (Zombie games, etc..) or games that their difficulty lies in how fast one can complete something.

But this is not limited to web based Flash games. Cheat Engine can also speed up/down other games (Half-Life, Quake 3, etc..).

Is there a way to do this in Ubuntu?

Here is SPEED HACK option I am referring to by using the "Cheat Engine" tool in Windows and it is actually the option that 99.99% of Cheat Engine users use Cheat Engine for:

enter image description here

I should mention that I am not looking for a method to pause the process every milliseconds (Like slowing down Firefox or Chrome instead of slowing down the Flash game). For example slowing down Firefox would not work since it also slows down everything else so it would not be a Speed hack so much as slowing down the process in general including all actions by the user. Basically everything would be the same, just slower. The same goes for speeding the process up.

I am looking for a way to do this to Web Based Flash games and/or Wine emulated Games.

3

4 Answers

Short answer, no. There's no 2x button for process scheduling. Best you can do is use cgroups for what you're interested in to get more CPU time, at the expense of another process. If I had to guess, the reason speedhack even works is because it's doing it's business by manipulating the flash runtime, or just call it a virtual machine. It's not that it's speeding up the program, it's changed fundamental parameters the whole VM is based on. I suppose the same thing would be possible with something like Java or Python.

Oh well, I guess you'll have to continue cheating on farmville on Windows. Shame.

These might help with slowing processes down, but not speeding them up...

1) SIGSTOP and SIGCONT:

The kill command can issue a STOP and a CONT signals to a process with a given pid. I've used it for 'pausing' and 'throttling' python scripts before, and it works fine for that purpose.

Here's an example in a bash script (pass in the PID of the relevant process as the commandline parameter):

PID=$1
while true; do sleep 0.5 kill -s STOP $PID sleep 0.5 kill -s CONT $PID
done

Those sleeps (in seconds) would need to go down to a much smaller amount to reduce jerkiness, but the bigger interval makes it more obvious for testing.

Once your happy with a particular interval, you could make the ratio of sleeps adjustable with a variable.

2) One other possibility, for throttling, is 'cpulimit':

sudo apt-get install cpulimit

To limit firefox to 30% CPU:

cpulimit -e firefox -l 30
2

I would suggest a couple of things. If it is indeed farmville/something played on the net(as ppetraki suggested), I believe that one avenue is to go via greasemonkey route(it is a platform to allow running of all javascript-based scripts to allow more advanced tweaking on all levels of the browser/page-rendering.). No less, it I read over all other answers very quickly, and surprisingly didn't see anyone mention Wine.

More specifically, if normal wine doesn't work(which I was able to get it to work, best off trying 32-bit), all hope is not lost, as this sounds like a perfect candidate for the Wine extension/add-on'esque program, 'Wine-Hacks,' it prompts the user with a walk-through for installing various pieces of software that meet particular requirements/etc...(this is a very easy avenue, if traditional wine configuration doesn't work). This is an interesting predicament, and its important to remember that linux in general gives the user a far greater platform to customize, and tweak the various processes/threads/etc on all levels... However, a large amount of reading typically comes from it. On a lower-level perspective one could, if the game is utilizing interprocess communication, tweak the speeds on the sockets('vmstat'/'top'/'ps'/'ss' commands are but a small arsenal of what linux offers) themselves, and although it will not have as small a learning curve/ease of use, but these tools are a start for analyzing process-level activity/memory-mgmt.

But looking up at your image, and having downloaded the app myself, gaining an understanding as to how the application works, and the fact it's reading bits of memory, and scanning memory addresses/etc... it eludes it is very doing just this, tweaking the memory/interprocess communication on a low-level(however going this route you'd be creating your own hackish-version of the 'Cheat-Engine' it could very easily be done with a gdb(gcc-debugger, a developer/security tool as doing these types of tasks are a common part of a developer's job to better gauge how the application works/its overall performance., acts similarly in a more limited scope). You'd just be using a different tool to control the memory/sequencing of socket-level communication. No less, the Wine-scenario will work, and I tried it briefly(however, I don't know what the targeted game your playing is, lol!!).

To conclude, so that we're clear, one way would to re-nice the processes/process threads(tasks) in Linux/and locating the various memory addresses, and bits used in the interprocess/socket communication using utilities/or debugger(already mentioned). Then another more basic way that would utilize the logic of the 'Cheat-engine,' itself in a non-Windows environment, through installing it with Wine, as Wine runs the application, and manages it in processes/threads within so it is as if the program is being ran in Windows itself. The Wine program is in all Ubuntu-specific distros I have seen, "'apt-get'/'aptitude'" it to install Wine). Additionally, another tool for debugging/tweaking flash-based games/etc... is that of Flashbug(a firebug variant, just as Greasemonkey is used in Mozilla)Good luck & cheers!!

3

I realise this is an old question, but I've found a tool that can change the speed programs run at, at least in theory. A lot of stuff seems to either be unaffected or gets its frame rate changed but not the actual game speed. Anyway, here it is:

Unless you notice the repository has been updated more recently than 2017, to build on Ubuntu 20.04 you will need to:

  1. Change line 140 to static int (*gettimeofday_orig)(timeval *tv, void *tz);
  2. Change line 222 to extern "C" int gettimeofday(timeval *tv, void *tz)
  3. Do sudo apt install libc6-dev
  4. Do make 64bit from the project's root
  5. Run your game with it (e.g. ./speedhack glxgears)
  6. Control its speed via /tmp/speedhack_pipe (e.g. echo 0.5 > /tmp/speedhack_pipe)

If 22.04 breaks it again, check the issues page.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy