Thursday, July 12, 2007

Input and GUI Libraries, Route Placement, Mini Map, Camera Smoothing

The input and gui classes are now fully reusable. Instead of making them components, however, I made them into libraries. Initially, I didn't know what a component was, and now that I do, I realize that they're not suited for the gui and input classes. Anyway, I've simplified them and added readmes to both of them. I figure I'll probably forget how to use them later on and a readme will be helpful.

I did some thinking as to the gameplay and realized a few things that I'd have to change. For example, near the end of a game, one player is at the other player's base trying to sever his central route section. The way I had it before, you couldn't place a route section if it was intersecting one of your own routes. Unfortunately, this meant you could only send one route at a time at the enemy's central route because in that narrow space, you're bound to intersect any other routes you try to send through.

To fix this problem, I now allow the player to place any routes anywhere, but if the route runs into another route or a node while it is building, then it will retract. This allows more flexibility in the gameplay.

I also did some work on the mini map. It is now in its own window that you can move around. The hardest part, however, was displaying the camera's bounds on the mini-map. It turns out that some of my code in the camera class (which I reused from my last effort) was haywire. After hours of trying to debug the dang thing (breakpoints everywhere), I discovered that in one of my functions I had a temporary piece of code that I'd forgotten to remove that was skewing some things.

Anyway, my mini-map is working like a charm now. Everything's going great. I forgot to mention last time that I'd added smoothing to the camera's movements. Rather than zooming out and moving around at a boring static rate, it smoothly moves from one point to another as in professional games.

Next, I think I'll make a geometric object to place on the map. After that's complete, I think I'll create functionality for loading maps from a file, maybe xml. After that, hopefully I'll be able to start work on the fog of war (cross your fingers).

clevceo

1 comment:

Anonymous said...

Well written article.