Post subject: TASing a HTML5 game (inside a browser)
magneticduck
He/Him
Joined: 6/20/2019
Posts: 2
Location: Portugal / New England
Choppy Orc is a short HTML5 game with a certain speedrunning intrigue. You can play the game for free in your JavaScript-enabled browser e.g. on Kongregate and watch the feats of human runners on the game's speedrun.com page: https://www.speedrun.com/Choppy_Orc/full_game I developed a TAS tool for the game and am in the intermittent process of polishing up a run. My approach was to inject some JavaScript to rebind critical API for scheduling the game loop and capturing inputs. With this foot in the door, I was able to implement a simple TAS environment and construct a run of the game level-by-level. My implementation of save-states is ad hoc; because I am not able to explicitly save the state of the game, I "reset" to a state within a level by having my tool replay the inputs made up to that point while running the game loop as quickly as the JavaScript interpreter cares to make possible. This has proved adequate since most levels do not exceed 10 seconds. I am looking for anyone interested in collaborating on this TAS, or for anyone interested in TASing some other interesting HTML5 game. In principle, my approach could work for many recent titles. I am also curious to know if anybody has published a TAS of a HTML5 game or investigated such a project before. Links Click "speedrun" and do nothing to watch the current version of the TAS play in your browser: http://mat.uc.pt/~mat1617/orc/TAS.html The timer at the bottom of the screen is my own addition. The "WR" field gives the best result by human runners on a particular level. Start the game, open the web console, and press 'r' to try out the TAS tool, which is inexplicably called "Instant Coffee": http://mat.uc.pt/~mat1617/orc/coffee.html Investigate and improve our work: https://docs.google.com/spreadsheets/d/1Xx64WBd3y3i1BCQN6TqErTFil2J1OVZpuoIU_TUbtgU/edit#gid=0 Use my tool for your own adventures: https://github.com/MagneticDuck/instant-coffee
Masterjun
He/Him
Site Developer, Skilled player (1987)
Joined: 10/12/2010
Posts: 1185
Location: Germany
TASing inside a browser, quite the interesting concept! I moved this thread into the laboratory because it fits perfectly in here. If you want to try it yourself, a way to easily open the console is Ctrl+Shift+J in Chrome and Ctrl+Shift+K in Firefox.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Joined: 9/12/2014
Posts: 540
Location: Waterford, MI
Very neat! I wonder if this will be a more simple project than libtas is. Ive ran windows 2000 in the browser before Runs slow though.
magneticduck
He/Him
Joined: 6/20/2019
Posts: 2
Location: Portugal / New England
InfamousKnight wrote:
Very neat! I wonder if this will be a more simple project than libtas is. Ive ran windows 2000 in the browser before Runs slow though.
Instant Coffee is, for the moment, not at all comparable to libTAS because it is not able to make explicit savestates. This is a big limitation; I have to rely on the game itself to give me points I can reset to and replay inputs from. Today I was able to make a cute run of a short HTML5 game called "The Last Balloon": https://vimeo.com/345468351 The TAS makes it look easy, but manipulating the balloon as precisely as is done here seems quite impossible to do by hand. Here's another cute, short run. The optimization isn't up to the standards of the usual TAS videos on this site, but it succeeds in making tricks that are totally impossible by hand look very easy. https://twitter.com/ChrisGadzinksi/status/1146391752649125888.
Skilled player (1738)
Joined: 9/17/2009
Posts: 4980
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
I recall there were talks about asm.js here: Thread #15929: TASing through a web browser with asm.js Would it be possible to use that to run games on browser, then this to TAS them?
MESHUGGAH
Other
Skilled player (1917)
Joined: 11/14/2009
Posts: 1353
Location: 𝔐𝔞𝔤𝑦𝔞𝔯
(Just uploading what I wrote on IRC a few days ago) Looks really nice! Some features could be added. - as magneticduck told, you can't just jump to a level. I was going to add that a while ago, but my workflow didn't need it.. - the loading function is probably this: window.load('bigassstring') - controls: X/Space + arrows
PhD in TASing 🎓 speedrun enthusiast ❤🚷🔥 white hat hacker ▓ black box tester ░ censorships and rules...
Joined: 3/25/2004
Posts: 459
I think a game like this, with levels as simple as these, and input options as simple as those, is or should be to have a TAS made for it which is provably optimal. Whereas, a game with exponential possibilities opening up in real-time with time constraits, that stresses computational power, exhibits real skill or expertise. A Starcraft 2 AI exhibits game intelligence better than intelligently designed TAS does. Can we generalize your game... Remove the graphics. Make it blind. No concept of orcs or axes. Or a 2D environment. Or enemies. Just. There is a state S which is transmitted via JSON. There is a legal set of inputs per each turn. The halt states or goal states are specified. Then a general AI may be able to beat or produce TASes for such games automatically, as they learn what the environment and physics and goals of the game actually are.
Joined: 3/25/2004
Posts: 459
Maybe also a JSON specification for the game, such that the game can be run to advance the state for any given input, to test outcomes, to apply algorithms or AI to... that can be tested in any language. If your game is coded in X, and I am a Y programmer, why do I have to learn whatever limited variety of programming languages available that your game has an API for... Am I described a binary? A "JSON binary". A generic way of transmitting a game "blind" to any programming language that has a JSON library. That the algorithm generic in terms of State and Inputs, can have algorithms or AI run against it, without the human ever knowing what kind of game it is or what it looks like.