Cult of the Turtle

Joe Tortuga's musing on life,tech and gaming

Quiet or Technical

February 22, 2010

So this week, I’m either going to be quiet or technical. I do have some things to write about inFamous, but I’m focusing on coding htis week. So, I’ll either be quiet, or writing code gobbledygook. (So, for some of you, technical is essentially quiet. Or you wish it were;)

Well the 371-in-1 Klik’n’Play event at Glorious Trainwrecks looms kind of close. I’m not as far along as I want to be, honestly, but a decent map and tile class will be good enough, I think. I’ve settled on jQuery and a game library written for it, called gameQuery. The latter seems to mostly handle animations (which I’m not using a great deal, but any Tile class I use should be able to handle it). The other issue is that jQuery isn’t very object oriented (like Prototype and Dojo, which I’ve also worked with). That’s not a problem, but I’ve been doing OO programming for so long, it’s hard not to think in those ways.

One thing I’m thinking about is Map tiles. Normally you’d mange it with a flyweight pattern, and load a tile image that would be split up in tile-sized bits, and used to build your map. One image is one internet connection, and you only have the image one place, except when it’s being drawn. This is a pretty good pattern and a standard way of writing a map, but I got to thinking about it — browsers already do this. So long as the graphic url is the same, it pulls it from cache or downloads it once from the internet. Let’s not over do things and do what the browser is going to do already.

So I’m not going to worry about loading and drawing graphics. I’ll just set the URL on any of the map tiles, and keep a buffer around the map so it scrolls prettily. And part of this shortcutting is that I have a week or so, and I don’t want to dawdle over the right way to do something, I just want to get it done. If it’s successful, I’ll fix it later. If it’s not, then the time wasn’t wasted.

OTOH, and since I’m second-guessing myself like crazy, having these as canvas objects means I can do cheap color animation, and that sort of thing, by redrawing the graphics. So I dunno. Maybe there’s an easy way to duplicate dom entries in jQuery, so that so long as it looks like an image, I can use it as a tile. Too bad almost no one supports animated pngs ;)

Of course, part of the issue i’m having is graphics themselves. I shouldn’t be worrying about it, but I am. I need some basic stuff, and I can’t draw—nor am I going to have time to draw. I just need to commit to the idea that my games are going to be about polygons doing polygonal things in a polygonal world. Dangit!

So, now i’m working on the classic map game that I always write to do this: concentration. There’s a sample out there, and I’m liberally copying, but hey I’m learning. As always, you can access these (and read all of the code, of course) at my games website.