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).<p>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.<p>If you have any questions about the tech I'm happy to answer them.
Hi Gluten, I never wrote a real-time game, so I'm curious about a lot of things.<p>* Does the server have a tick rate and it updates clients at a set interval, or does it only update when things happen?<p>* Did you ever run into any issues getting enough throughput from the server? e.g. maybe too many events happening at once to update everyone?<p>* Do you have to manage situations where two clients have a different view of the game state (due to extra latency for example)? If so, how do you resolve it? For example, I know that Team Fortress 2 follows the rule for guns that "if the shooter thinks it hit, then it hit", which means that people get shot around corners sometimes.<p>I'm working on a turn-based game using websockets which has been hard enough, a real-time game seems much harder to make! Thanks for sharing!
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.<p>Edit: How long did it take you to create?
I'm curious if it's reasonable to push more processing to the browsers to save on server costs.<p>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 <i>all</i> the game simulation work. My understanding is that multiplayer game clients generally just do graphics/sound and user interaction processing.<p>(yeah yeah distributed consensus don't say the B word)
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.
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!
This is so cool! Is there a dev blog?! I’m particularly interested in the netcode and things like path finding and object collision detection at scale.
remind me of my old old abandoned side project where i tried to create a diablo clone in browser with scala.js<p>does not work in most browsers, think in safari it works :D<p><a href="http://diablo-forever.com/" rel="nofollow">http://diablo-forever.com/</a>
That looks great.<p>* By JavaScript/Canvas I suppose you are talking about WebGL?<p>* Is the source code available for public viewing?<p>* Did you use any of the popular frameworks like ThreeJS?<p>* Do you use differently sized textures depending on whether the user is on a mobile phone or desktop?
Had some fun with the ai. That flag has a lot of hp and was tough<p><a href="https://i.imgur.com/5AcAD66.jpg" rel="nofollow">https://i.imgur.com/5AcAD66.jpg</a>
This is awesome, but I do have a nitpick. Using left click to select as well as move feels <i>really</i> 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.
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?
Related to multiplayer rts games this is also done with same tech but node.js only to reuse code between client and server side <a href="https://bitplanets.com/" rel="nofollow">https://bitplanets.com/</a><p>I wonder what performance issues you had with node.js that justified a bridge to c++ (including the increase of complexity of the architecture). Pathfinder is not terrible in node.