[HN Gopher] Show HN: I made a browser-based RTS game ___________________________________________________________________ Show HN: I made a browser-based RTS game I've posted this game here before, hopefully a repost is fine as the game has changed quite a bit (improved AI, improved mapeditor, much quicker gameplay, etc). Game is based on JavaScript/Canvas and WebSockets. On the browser side the map is pre-rendered (as a background image), just the mobile units/buildings and animations are dynamically rendered. The lobby server is made in node.js, but the game server is C++ for performance reasons (mainly the pathfinding). I found the C++ WebSocket libraries out there to be too difficult to use so I made my own based on the rfc. Overall I think making a game like this is quite easy with the browser performance/features nowadays. The game server and client side JavaScript are around 5000 lines of code each. If you have any questions about the tech I'm happy to answer them. Author : Gluten Score : 137 points Date : 2022-05-07 16:45 UTC (6 hours ago) (HTM) web link (www.battle-of-flags.com) (TXT) w3m dump (www.battle-of-flags.com) | caretak3r wrote: | Yeah the AI is pretty tough, pretty much only spams workers and | warriors. Only issue for me is being able to accurately click on | my base and/or individual chars. But otherwise pretty fun! | all2 wrote: | Would love to see support for viewing the group of selected | units, group hot-keys, fog of war, a* path finding... | strongbond wrote: | Please make the tutorial more prominent. | DistrictFun7572 wrote: | That looks great. | | * By JavaScript/Canvas I suppose you are talking about WebGL? | | * Is the source code available for public viewing? | | * Did you use any of the popular frameworks like ThreeJS? | | * Do you use differently sized textures depending on whether the | user is on a mobile phone or desktop? | Gluten wrote: | - Not WebGL, there are just some "canvas" draw functions. - | Source is not public currently. - Just jQuery - Game is desktop | only, based on 32x32 sprites, there is an option to scale | though if you are on a high resolution display. | bytehowl wrote: | I would recommend allowing people to just pick a name and hop in. | One of the keys to the success of web games is that there's | (often) literally no barrier to entry, including the need to | create an account. | mLuby wrote: | Skip picking a name, just jump in. If they want a name, _that | 's_ when they register an account. | | A recent web game on HN ("Pounce") did the first part well: | https://news.ycombinator.com/item?id=31073332 | | Also I suggest making it really easy to invite someone else to | play with you by sending them a link. That's more complex | though. | | Also since you already have a spectator mode, it'd be cool if | people see an active game when they go to the home page, like | lichess.org. That might be even harder to do that invite links. | | Nice that you can share the result of a game! | http://www.battle-of-flags.com/match/index/695 | adventured wrote: | I second this. The likelihood that I'll try the game out is | drastically increased if I can enter a throw-away name and | quickly start playing. | | You could automatically assign a throw-away generic name, and | then slap a 'try it right now' type button prominently on the | home page. If the game is good, then I'd be willing to create | an account. | all2 wrote: | You could also do a "link to Steam" option or something like | that in the user settings menu. So if someone is interested | in continuing to play, or even just persist a user name, they | have the option to link it to something more permanant. | Gluten wrote: | Thank you for the feedback! This sounds like something that I | will get implemented in due time. | z3t4 wrote: | My experience is that almost 100% do sign up. Signing up is not | a barrier. Funny statistic I had in a game was that while | almost 100% did sign up, only 50% of those entered the game. | After highlighting the "enter game" button, that 50% went up to | something like 85%. But the takeaway is that almost everyone do | signup almost automatically. | karmakaze wrote: | Do an A/B test, and see how many enter the game when | presented with a sign up form vs without. | Ruthalas wrote: | I second this. | | I opened a tab to give it a try, but backed out when I had to | provide an email to see how it played. Assuming I enjoyed it, | I'd then be motivated to make an account to keep track of my | play. | hejpadig wrote: | Cool, the graphics are very reminiscent of Tibia, an old school | MMO that I loved as a kid. | mrstone wrote: | Exactly what I thought. I wonder if OP played | gberger wrote: | The OP did play Tibia, in fact they develop Zezenia, which is | essentially a Tibia clone. | | https://news.ycombinator.com/item?id=8940655 | mikenew wrote: | This is awesome, but I do have a nitpick. Using left click to | select as well as move feels _really_ unnatural to somebody | coming from other RTS games. I probably have over 5k hours in | StarCraft 2 and WC3, and that 's a lot of muscle memory to | contend with. | all2 wrote: | This. I don't have nearly that much time in SC/2, but I still | want to R-click to move. | beebeepka wrote: | This is how things have been for almost 30 years now. Are we | old or are we old. WarCraft 2 was quite something | 8note wrote: | Left click to select and move is how the Westwood RTSs worked. | | Eg. Red alert 2 | gavmor wrote: | > Using left click to select as well as move feels really | unnatural to somebody coming from other RTS games. | | Is there a documented standard for RTS controls, at least for | baseline features? | mikenew wrote: | Not that I've ever come across, but Blizzard RTSs would have | to be the gold standard. Age of Empires being second. Looking | at those franchises would cover the majority of player | expectations, at least in terms of basic mechanics like | attack-moving, move-commands, unit selection, and so on. | mLuby wrote: | Agreed but maybe this is a concession for mobile users? Can't | confirm without registering an account. | crickcreek wrote: | I love rts but i just have an old-ass android phone! look for me, | 551154305985 TIM | dandigangi wrote: | This is pretty cool. I love a good RTS. Nice job. | mLuby wrote: | I'm curious if it's reasonable to push more processing to the | browsers to save on server costs. | | I know multiplayer games generally need a server to "referee" | (and to matchmake) but I wonder if games ever offload most of | that work so the client does the heavy lifting (e.g. find a path | from A to B) and then submits its work for the server to validate | (e.g. this path from A to B works) and broadcast rather than the | server doing _all_ the game simulation work. My understanding is | that multiplayer game clients generally just do graphics /sound | and user interaction processing. | | (yeah yeah distributed consensus don't say the B word) | kwhitefoot wrote: | Why can nicknames not contain spaces? | [deleted] | Sujeto wrote: | Had some fun with the ai. That flag has a lot of hp and was tough | | https://i.imgur.com/5AcAD66.jpg | iWillOffshoreU wrote: | Nice, big fan of browser based multiplayer stuff. I think there's | so much potential now to make some crazy browser based games | given current state of web apps. | | Edit: How long did it take you to create? | emteycz wrote: | I'd love to make a good browser game and I know how, but I am | absolutely useless wrt. game design stuff itself. | Gluten wrote: | I've been working on this since 2014, but the actual time spent | on development is maybe a few months. | ricardobayes wrote: | it's very nice, I enjoy the tutorial and love the fact there | is both PvE and PvP optionally. Very well thought out game so | far, hope it gets more depth later as in more things to | build, train etc. | bmacho wrote: | > I think there's so much potential now to make some crazy | browser based games given current state of web apps. | | I believe that this could have be done ~20 years ago with about | the same effort. | | Websocket is maybe minimally easier than AJAX + 20 years old | javascript, and the newer ECMA standards also have some nice | syntactic sugars, but nothing radical. Objects, classes, | closures, passing and modifying functions, javascript was so | powerful and easy to work with from the beginning. People just | didn't used it back then. | | I remember playing e.g. travianer 15 years ago, different | genre, but the technology was given. | closedloop129 wrote: | Is it possible to play the game without having to register an | account? | bmacho wrote: | You can type in a random name/password/email if you want, and | start playing. | dt3ft wrote: | I was going to ask the same question. I'd love to try it, but | creating an account just to do so is a deal breaker. | visox wrote: | remind me of my old old abandoned side project where i tried to | create a diablo clone in browser with scala.js | | does not work in most browsers, think in safari it works :D | | http://diablo-forever.com/ | crickcreek wrote: | Awesome dude | [deleted] | smegsicle wrote: | this obviously isn't as simple of a game as tagpro or agar.io, | but i think one factor for their success was being able to pop in | without making an account.. i guess they call that ".io" style | browser games? ___________________________________________________________________ (page generated 2022-05-07 23:00 UTC)