Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm also building a javascript game (I'm using canvas and 2d images). All the comments here are freaking me out a bit. They all keep saying that html5 games are too slow. My game has many significant features done and it seems to run fine. But I'm using tiny sprites, very few animation frames and probably 10% of the artwork I intend on having in the end.

How's your experience with your game? Is it really slow or does it run fine? I'm asking regarding all platforms.



I am building an HTML5 game (canvas/2D) that is distributed both online and on mobile. It is asset heavy with total assets weighing in around 600 MB, with an initial download around 7 MB and progressive loading as the player advances. Sprites are relatively large and a fair bit of animation and effects can be going on at one time, although I try to keep scenes static to cut down on rendering. I am happy with performance, both on mobile and desktop browsers. You are welcome to check it out for reference: http://www.webworks.dk/enginetest


The other comments are really talking about complex 3D games which is valid (for now at least). Tower Storm is far simpler than this and runs perfectly on PC's and runs great on most high end phones released in the last 2 years (iPhone 4+ and Galaxy Nexus+). I've even got it running on the Firefox OS phone (1Ghz cpu, 512MB Ram, 480 x 320 res) but it slows down significantly late game.

However it has taken some time to optimize the code to run fast enough on all these devices. The main issues I've come across are normal game algorithm issues (using a quadtree to find nearby minions, using hashmaps instead of arrays for some data that is always searched by id etc) and garbage collection. Garbage collection has been an annoying issue which I've somewhat solved by using entity pools. So instead of creating new entities and deleting them when they die a pool of entities is created at the beginning. Then upon creation each entity is pulled from that pool and after it dies all its variables is reset back to zero and it is placed back in the pool to be used again later. This uses up a lot more memory but it means the game doesn't have a large CPU spike every few seconds as it does garbage collection.

Canvas performance may be an issue once I turn it into an iPhone app as I've heard the canvas app renderer has far worse performance than the browser renderer (I have no idea why), but I'll cross that bridge when I get to it.

So in summary I think it's fine for simple casual 2D games that don't have complex logic (using A* algorithms to move large groups of units may be too much, or having advanced AI). But anything designed to appeal to hardcore gamers who need 60+ FPS and want in depth gameplay may be a bit much for it for now.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: