TLDR; Learning to hack JavaScript will develop the skill of automating using the browser dev tools console.
For the last 6 months or so, I have, on and off, been learning to code JavaScript. That process has mainly involved:
- writing some simple games
- hacking other games to see how they were written
I’m going back to the good old days when we could ‘break’ the ZX Spectrum game and view the source, or disassemble the games on the Atari ST and hook/hack them through debuggers and monitors.
To do all of that now, JavaScript and the Browser Dev tools are perfect companions.
Learn How to Hack Games
Download Farm Frenzy Game For Phone JAVA, Android. Come to the Game Farm Frenzy players will take on a character to leave the crowded urban hustle back home to manage his own farm, where you will become a real farmer participation activities chicken eggs to sell. You have to calculate how have they have the highest profit.
I watched Philip Hödtke’s talk from JS Unconf 2016 yesterday “Hacking Games and Why You Should Do It.” and added a few new techniques into my ‘cheating/hacking’ repertoire.
I encourage you to watch Philip’s talk.
After watching Philip at work I realised:
- I haven’t been using the find functionality in the source part of the browser dev tools
- I had an over-reliance on adding breakpoints and don’t need to
- I had not been using
setInterval
from the console
After watching I went off and tried the cookie clicker game that Philip demonstrates.
But I test things, why should I care?
Well:
- imagine that instead of having to use an automated tool to put the application into a certain state, or having to manually click around a do a lot of work.
- imagine that you could just write a few lines of code into the browser console and automate there.
- imagine that you could write a single line of code that would execute every second and ‘do stuff’ like click on a link, or close a dialog, or
But I’ll give some additional tips, some you might see in action in Philip’s video:
- pretty print the source
- use ‘find’ to search for classes and variable you find in the source
- if you type something into the console and it comes back with ‘function’ then you need to find where the class is instantiated in the code
- use ‘find’ to search for ‘new’ instantiations of the classes
- you can do a lot of exploration and manipulation with ‘for’ loops
- for bots you’ll need to use
setInterval
- I assign the result of
setInterval
to a bot e.g. ztypebot = setInterval(...)
so that I can shut the bot down later with a clearInterval(ztypebot)
- find some ‘quick hacks’ that you can use early in your investigation to give you more room to find a better hack e.g. when automating ztype I started with a bot that had infinite emps and triggered an emp every 2 seconds, and when that was working it gave me time to experiment with the objects and source to figure out how to make a bot that could shoot properly
- keep notes as you go about what you tried, and how you found the objects
- sometimes I start by working through the code and look for hints as Philip demonstrates
- sometimes I start by looking to see what code is triggered by the Event Listeners in the browser dev tools
- sometimes I breakpoint code that I think is interesting
- they key (and Philip demonstrates this well) is to find the big ‘namespace’ type objects as early as possible
And do make sure that you don’t submit any high scores after ‘cheating’ or ‘hacking’ in this way, it is most annoying to other people. A proxy tool can help avoid you accidentally sending a high score by blocking any high score submissions e.g. Fiddler’s auto-responder works well for this.
Testing Summary
When you hack/cheat at JavaScript games in this way, you are developing skills that will transfer to your testing:
- understand JavaScript
- learn how to use the browser dev tools
- interacting with a running application
- exploring the internal object state of an application
- putting a running application into a specific state for testing automatically
- writing very small amounts of code to automate an application state
If you find any good games to play with then let me know.
Related Notes:
- You can play Z-Type at http://zty.pe
- You can download/buy the music over at “The Phoboslab Works” bandcamp page
All Posts | Categories | Archive
Download Game Java Hack Online
You will need a Github account to comment. Or you can contact me with your comment.
Download Game Java Hack 320x240
I reserve the right to delete spam comments e.g. if your comment adds no value and its purpose is simply to create a backlink to another site offering training, or courses, etc.