"Untrusted" the game



  • Interesting browser game... of sorts.

    You control an ASCII character through one-screen puzzle levels. But the trick is, you can edit parts of the javascript code that's powering the game. For example, move elements of the map around or change the enemy AI or give yourself powers. Simple, but very interesting idea.

    (you can edit code with black background)

    A few levels were a bit clumsy, allowing you to finish them through brute force or luck. But for the most parts, they were pretty clever. I only needed a hint for the last one, but that one is basically made unfair intentionally.

    2 hours well spent.



  • I remember completing this a while ago, but it doesn't seem to have saved my progress. Shame.



  • How..... convevnient



  • I think I may have cheated a little.



  • [spoiler]What you're supposed to do there is create a fence for the drone to get caught in.[/spoiler]



  • Ha! Nice one. I went on doing what @riking said like a sucker.



  • Where's the fun in that?



  • Well, for one, that solution is awfully reusable.



  • The last level was very clever.

    <is it bad that my solution to the boss fight includes "Math.random = "?>



  • <spoiler]Nope, pretty sure I did that too. Math.random = function() { return 1; }[/spoiler]


  • 🚽 Regular

    @cartman82 said:

    Ha! Nice one. I went on doing what @riking said like a sucker.
    Really? I remember when I first played this level what I did was

    [spoiler]moveToward = function(obj, type){ obj.move('left'); };[/spoiler]

    And that was only because, much to my disappointment, this didn't work:

    [spoiler]moveToward = function(obj, type){ obj.killedBy(type); };[/spoiler]



  • player.win = true


  • 🚽 Regular

    Out of curiosity: in level 8 how many of you [spoiler]built a bridge over the river instead of doing anything with the raft[/spoiler]?

    Also, level 12, "It's a good thing that you're a AI expert".. Yeah right, how's this for artificial intelligence?



  • Wow, great solution there.



  • I finished all my AI levels by [spoiler]making the robot follow my character displaced by delta Y. So I would just walk around and lead it through the maze.[/spoiler].

    So, similar.



  • For level 13, [spoiler]I did a version of the "wall follower" algorithm:[/spoiler]
    [spoiler]

    1. If you can turn left, do it
    2. Else if you can go straight, do it
    3. Else if you can turn right, do it
    4. Else turn around
      [/spoiler]

    edited to add spoiler tags


  • 🚽 Regular

    I considered this, but I was way too lazy. My solution took less mental effort.

    I was disappointed that I couldn't manage to:

    a) [spoiler] make a downward force pushing the key through the barrier. The barrier was specifically passable only by robots;[/spoiler]
    b) [spoiler]make a robot factory that produced a robot right next to the key. The validation function prevented this and I took it as a challenge not to hack the level validation;[/spoiler]
    c) [spoiler]make a blue key vending machine. The giveItem() function, or whatever it was called, validated that the giver object actually had the item[/spoiler]

    Something else I considered doing was [spoiler]leaving a "stink trail" so the robot would still move randomly but favour moving away from places it already had been recently.[/spoiler]

    I stopped yesterday at the final boss. Alas, I had opened the site on an incognito tab, so my progress is gone and I'm not going through all the levels again.



  • @Zecc said:

    I stopped yesterday at the final boss. Alas, I had opened the site on an incognito tab, so my progress is gone and I'm not going through all the levels again.

    I am also not a fan of how easy it is to lose your progress - it would be nice if there were a url hash save-point system or something.

    The final boss level was my favorite. I managed to do it with very little code, but afterwards I found some youtube videos showing some really creative & fun solutions.


  • Banned

    I made my boss fight a classic top-down shooter - Q was firing single shot upwards. Was very fun until only few boss pieces remained and I noticed that if they encounter my bullet from side, they turn around as if it was a wall.



  • I like that - it would also be fun to try to invent the most Rube Goldbergian solution for each level.


  • Banned

    Also, about that forest level - were you supposed to set phone callback to regenerate the forest each time and move few tiles right each time, hoping the random number generator won't be too mean, or is there another solution?


  • FoxDev

    @Gaska said:

    Also, about that forest level - were you supposed to set phone callback to regenerate the forest each time and move few tiles right each time, hoping the random number generator won't be too mean, or is there another solution?

    that's about the only one i came up with that isn't about 300 lines of code.



  • That's what I did too.



  • @riking said:

    I remember completing this a while ago, but it doesn't seem to have saved my progress.

    @xaade said:

    player.win = true

    @Zecc said:

    Alas, I had opened the site on an incognito tab, so my progress is gone and I'm not going through all the levels again.

    If you want to have access to all the levels, and don't mind being a big cheating cheatery cheaterson, you can [spoiler]run localStorage.levelReached = 22 in Chrome's console, then reload the page.[/spoiler]


  • FoxDev

    of you could just do the levels again. there's always more than one way to solve the puzzle and you could try finding different ones!


  • ♿ (Parody)

    @monkeyArms said:

    If you want to have access to all the levels, and don't mind being a big cheating cheatery cheaterson,

    Isn't that the whole point of the game?


  • FoxDev

    yes, but a CREATIVE one. 😃



  • I started playing and then abandoned this game some time ago for mysterious reasons.
    I'll give it another go and will edit this post once I beat it.

    If this post remains unedited after a while, it means I was too stupid to beat it (mysterious!) and you can point and laugh.

    EDIT: Beaten the game. And then I tried [spoiler]doing the bonus levels[/spoiler] and my saves disappeared some time after that. I'm not sure why and I don't care to find out.


    Secret edit - I cannot believe how much trouble I had on level 10 last time - it is so trivial...


  • Java Dev

    I solved level 12 in a less cheaty way: https://gist.github.com/22299e3cbfac321cc864



  • I'm just being reminded of how much I hate Javascript(-like languages) - who thought it was a good idea to ignore extra arguments to a function by default?


  • Java Dev

    [spoiler]Let's summon some bridges[/spoiler] for level 18!


  • Java Dev

    Some of these puzzles are awfully easy if you realize that although the validator checks you didn't add blocks, it won't notice if you define your own block type...



  • End-game spoilers:
    [spoiler]The code for validating user input is simply dreadful. Complete black-list city.
    No wonder I was able to cheese the boss level (with the bullets) by doing "Math.random = function () { return 1; }" (This was not undone on execute or reset, either!)
    Plus, I was able to even more easily hang the game by doing "Math = null;". (Once again, this modifies the game's JS permanently and refresh of the page is needed.)
    [/spoiler]


  • Banned

    You can reassign standard library objects in JavaScript? That's horrible.



  • You can do whatever the fuck you want to. It's JavaScript.



  • @Gaska said:

    You can reassign standard library objects in JavaScript? That's horrible.

    Looking through some of the Untrusted source code, I noticed window.eval = {};, probably to prevent certain cheats. More libraries should do this 😃



  • @ben_lubar said:

    You can do whatever the fuck you want to. It's JavaScript.

    ...except window = null - the ultimate in xss prevention.



  • How could you possibly prevent people from cheating in a game like this? Seems like the author decided it's useless to even try and gave up halfway through.

    That said, I am perfectly fine with pretending the game's code and globals can't be changed, and trying to play fairly.


  • Banned

    I've just got an idea for a game - an FPS where player has "I can see the code" powers - he can look into scripts behind every in-game item and enemy, and can edit his own script by adding key bindings to arbitrary functions. Various books in the game scattered around world will describe API.

    How many of you would play that?



  • @cartman82 said:

    How could you possibly prevent people from cheating in a game like this? Seems like the author decided it's useless to even try and gave up halfway through.

    The first level said the 'computer' used a Javascript-like language. I initially assumed that it was a language written to work more or less like javascript (with algorithms and stuff being redirected to actual JS functions) but with a very limited amount of global variables and functions you could access.

    The language could even be a highly simplified version of javascript without some of the nooks and oddities that were never explored by the game anyway. Such a language would not be all that hard to write, but of course still much harder than the black list party solution the author actually came up with.

    (It would mostly be just a parser (likely taken from library) plus a bunch of simple AST validators and transformers, and finally a writer that converts the AST to real javascript (possibly also provided by same library)).
    E.g. you could then easily redirect any member access or indexing to a (JS) function that checks that the access is allowed before doing it. (Aka - whitelist)

    Alternatively, can you create a sandbox in Javascript (e.g. via some library)?. If so, then he would have a much better solution for possibly less effort than the current black-list rave solution.



  • Something like that would prevent "cheating" from the in-game code window, but wouldn't stop console hacking.

    Web games that run client side will always be vulnerable - it's up to the player to do whatever brings them the most enjoyment from the game.


  • Banned

    Preventing hacking this game would be like taking away cheat codes in GTA.



  • @monkeyArms said:

    Web games that run client side will always be vulnerable - it's up to the player to do whatever brings them the most enjoyment from the game.

    Something like that would prevent "cheating" from the in-game code window, but wouldn't stop console hacking.

    Of course, but it's not relevant to my point:

    If you're hacking this game via the console, you're obviously cheating.
    If you're exploiting the game's mechanics (e.g. in-game code editor) to perform acts the developer didn't intend you to, you're still cheating.
    If you're using the game's mechanics as designed, it's not cheating.

    Even if the game mechanics involve acts that would be considered cheating in other games, you are capable of distinguishing those from actual cheating in this game, right?

    Now if you're accidentally exploiting the game's mechanics to do things the developer didn't intend (as I did with 'Math.random = <...>'), you're still cheating, but the blame goes to the developer who didn't implement his mechanics well enough (e.g. used a dumb black list and regular expressions instead of something smarter).

    It's not a big deal, but I would've preferred if the game did prevent accidental cheating.

    The only point left to make is that while often it's hard to tell what is cheating because it is hard to tell what the developer intended, in this case I think it's pretty obvious (especially after you [spoiler]read the game's code[/spoiler]) that doing stuff like 'Math = null' was not intentional and that the developer did his best to avoid it.

    And, of course, there's nothing wrong with cheating in single-player games. I shouldn't need to mention that, but I know I do.

    Wow. That's a lot more words than this deserves.
    Instead of reading the above, why not just read my previous post, think a bit, and agree with it instead?


  • Java Dev

    I agree.

    I think there's a nice concept here, but if someone were to extend it to a longer game, it needs a sandbox or similar, with much better control of what your code can affect.


  • Banned

    @CreatedToDislikeThis said:

    If you're exploiting the game's mechanics (e.g. in-game code editor) to perform acts the developer didn't intend you to, you're still cheating.

    How do you know if developers intended or not to make you able to sell stuff higher than you bought it in Morrowind, given high enough mercantile skill?



  • @Gaska said:

    How do you know if developers intended or not to make you able to sell stuff higher than you bought it in Morrowind, given high enough mercantile skill?

    I don't. The fact that I never played Morrowind doesn't help, either.

    This is consistent with what I said - that it's often hard to tell what the developer's intent was.
    This is probably the game where it's easiest to do this because of the [spoiler]source code access[/spoiler].

    Even in this game, you could probably argue endlessly (but not necessarily sensibly) about whether this or that was intentional - I'll do my best to stay out of any such arguments, though.
    I hope I succeed.



  • @CreatedToDislikeThis said:

    Of course, but it's not relevant to my point

    Reread your post, including the quote you replied to. Your point was in reply to the topic of preventing "cheating" - why would I assume your point addressed an issue other than what you replied to?

    But whatever - not worth arguing about 😄



  • @cartman82 said:

    That said, I am perfectly fine with pretending the game's code and globals can't be changed, and trying to play fairly.

    I agree. I get much less enjoyment out of (almost) any game playing outside of the "rules". I had a lot of fun getting to the last level "fairly" (it took me longer than you to get through it - probably 5 hours).


  • 🚽 Regular

    There is another solution to all the "get to the exit" levels.

    [spoiler]Although undocumented, teleporters are available since the very first level.[/spoiler]



  • Thanks for posting this, @cartman82! Fun game...

    For the level 13 robot maze, I used the [spoiler]phone callback to cycle the player thru a set of four colors. The robot translates the player color to a direction. So hit Q to set color/direction, then R to move in that direction until time for a new direction.[/spoiler]

    Not the slickest solution, but wtf, and it was adaptable for the laser level.

    @monkeyArms, I like how your boss kill got them all at once... Mine used [spoiler]map.overrideKey() to fire a couple horizontal missiles from the left when left-arrow was pressed.[/spoiler]


Log in to reply