13 ms·
JavaScript Cold War simulation
- anti-shill 11y agothe only winning move is .....
- evilotto 11y agoTo play, perfectly, waiting for your opponent to make a mistake. (https://xkcd.com/832/ https://xkcd.com/832/)
- ricree 11y agoAlternately, watch SMBC's more explicit version https://www.youtube.com/watch?v=TFCOapq3uYY https://www.youtube.com/watch?v=TFCOapq3uYY
- simonswain 11y agoIt's not whether you win or lose. It's how you play the game.
- lifeformed 11y agoI love the dual side/top view setup.
- gruez 11y agoCan you give an explanation about what each type of unit does?
- simonswain 11y agoThere are two views, top view and elevation view. All the actors have an x, y and z. Each of the circle structures is a nation state. It has a capital at the center (square, blinking). Defcon is the number in the capital. Cities (circles) send people to work at factories. Factories (triangles) make munitions and send them to bases Bases (square) stockpile munitions (counts, clockwise from top right: icbms, abms (anti ballistic missiles), fighters and bombers. Bombers are big and slow (triangles) that select a target (factory, base, city, capital in that order), fly to it and nuke it, reselecting a target if somebody else destroys it first. As defence perimeters are penetrated, defcon gets more scary. Fighters launch at Defcon 4 and attempt to destroy bombers. At Defcon 3, Bases launch ICBMs a low probability amount of the time. Satellites launch at Defcon 2, and can shoot ICBMs out of the sky, but have fire/recharge lasers. When one of a nation's assets (factory, base, city) is nuked, they go to Defcon 1. If your enemy goes to Defcon 1, so do you. At Defcon 1, all ICBMs will fire. When your capital is destroyed, it's Game Over. The control panel lets you tweak the starting parameters. There are a lot more controls for all the actors (e.g, how close do bombers flock.) than are not exposed here.
- cshimmin 11y agoSeems like: - circle: city - triangle: factory - square: military base - big plane: bomber - little plane: fighter - things with rocket trails: ICBMs - floaty diamond things: satellites (which shoot down ICBMs) The square in the middle of each team represents the current defcon. Assuming you start at defcon 5, when an enemy unit crosses the big blinking circle, drop to defcon 4. When a unit crosses the next blinking circle, drop to defcon 3. I haven't figured out yet how the escalation proceeds after that.
- simonswain 11y agoBang on. The dust coming up out of the bases (and to a limited amount, the other assets) are ABMs, trying to take out incoming ICBMs. Goes to Defcon 2 on enemy bombers reaching city limits (the radius Cities and Bases are at).
- tantalor 11y agoFactories are triangles. Cities are circles. Bases are squares. In the center is a more different square with the defcon. Cities are required to supply factories. Factories are required to make new units. Bases are required to launch units. Fighters target bombers and fighters. Satellites target ICBMs. Bombers and ICBMs target factories, cities, bases, and defcon. Bombers target in that order; ICBMs seem to target randomly. Game over when defcon is destroyed. Launching an ICBM requires defcon <= 3. The choice to launch is a bit random at defcon 3 and 2 but they all launch at defcon = 1. Defcon changes to 4, 3, 2, and 1 if a bombers crosses the circular boundaries (radar?) around the center. You can see this happen when the boundary flashes.
- apaprocki 11y agoThis was a presentation at JSConf US 2 weeks ago. I'm sure everyone will enjoy it much more with the video once it winds up online.
- frutiger 11y agoIt wss a fun talk. My only regret is that Simon didn't use an [apropos quote](http://www.imdb.com/title/tt0086567/quotes?item=qt0453844 http://www.imdb.com/title/tt0086567/quotes?item=qt0453844) during the talk.
- simonswain 11y agoThe BBS login at the start of the talk said: "Greetings, Simon".
- masswerk 11y agoFor "authorized" advice, see https://www.youtube.com/watch?v=q2v0YuDatpc https://www.youtube.com/watch?v=q2v0YuDatpc (Declassified USAF training material, 1958), alternate source: https://archive.org/details/AirForceSpecialFilmProject416powerOfDecision https://archive.org/details/AirForceSpecialFilmProject416pow... (Amazing actors' performance included.)
- simonswain 11y agoSAGE is the inspiration for this... https://www.youtube.com/results?search_query=sage+computer https://www.youtube.com/results?search_query=sage+computer This thing was off the hook...
- masswerk 11y agoI once included this video in something similar (also relating to SAGE) as the help option, see this easter-egg: http://www.masswerk.at/google60/?q=list%20games http://www.masswerk.at/google60/?q=list%20games (option 4) (Edit: Similar just intention-wise, else much simpler, since just in ASCII, meant to be EBCDIC.) BTW: "System Technology" (SDC, 1960) is also an impressive source in this context: https://www.youtube.com/watch?v=Yqu3YX2cLA8 https://www.youtube.com/watch?v=Yqu3YX2cLA8
- simonswain 11y agoNice Easter Egg!
- masswerk 11y agoOn "System Technology": See esp. at 17:00, ca., this is very similar to the view conveyed by your rendition (note the swarming aircrafts).
- simonswain 11y agoThis video is great... and so dark. This stuff was for real.
- akama 11y agoThe author also worked on a deep space simulator [1] which has been on hacker news [2] before. Another very interesting simulation. [1] (https://github.com/simonswain/deepspace https://github.com/simonswain/deepspace) [2] (https://news.ycombinator.com/item?id=8837204 https://news.ycombinator.com/item?id=8837204)
- officer_gotcha 11y agoThe premise is quite broken. The cold war was 'cold' because the conflicts were small and localized. Two sides exchanging ICBMs would be a global thermonuKular war, not a cold one.
- beefsack 11y agoThis is a hot war simulation, is it not?
- simonswain 11y agoTechnically, yes. It's meant to escalate from cold to hot as munitions stockpiles build. But that doesn't make for a very interesting presentation, so it goes direct to Hot.
- larrydag 11y agoI think WWIII sim is probably a better description. Or could go with the 1985 War Games "Global Thermonuclear War". Just nitpicking. The simulation is awesome.
- vacri 11y agoI was thinking the same thing. I was expecting the initial flurry of planes to skirt the opponent's airspace, provoking but not violating :)
- MDCore 11y agoIf you want a cold war simulation, try it with JavaScript turned off.
- zatkin 11y ago>Doing heavy lifting with JavaScript in IE8 is just not fun. Please force your customers to upgrade their browser. You'll do the better good for yourself, your customers, and mankind in general. :)
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- lotusko 11y agoneed more visual
- ForFreedom 11y ago@simonswain - You should avoid the bright flashes when the game is over, some people might have health issues.
- vacri 11y agoMeh, the flashing-lights-in-games thing is waaaaaay overrated as a public health concern. Most photosensitive (=~'flashing light') epileptics require flashes in the range of ~8-18 Hz (mostly in 12-16 Hz), and even then it almost always takes some time to build up, and even then it's a fraction of epileptics that are susceptable. And flashing lights by themselves don't make non-photosensitive epileptics have seizures (or non-eplieptics). Only about 15% of people epilepsy with are photosensitive. A photosensitive epileptic will know to look away if they see their kind of triggering flash. By the time you narrow it down to the mere handful of epileptics that will have a seizure from one or two flashes (ever hear anyone complain of a single camera flash and epileptics?), you're in a very rare group. At which point, nothing is safe - I heard of one epileptic who had seizures due to orange circles. Other colour circles were fine, other orange shapes were fine, it was just orange circles (which mean no driving...). Another patient had seizures when ice touched their lips. They do exist, of course, but at that point you're optimising for an incredibly rare user. If you're going to optimise for that, there's plenty of usability optimisations that hit way more people that you should be doing first :) Source: spent four years doing several EEGs on neuro patients per day, each of which had a 5-minute session with a strobe light at various frequencies. Most of those patients were there for epilepsy or suspicion of epilepsy, but not all, of course. Seeing a photosensitive response at 8Hz was uncommon, but not rare. Some people had some response to single flashes (well, 1Hz) but it never built up to a dangerous level - I never saw someone in danger of having a seizure from 1Hz flashes. /rant (sorry, nothing personal, I just keep seeing this (largely) urban myth)
- pjmlp 11y ago> I just keep seeing this (largely) urban myth) It is reinforced by those warnings in all games.
- 11y ago
- eclipxe 11y agoI spent an hour playing with this - very enjoyable! Would love an iOS app with something similar. Recommendations?
- hopfog 11y agoThe creator held a talk about simulations at JSConf.Asia 2014. Highly recommended: https://www.youtube.com/watch?v=0HJPilemNns https://www.youtube.com/watch?v=0HJPilemNns
- artmageddon 11y agoReminds me a lot of the game Defcon. I love it!
- cyorir 11y agoReminds me of Missile Command
- zachrose 11y agoYikes! Is this realistic? There seems to be a doctrine that ICBMs will only be launched upon receiving a complete nuclear strike, and once that happens it's pretty much game over. This makes fighter jets a critical buffer because the only way a defense can prevent mutually assured destruction is to prevent non-ICBM first strikes.
- simonswain 11y agoAt Defcon 3, Bases launch ICBMs a low probability amount of the time. When one of a nation's assets (factory, base, city), they go to Defcon 1. If your enemy goes to Defcon 1, so do you. At Defcon 1, all ICBMs will fire. Bases are limited to how many the can have in the air at a given time. Not realistic really, but never let the truth get in the way of a good yarn...
- smacktoward 11y agoIf you're looking for realism in your apocalyptic nightmare scenarios, there's an ooooold DOS game called Bravo Romeo Delta you should track down. I wrote a little bit about it here: http://jasonlefkowitz.net/2014/11/choreographing-armageddon-bravo-romeo-delta/ http://jasonlefkowitz.net/2014/11/choreographing-armageddon-... It's fallen into abandonware hell, so you can't buy a copy at GOG or anything like that, but cough I'm sure you could find a copy if you looked on the right sites.
- simonswain 11y agoThis is awesome... so much detail.
- eterm 11y agoTry putting satalites up to '3', it's almost impossible for an ICBM to get through. Eventually just one did, but then even the volleys get stomped by the satalites. This game has been running for over 10 minutes at DEFCON 1 for me, the blueside managed to get the first city down but it's now a city each but yellow also lost 2 of their triangles (bases? factories?).
- janci 11y agoJoshua, is that you?
- romanovcode 11y agoEvery time the same team wins over and over again, when I change some values other team keeps winning all the time.
- Already__Taken 11y agoSlight bug, If there's any bombers on the field at all the other sides fighters won't shoot any fighters. If side A has fighters on side B. A has a bomber just launched. B fighters just try to fly at the bomber, dieing to the B fighters.
- dspillett 11y agoReminds me somewhat of DefCon (http://www.introversion.co.uk/defcon/ http://www.introversion.co.uk/defcon/). No one wins. Try to be the one who loses least...
- jjar 11y agoThe game also becomes interesting and easier to watch the escalation by turning it straight to Defcon 3 and then reducing the number of bombers. This leads to skirmishes between fighters and a few stray icbm's in the beginning, but once one hits the situation escalates extremely rapidly.
- hliyan 11y agoI wish the parameters were url parameters. Comparing simulations would have been possible. (I'm currently running a conventional war scenario -- bombers and fighters only - no icbms or sats).
- jjar 11y agoIt seems with this scenario, whoever strikes first really does win, though the game takes a bit longer. The game always nearly ends with a couple of bombers sneaking past the bases at the front and taking out the factories and cities until the player runs out of resources.
- simonswain 11y agoYep. Need the ability to save and share scenarios. Coming.
- rogeryu 11y agoReminds me of Minestorm on the Vectrex!
- guard-of-terra 11y agoReal Cold War is more of this: Two side point lethal nukes at each other, but at a point one side falls on its face and proceeds selling factories for scraps, while other one forgets near-death experience in a whim deriving no lesson from it. Not so fun to simulate mind you.
- caio1982 11y agoThis was super fun to play with and the visuals are very cool! One minor thing though, the Star Wars program simulation seems too good: once you have around 5 sats going around you're safe for a long long time that it starts becoming boring (and I'm pretty sure it wouldn't be the case IRL). Like, I watched a game for 30min and all sats were too effective and nobody could really hit each other no matter how many attacks they did. Maybe make sats attack each other while in orbit? Perhaps only in specific timed cases, sort of during an orbit apogee or perigee or whatever, just to make them a bit less effective or durable?
- ethbro 11y ago> Maybe make sats attack each other while in orbit? Just add ASAT. If they've got ICBM technology and especially if they've got ABMs, they can certainly knock a satellite out of orbit.
- graeham 11y agoReally cool - would be good to have a quick instructions drop down - I started with clicking things and hitting keys until I realised it was a simulation on initial conditions only. The bombers seem too effective in anti-fighter measures, and has been said, the sats are very effective at anti-ICBM, but seem invincible themselves? Interesting how quickly the tide turns from stalemate to dominance once a few factories or bases fall. And also how long it takes to really finish the opponent off (probably my launch_max is too low). Also interesting the 'fronts' or lines of bombers that form between oppositions. This happens in naval and ground battle, but I'd think a major air war, with high speed relative to density of fighters would avoid this? Would be cool to involve some sort of strategic element? I'd hoped the fighters would protect the bombers more, but it seems they are more defensive? Well done!
- simonswain 11y agoYep. All that will be there one day. This is v0.1
- pjc50 11y agoPeople who like this might like the very similar PC game "DEFCON" http://www.introversion.co.uk/defcon/ http://www.introversion.co.uk/defcon/
- Thiz 11y agoReminds me of Atari Missile Command. Good ol' days.
- hermitcrab 11y agoVery impressive. As a crusty old desktop programmer I am amazed how smoothly it runs in the browser. A few questions (didn't see them answered below): 1. What Javascript frameworks/libraries did you use (if any)? 2. Do the 2 sides always have to be symmetric? It would be great if you could add some brief notes explaining what is going on (even if you just copy and paste some of the below).
- jjar 11y agoIt was definitely something compiled to JavaScript, I can tell you that. https://simonswain.com/coldwar/assets/pub-script-1432435171707.js https://simonswain.com/coldwar/assets/pub-script-14324351717...
- deleted 11y ago[deleted]
- vabole 11y agoThat's plain JavaScript, only minified.
- simonswain 11y agoNo frameworks or libs. Vanilla.js, raw Canvas and requestAnimationFrame. In this version, they are symmetric with slight random variations. No reason they have to be though.
- hermitcrab 11y agoWhat sort of IDE/debugger did you use (if there is such a thing for Javascript)? How long did it take to write and debug? Looking forward to v0.2!
- simonswain 11y agoEmacs, and Chrome dev tools. The build environment has jslint set up in it too. I can't recommend enough js{lint|hint}ing all your code. None of the stuff in the sim is super tricky.
- y0ss 11y agoAwesome!
- nacs 11y agoThe author's Github contains the source for this: https://github.com/simonswain/coldwar https://github.com/simonswain/coldwar