camera works!

For those of you who know me, that is not what you might think it means.  I finally got the camera working on the 2D HTML5 engine I have started to engineer.  It already supports some bells and whistles such as being completely configuration driven, and allows me to build arbitrarily sized maps from sprites.   Already it uses a simple painter’s algorithm to make sure that sprites overlap each other in a way that makes senses from the 2D projection.  And as of yesterday, I now have the camera following the player around the map, even correctly accounting for the edge of the world map.  You can try it out if you want (Left = A, Up = W, Down = S, Right = D, Re-center = X).

game-engine-ingame-screenshot

What is more surprising the difference in performance between Chrome and Safari/Firefox on Mac OS X.  With the current map size, I get only 25-30 frames per second (FPS) from Safari and Firefox.  However, I get 59-60 FPS on Chrome.  I believe it has to do with the fact that I am not pruning the map from memory when it is outside the camera area, albeit I do only render the part of the world caught within the camera.  The next step is to create and delete entities as they come in and out of the camera to see if I can gain some performance back on Safari; also, this allow me to have zero loading screens except for the start screen!   And then I’d love to add support for the gamepad API, dynamic screen sizing including full-screen mode, not to mention collision detection, dialog engine, and so forth.  A lot to do, but at least I am well on my way to having a game world that is “limitless.”

Breath some fire into this post!

This site uses Akismet to reduce spam. Learn how your comment data is processed.