Feb 11, 2016
Istrolid is an HTML5 game that uses many of the new web technologies. It uses webGL to do the graphics rendering, WebSockets for network communication and AudioContext for sound, and a my own reactive html framework for the UI. I even have used Electron to pack my game into an executable for Windows and Mac. I highly recommend for people that are making simple 2d games to use the browser technologies.
Usually in openGl and webGL engines you have meshes and textures and you move them about. But I actually discovered a very different way to structure things. I use just a single mesh and texture to draw everything in Istrolid. The ships in Istrolid are incredibly low poly some times composed of only a few rectangles its a big waste to create a whole new mesh object and manage it that way. Instead I just create a single dynamic mesh I modify each frame in code. With few polygons it’s very fast. I guess this is similar to the old openGL immediate mode that people tell you not to use!
I also don’t use 3d’s ModelView matrix stuff. Instead I use a single viewport rectangles that I pass to the shaders. The game truly runs on a 2d engine.
The texture is pretty similar and as dynamic as the mesh. When a new image is needed for a part or terrain it’s loaded and put into a texture atlas that is then repacked in real time. Then the mesh is generated again using the new UI coordinates.
I don’t do anything fancy with shaders except for some HSV color level conversions and back.
I actually use CoffeeScript for everything in the game. I really like the indentation style as I come from Python and the arrow “->” is really nice for creating inline functions quickly.
I develop the game completely on the server. I wrote my own html-based editor about 3 years ago I been using for everything. I can develop from any computer at any time, by just going to my editor URL. I routinely switch between Mac, Windows, and Chrome OS. I am a big proponent of Chrome OS and all things web.
Server is also written in CoffeeScript and runs using Node.js. I wanted the game to work in single player and multiplayer. So when you play by yourself you are also running the sever locally. It uses a fake WebSocket to connect to the local server. It actually makes network problems really easy to debug as I can factor out the real network and just test my code. Debug or step through all in the same process. I even have lag and jitter simulation built into the fake WebSocket that I can activate to simulate rough networks.
Sound in the web browsers has improved a lot. I use procedural generation to create background ambiance and I also have an action drum score were I can increase the drumbeat volume during action. When units are firing weapons or exploding I up the drumbeat. I randomize each weapon shot in pitch so it does not sound all same. Not a lot of people can hear the differences though. Unless you are making a game that relies on sound I don’t recommend spending time on this … No one cares!
If your game has a ton of UI it might be hard to just make it all in code. You would need some complex UI framework. But with an HTML5 game you have it all right here. No need for complex toolkits and stuff. I also used reactive framework of my own creation for the game. It made writing and making UIs a lot easer.
It’s really easy to package your HTML5 game into an executable for Windows, Mac and Linux. I highly recommend this for people that have issues running your game, either due to extensions, outdated browsers, or just plain blocked drivers. Also this is an easy way to ship it with Steam or other places that “want” a downloadable version.
If you have any questions or feedback on the game itself. Don’t hesitate to ask I am here in the threads to answer them.
Istrolid is in Steam Greenlight right now please go give it a vote: http://steamcommunity.com/sharedfiles/filedetails/?id=573017878Or you can try the game for free here: http://www.istrolid.com/