r/javascript • u/joshbassett • Mar 07 '18
A game of Risk written in ES6 using React
https://risk.joshbassett.info/15
u/joshbassett Mar 07 '18
Thanks for all the feedback <3
I started this project around 4 years ago and have been slowly chipping away at it. It's nice that it's finally seeing the light of day and not just buried in my GitHub account.
I'm planning on writing a series of blog posts on how I actually built the game. There's some interesting tech in there for things like generating the maps, AI, handling UI interaction, etc.
3
u/jseego Mar 07 '18
Yes, would love to read those, thanks! Do you have a subscription list for that, b/c I would sign up for it.
3
3
18
6
4
u/jseego Mar 07 '18 edited Mar 07 '18
Yo, this is more "risk-like" than risk, but I actually enjoy it better than actual risk b/c no cards. Would be cool to add a "redeploy" phase before then end of a turn, though, so you didn't have to get stuck with armies stranded back in your own territory.
Very very cool, enjoyed playing it a lot!
Edit: it would also be cool to adjust the game so that the arrangement of the armies in the beginning is more balanced. I've noticed that the army that is lucky to be surrounded by neutral territories at the start of the game almost always wins.
Edit edit: it would also be cool if you're eliminated to get to watch the AI duke it out and see which of the armies wins after you're eliminated.
5
u/joshbassett Mar 07 '18
Thanks. It's actually based on an old iOS game called Strategery.
I originally had it so the remaining armies would duke it out, but turned it off because occasionally it would take a while due to low dice rolls, AI, etc. Maybe it's not such a bad idea to turn it back on?
2
u/jseego Mar 07 '18
As long as you provide a restart button / link, so it wouldn't get stuck, I think that would be cool.
7
u/dunder-throwaway Mar 07 '18 edited Mar 07 '18
This is great, very polished.
Couple of things:
I'm on a Chromebook (1366x768) and the top/bottom controls are cut off. I can scroll down to the End Turn button, but I needed to set the zoom level to 90% to see the top scores/buttons.
Is there a way to move armies from one of your regions to another of your regions? My armies at the front lines stay small with no way of bolstering them. :-(
Edit: I just realized that new armies seem to be distributed primarily along the front lines anyway, so my second point isn't really necessary.
1
u/joshbassett Mar 07 '18
Thanks. When I built it I didn't really consider small screens, but I'll see what I can do to fix it.
3
2
u/mart187 Mar 07 '18
Pretty cool game. Can you enhance it so that it works better on mobile? I would love a win % statistic and a give up button.
6
u/joshbassett Mar 07 '18
Thanks. I had no idea it even worked on mobile. I just figured it would be "too hard".
I'll see what I can do to make the experience a bit better.
1
u/chriscrowley Mar 07 '18
I just spent about an hour playing it on my phone. It's very addictive. The only bug I found was I should have been able to move to an open touching spot and it wouldn't let me. Thanks for open sourcing this!
2
6
1
1
u/mcdoh Mar 08 '18
Well done! I played a ton of Strategery but always felt it could benefit from the cards system from Risk since once one player gets ahead they just steamroll.
Any reason why you went with SVG? Did you test Canvas or WebGL?
2
u/joshbassett Mar 08 '18
I chose SVG to keep things simple and to be able to style everything with CSS. I wanted to make sure I could iterate on the design quickly, so being able to edit HTML, SVG, and CSS live in the browser made things much easier for me.
1
u/eslint-disable-line Mar 08 '18
Looks pretty cool. Some honest feedback. I wanted to try this out but I couldn't figure out how it works. Seems like others were able to so maybe it's just me. Maybe a simple link to a gist of how you play or (better...but more work) adding a modal with some instructions would help people better appreciate what you're working on.
1
u/joshbassett Mar 08 '18
Hey thanks for the feedback. You can click the question mark icon to show the How to Play modal.
1
u/eslint-disable-line Mar 08 '18
Ahhh, I see the issue. Again, I just offering feedback because I know what it's like :) Here's the issue, I'm on a 13" Macbook Pro and I'm loading this in Chrome and Firefox. You cannot see those icons. You can scroll up and down, whatever, the will be hidden above the content. There is no way to get them into frame other than to zoom out in the browser.
2
2
2
1
1
1
1
u/Birdy58033 Mar 07 '18
Plays alot like the flash game "dice wars". I can't tell if it follows all of the same rules.
1
1
u/druman54 Mar 07 '18
fun game. i get best results when i attack my neighbor on turn 1 -- you either kill them and almost always win the whole board, or know that the game is over.
1
1
u/TheEdgesOfThePoptart Mar 08 '18
I have no idea how to play Risk, but I had a blast playing that for 30 minutes. Good stuff!
1
Mar 08 '18
Really enjoyed the game. A little simplistic and wish the computer was harder BUT literally can't complain since I can't fathom how to do this yet
1
1
1
u/CantaloupeCamper Mar 08 '18
Oh man this is cool, certainly something I'll think about trying to do way ... way way way down the road just for my own project.
1
0
u/CrimsonDonutHole Mar 07 '18
Bro! Awesome! Any chance you are in LA and are looking for a job?
1
u/joshbassett Mar 07 '18
Cheers!
I actually live in Australia and I'm gainfully employed. Thanks for asking :)
31
u/joshbassett Mar 07 '18
There's a link to the code from the game, but here it is for anyone who missed it:
https://github.com/nullobject/risk