News for hackers. Stuff that matters.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Saturday October 19, 2019 @02:42AM (#21297174)
Hi everyone! I wanted to learn Typescript and experiment with PWAs[1] so I decided to create these little games. In fact if you go to https://xojoc.pw/games2d/ in some mobile browsers you'll receive a prompt to install the games. They should work offline too.

You can find the code on my GitHub: https://github.com/xojoc/games2d

[1] https://developer.mozilla.org/en-US/docs/Web/Progressive_web...

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by matthewhartmans on Sunday October 20, 2019 @05:41PM (#21307357)
Mate, this is sick! Incredible job!

You should totally publish this to Google Play! (it's very little effort)

See the guide from Google https://developers.google.com/web/updates/2019/02/using-twa

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by saagarjha on Saturday October 19, 2019 @04:14AM (#21297433)
Unfortunately it looks like the game fails with an error in Safari if you eat food :(
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Saturday October 19, 2019 @06:56AM (#21297849)
Hi, unfortunately I cannot test on Safari. Could you send me a screenshot of the console/error? Thank you!
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by knubie on Saturday October 19, 2019 @11:37AM (#21299025)
Not OP, but this is the error I'm getting in Safari: https://imgur.com/a/bIHP8I5
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Saturday October 19, 2019 @01:42PM (#21299686)
Thank you! I opened an issue: https://github.com/xojoc/games2d/issues/10

I'll try to find out the problem.

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by eps on Saturday October 19, 2019 @04:38AM (#21297498)
I get 4 snakes, can control one, the rest remain stationary. It will then also show circle-food thingies that jump around, but always of a color that's not mine.

I suspect that's not how it is supposed to play, no? Using Mobile Safari.

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Saturday October 19, 2019 @07:00AM (#21297870)
Hi eps, you're supposed to control only one snake at a time. When the snake eats some food (i.e. the circles) the snake of the corresponding color starts to move.

Sorry for the confusion... btw, under the game there's a short description of the game.

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by zakki on Monday October 21, 2019 @07:44AM (#21311117)
I don’t see it worked like that. After eating a food no snake moves. I’m on mobile safari.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Monday October 21, 2019 @01:59PM (#21315250)
Ops, there's a bug with Safari: https://github.com/xojoc/games2d/issues/10

Sorry for the confusion!

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by pmx on Saturday October 19, 2019 @05:30AM (#21297624)
Yes, when you eat a food your control will jump to the snake of that colour.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by Jeff_Brown on Saturday October 19, 2019 @12:29PM (#21299264)
This makes me want to try a version where you control two snakes at once.

The steering interface is much harder than the traditional 4-direction version. (Not saying that's good or bad, just saying it.)

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by JamesSwift on Sunday October 20, 2019 @02:11PM (#21305891)
I wrote a simultaneous control version a long time ago (very naive game implementation, please forgive the code): https://github.com/J-Swift/clj-multi-snake

Its pretty difficult to play actually. I find the best method is to control one in a circle while capturing with the other.

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by Jeff_Brown on Sunday October 20, 2019 @04:45PM (#21307000)
Interesting. Now I"m wondering how to motivate someone to use both of them. Maybe two different kinds of food, specific to each snake?
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by JamesSwift on Sunday October 20, 2019 @10:28PM (#21308905)
It has that feature already : )

3/4 of the food are for either snake, 1/4 is for a particular snake.

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Saturday October 19, 2019 @01:40PM (#21299673)
It shouldn't be too hard... if you want to try, you can find the source here: https://github.com/xojoc/games2d

Yeah, the 2-direction version is a little different than usual, but I wanted to try something new.

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by bargle0 on Sunday October 20, 2019 @01:51PM (#21305739)
The snake game bundled with DOS 5 let you play with two snakes. It was very difficult to play solo. IIRC the intent was two players on the same keyboard.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by newnewpdro on Sunday October 20, 2019 @02:39PM (#21306114)
Neat little game, but the controls suck.

I think it'd be a lot easier to control the snake if you had the turning radius start wider and decrease over dozens of frames of constant turning before clamping to the tight one you currently use initially. That way the player could modulate turning a bit to maintain a larger turning radius, as well as make subtle corrections with small taps.

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by AGoogleEmployee on Friday October 18, 2019 @09:40PM (#21296301)
The game is lots of fun and a creative take on snake. The sound effect is very loud though. Cool work.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Saturday October 19, 2019 @02:40AM (#21297162)
Thank you! In the upper left corner you can lower the volume. I should probably make it lower by default.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by sc9311 on Sunday October 20, 2019 @01:27PM (#21305573)
I also was confused by the 4 snakes concept. I think perhaps it could have been solved by putting a different color food in front of the snake when the board is initialized. This way the "time to snake change" is reduced drastically.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Sunday October 20, 2019 @01:54PM (#21305759)
Hi sc9311, I like the idea, thanks!

(I opened an issue to track it: https://github.com/xojoc/games2d/issues/11)

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by PopeDotNinja on Sunday October 20, 2019 @10:26AM (#21304342)
I officially suck at this game, but it is pretty cool :-)
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by riffraff on Sunday October 20, 2019 @12:41PM (#21305226)
this is a great game, I only with it had less degrees of freedom (I.e. only 4/8 directions), it's super difficult to control while also thinking for me :)
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Sunday October 20, 2019 @01:59PM (#21305797)
Hi riffraff, 4 directions always felt "artificial" to me, maybe with 8 it could work!

Thank you for trying the game :)

Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by quickthrower2 on Saturday October 19, 2019 @04:27PM (#21300581)
Game halts on iPhone 6 safari in food eat.
Re:Show HN: 4snakes – a classic Snake game but with 4 snakes by xojoc on Sunday October 20, 2019 @02:10AM (#21302536)
Yeah, seems to be a problem with Phaser in Safari when playing a sound: https://github.com/xojoc/games2d/issues/10