Thursday, July 4, 2013

Traffic Jam



Nothing super important here, but I wanted to show off a few things:

  • better matrices - after all that complaining, I finally got around to doing something about it. Not a big deal, and now it works. I'm doing a vector times three matrices per vertex - is that a problem? I expect that hardware can handle it, but I know that I can do those multiplications once per object, which seems like a win - isn't it?
  • not just green tanks - I now pass down an RGB (well, RGBA) vector into the fragment shader for the base color of the car, which modulates the interpolated vertex color. Again, I'm not sure if I'm getting the best performance, but it's working.
  • multiple tanks - I guess that was the other thing I was going to mention. Pretty painless to draw tanks all the way out to the horizon. I did some dorky math to come up with random looking values generated from the x,y positions, which I used to generate the colors and the rotations. Since that was really just there to create this screenshot, and it looks OK, that's fine. (Well, there's a sharp line starting in the middle-foreground and proceeding up to the top right, dividing red from green, which I don't care for, but I won't fix.)
The next big thing (maybe today, maybe later this weekend...) is to graft this in to my Jaws.js framework that I've been carting around from game to game. The sooner the better, and it'll be painful at some point - but it only gets more painful as I write more code.

I don't know if you can tell from looking at that, but I created that screenshot at 1024x768. Not sure if that's the size or aspect ratio I'll stick with. I kind of like 1.85:1 or 2.35:1. And then there's 1.618:1, which you know as "phi" or the Golden Ratio. Bah, the Greeks didn't know anything about widescreen displays.

No comments:

Post a Comment