One of my favorite things to do with these neat little games is to build something that plays them for me by just pasting stuff into the browser JS console.
https://pastebin.com/aTYuaNVS At a score of 1,619 the ball is moving so fast it no longer works! I switched to a new tab (hoping that the event loop would be sent to the background/context switch/whatever) and ta-da - it misclicked. High score of 1,637.
this is the reason that most FOSS games (especially browser games in JS) don't really do well with a leaderboard. Still a neat trick to mess around with!
Oh neat! You did the Harder version and didn't use the game's own code to check it. I find that with JS games it's better to imitate the game's exact logic and call it's functions to make sure the state is working/updates correctly.
Of course, for how delightfully simple this one is, your approach is definitely faster/better!
Definitely seems like alfon's solution is faster/better, as it's more accurate when the game speeds up. However, it's also more resource intensive! getBoundingClientRect (used to at least, long time I go I did browser performance stuff) forces a new layout calculation each time it's called, which is one of the most expensive things you can do in the DOM, and can lead to jank in the website. Some more information here: https://developers.google.com/web/fundamentals/performance/r...
Just adding this information for the ones who don't know and like to know more about browser performance :)
I haven't really tried. Most of the time I do this and use the actual game functions for autoclicker games like e.g. Cookie Clicker. It makes progression a lot simpler and I get to see the "fun" aspects of the game (like the super weird late game stuff) without actually breaking the fundamental game code. I like operating within the game's own code boundaries.
This effectively turns this game into a spinning animation that appears to get increasingly frustrated that whatever is being loaded hasn't completed yet
Code run in the console has the same restrictions as code on the page it is for so it's not really any riskier than clicking the post link in this case. For sites you have (or will have) a presence on (bank, HN, email, etc) it's a very risky idea though.
Basically the same in this case, as the setInterval is set with 10ms between firings, and requestAnimationFrame would (most likely, depending on computer/display) fire every ~16ms. It would be more efficient though, that's for sure, but most likely basically the same :)
I didn't peek and ended up with the same solution as you, so for an extra bit of fun I tried to golf it to be as short as possible. There's probably room for much improvement: (94 chars) setInterval("l=loopTapApp;b=l.getBallAngle();a=l.arc;b+6>a[0]&b-6<a[1]&&l.tap(new Event(1))")
One thing to note about this kind of endless runner games is the scoring system. Everyone uses the system "get as much points as possible in one run, each run starts from zero". But that forces people to slog through the early parts each time, and also makes them more likely to stop playing after an especially good run. I thought about this for a while, and came up with the idea that a better system would dock points for mistakes. The run would continue, a misclick would just give you a short breather and set you back fifty points or so. I made some prototypes like that and the effect was striking: you stick with one run for a long time, falling into a kind of meditative state, never wanting to stop. Eventually you find an equilibrium where wins and losses balance out, and keep playing there, at the best of your ability. If I ever release an endless runner again, it will use that system.
It took me a while to understand what was going on with your game. Once I got it it was fun, though!
For anyone else confused: the goal is to keep the light colored "snake" moving through the dark colored "tunnel". When the snake stops moving, it's because it's at a junction in the tunnel. You're goal is to tell the snake which direction to go (either left or right) _from its perspective_.
Wow, that's a great test of spatial reasoning (or something akin to spatial reasoning). You kind of have to rotate the shape in your brain to figure out which direction to turn from the line's perspective. I've driven with people who can't follow GPS directions unless it's in "first person" mode, e.g. if the line is moving "down" but then heads to the "right", you actually need to turn left, but they think you need to turn right or are just confused in general because the orientation is different - and I wonder if they could train their brain to work that way by playing something like this.
I really like your idea for solving the "endless runner problem." I guess the reason we haven't seen mobile games adopt this already is because each restart is an opportunity to show you an ad. :/
Not that I endorse it, but you could do some (or all) of the following to preserve the suggested system while still having everyone's favorite size of transactions:
- Ads after X failures - Spend Fun Points to avoid ads and prevent misclicks from subtracting your score - Fun points can be bought - or obtained by watching an ad - or obtained very rarely through regular play (e.g. by spending many Fun Coins) - Spend Fun Coins to customize your ball and background - Fun coins can be bought - or obtained by watching an ad - or obtained infrequently through regular play - Daily bonuses which scale with number of consecutive days logged in - Fun Points and/or Coins obtained by referring a friend et cetera
Aw nah, I hate it when people bootleg really good MODs and ruin th--
Oh. Oh ok. This is whatever the opposite of a bootleg is. It's something entirely new. So I think this might be my new favorite thing, if for no reason than that I honestly cannot think of anything as straightforwardly and equivalently awesome. Perhaps the Bad Apple stop-motion PV (https://youtu.be/240Vq6tIxio) is vaguely in the ballpark. Thanks. Now to close it so I don't wear it out. :D
Cool game! I can definitely see the Super Hexagon inspiration :) Took me a few tries to get the hang of it (you need to reason from the perspective of the line, not the screen).
I thought the same while playing this game. When I reached 200 points I wondered how the play experience would change if by losing I just lost 100 points or so.
Couple of recommendations, in no particular order: 1. Keep the ball moving even after you die. Instead of pressing start, the user will just click when the ball is back inside the colored area.
2. You can click anywhere to restart, but you have to click the play button to restart. You should allow the user to just click anywhere to restart.
3. When you fail, show where the ball was.
4. As for collision detection, I think you should err on being lenient and count success if the bounds of the circle overlap, rather than the center or entirely. I think this is also due to the rounded linecaps for the arc potentially not counting as part of the valid area.
5. Show where the next arc will be. This is more of a game design thing. If you do this, quick fade out of the old and fade in on the new would look nice. I understand that this was probably a small little one off project, and that there's always more you can iterate on, so I just want to say nice job in putting out a fun little time waster!
Comments (170) 84 threads
https://pastebin.com/aTYuaNVS
At a score of 1,619 the ball is moving so fast it no longer works! I switched to a new tab (hoping that the event loop would be sent to the background/context switch/whatever) and ta-da - it misclicked. High score of 1,637.
function intersectRect(rectA, rectB) { return !( rectB.left >= rectA.right || rectB.right <= rectA.left || rectB.top >= rectA.bottom || rectB.bottom <= rectA.top ); }
const arc = document.getElementById("arc"); const ball = document.getElementById("ball");
setInterval(() => { if (intersectRect(arc.getBoundingClientRect(), ball.getBoundingClientRect())) { window.dispatchEvent(new KeyboardEvent('keypress', { keyCode: 32, })); } }, 10);
My code seems to go on forever, closed the tab after it reached 60K
Of course, for how delightfully simple this one is, your approach is definitely faster/better!
Just adding this information for the ones who don't know and like to know more about browser performance :)
Continue this thread — 3 replies
Are you usually able to do this when e.g. it's more of a SPA and you have to drill down more to get to the state of some deeply nested component?
Also, in retrospect, I probably should have read the code before pasting it into my console.
Safari Version 15.2 (16612.3.6.1.8, 16612) macOS Big Sur 11.6.2 (20G314) iMac Pro 2017
I didn't peek and ended up with the same solution as you, so for an extra bit of fun I tried to golf it to be as short as possible. There's probably room for much improvement: (94 chars)
setInterval("l=loopTapApp;b=l.getBallAngle();a=l.arc;b+6>a[0]&b-6<a[1]&&l.tap(new Event(1))")
Continue this thread — 3 replies
Continue this thread — 4 more replies
One thing to note about this kind of endless runner games is the scoring system. Everyone uses the system "get as much points as possible in one run, each run starts from zero". But that forces people to slog through the early parts each time, and also makes them more likely to stop playing after an especially good run. I thought about this for a while, and came up with the idea that a better system would dock points for mistakes. The run would continue, a misclick would just give you a short breather and set you back fifty points or so.
I made some prototypes like that and the effect was striking: you stick with one run for a long time, falling into a kind of meditative state, never wanting to stop. Eventually you find an equilibrium where wins and losses balance out, and keep playing there, at the best of your ability. If I ever release an endless runner again, it will use that system.
For anyone else confused: the goal is to keep the light colored "snake" moving through the dark colored "tunnel". When the snake stops moving, it's because it's at a junction in the tunnel. You're goal is to tell the snake which direction to go (either left or right) _from its perspective_.
I really like your idea for solving the "endless runner problem." I guess the reason we haven't seen mobile games adopt this already is because each restart is an opportunity to show you an ad. :/
- Ads after X failures
- Spend Fun Points to avoid ads and prevent misclicks from subtracting your score
- Fun points can be bought
- or obtained by watching an ad
- or obtained very rarely through regular play (e.g. by spending many Fun Coins)
- Spend Fun Coins to customize your ball and background
- Fun coins can be bought
- or obtained by watching an ad
- or obtained infrequently through regular play
- Daily bonuses which scale with number of consecutive days logged in
- Fun Points and/or Coins obtained by referring a friend
et cetera
Oh.
Oh ok. This is whatever the opposite of a bootleg is. It's something entirely new.
So I think this might be my new favorite thing, if for no reason than that I honestly cannot think of anything as straightforwardly and equivalently awesome. Perhaps the Bad Apple stop-motion PV (https://youtu.be/240Vq6tIxio) is vaguely in the ballpark.
Thanks.
Now to close it so I don't wear it out. :D
Really sad the Android build appears to have fallen off the Play store :/
Couple of recommendations, in no particular order:
1. Keep the ball moving even after you die. Instead of pressing start, the user will just click when the ball is back inside the colored area. 2. You can click anywhere to restart, but you have to click the play button to restart. You should allow the user to just click anywhere to restart. 3. When you fail, show where the ball was. 4. As for collision detection, I think you should err on being lenient and count success if the bounds of the circle overlap, rather than the center or entirely. I think this is also due to the rounded linecaps for the arc potentially not counting as part of the valid area. 5. Show where the next arc will be. This is more of a game design thing. If you do this, quick fade out of the old and fade in on the new would look nice.
I understand that this was probably a small little one off project, and that there's always more you can iterate on, so I just want to say nice job in putting out a fun little time waster!
Continue this thread — 3 replies
Continue this thread — 2 replies
All comments shown.
Couldn't load more comments. Check your connection and try again.