Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
1  
I think this issue will be experience until some "Cheat Engine for Linux" comes out. –  Luis Dec 27 '11 at 16:15
    
about six months later, is there any answer to this question (I'm not counting process priority as an answer... since it doesn't work anyway) ? –  Yanick Rochon Feb 18 '12 at 5:01

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer

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
share|improve this answer
    
Wouldn't this be actually the opposite of what he's asking? –  Uri Herrera Feb 24 '12 at 3:27
1  
I was answering the part about "games where you need to make them slower so you can complete a difficult level" –  laher Feb 24 '12 at 9:32

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 Winehttp://www.winehq.org/documentation.

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!!

share|improve this answer
    
You'd need the whole stack installed with WINE - a browser running in WINE (unless the game can run outside), Flash Player for Windows,and the Flash Speed hack (plus the SWF file obviously) As for GreaseMonkey - that won't work. JS and Flash are completely different technologies. –  Piskvor Mar 7 '12 at 10:59
    
Good call on them being totally different technologies, but I wasn't making that distinction,flash(indeed a proprietary plug-in) is showcased by being embedded in the DOM, and naturally one may for some things use those events with which javascript fully interfaces with as a means to an ends to influence flash, as at times flash is even embedded in javascript.Unless they've phased out w3/whatwg specs all page interaction,is a result of event-based execution. Event-based execution is the raison d'etre of javascript(ECMA in the old school days),FYI:80%+ greasemonkey scripts are cheats for games. –  William Franklin Mar 7 '12 at 11:50
    
You are correct on what JS is, where it came from and how it works; but unless the Flash blob actually exposes an interface to change the game speed (extremely unlikely), you just can't use JS for this - there is no "built-in" control for such interaction. I'm aware of the GM cheat scripts; note that all of them target the JS/DOM part, and/or interaction of Flash with JS - not the working of the Flash blob itself. –  Piskvor Mar 7 '12 at 11:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.