Thursday, July 26, 2007

RefLib

Recently, I've been focusing on another project, codenamed RefLib, which is a game I've mentioned a couple times before as a commission from my boss. It may not be as interesting as Sever since it is much simpler, but it's my first commission and also my first collaboration. Also, it has a deadline: september, so it will also be my first completed project, as Sever and Idea are long-term projects.

Anyway, if you're interested, you can find my new RefLib blog here.

I may get bored with RefLib every once in a while and spend a day or two working on Sever, so don't go away. After RefLib is complete (in september), I plan to get back to work on Sever. Thanks.

clevceo

Friday, July 20, 2007

Grid, GUI, Cosmetics, Settings, Custom Maps

I discovered yet another problem with grid interaction. For those who don't know, I separate all nodes and route sections into a grid so that when searching for collisions, I only have to test the relevant grid squares. This, of course, improves performance. The problem comes when deciding which squares to test with a route, which passes through multiple squares. Unfortunately, though my code worked fine when the slope of the route was positive, when negative it went all over the place. However, I devoted an hour to fixing it and it's working fine now.

I did some more work on the GUI, making it even more flexible. Also, I'd previously been using a font that I'd created myself, but it didn't look too good, so for the time being, I'm using Haettenschweiler, which looks much better. I also bolded and centered the title bars of the forms.

I also changed the node spacing from thick broken lines to a thin solid line that's less distracting. All in all, the game looks pretty good (especially when fullscreen).

What I plan to do next, before I start the fog of war or map objects, is use xml to create a settings file in which I would contain the specs for the different nodes and the settings for the GUI and anything else I would need. That way I can avoid recompiling after every single tiny change (not that it takes a long time to compile). This would also allow for more flexibility. Less hardcoding.

The next step after that is to create custom map functionality. Until I get a better idea of how to implement the fog of war and the geometric map objects, I will do everything I can to create the basis of the maps. The objects and fog will extend what is already there. I think they will be easier to do once I have a better idea how things will work.

clevceo

Friday, July 13, 2007

Grey Outlines

I mentioned a while back that my textures had gray outlines whenever they were shrunk or displayed at a floating point coordinate rather than a whole number. I figured that it might have been the format I was using: png.

The suggested method for transparency in the help files is to use DirectX's texture tool to convert the png to a dds by dragging the png file into the window. I did that and it didn't change anything. So I used gimp to separate the png into two bitmaps: the non-transparency image and the mask, which I then combined in the texture tool. This time, it worked.

Those gray outlines were getting under my skin and I'm glad to be rid of them.

clevceo

Tooltips, Unit Info Window

Last night, on a whim I added tooltip functionality to my GUI library. I will admit right now that it wasn't entirely necessary. I did it because I thought it would be cool. But I'm glad I did because I want my game to be as professional as possible. Any extra features to make it more windows-like and familiar to the average user are welcome.

I also added a unit-info window that shows the picture, name, and description of any nodes or routes your mouse is hovering over. I didn't necessarily need to do this right now, but I was planning on doing it eventually anyway and I thought it would be fun.

If you haven't noticed yet, whenever the next step in the project is big and intimidating, I tend to put it off and work on smaller, less important things. But I'll get to it soon enough.

clevceo

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

Monday, July 9, 2007

GUI, AI, Maps, Cosmetics

As usual, plans change. Instead of getting into the fog of war or even working on the mini-map, I decided to improve the reusability of my gui. I'm trying to remove the dependencies between it and Sever so that I can make it into a component. I have another project I'm beginning work on (it's a commission), and my gui code will come in handy. I'll probably have to do the same for my input classes, but they should be easier. Anyway, it's taking a while.

Sometimes coding can be tiring, especially when you are rewriting or modifying because it's more of a chore than a challenge. So anyway, I've decided to try reading up on AI again. The last few tries failed and my brain just about blew up. However, after all my time working on Sever, my understanding of the underground mechanics of a game has improved tremendously. So this time I was able to run right through the few chapters I read in the book ("Programming AI by Example" by Mat Buckland).

I read up on graph theory and pathfinding. I never knew it was so simple. All of a sudden, ideas have begun rolling on how to implement my AI. I realize it will be a huge challenge, but it will be satisfying just to see it work at all, especially while I wait for multiplayer support in XNA.

Before I do the AI, I want to add some geometric objects on the map (geometric makes it easier for me [a newbie] to do collision tests) so that I don't have to do any recoding with the AI later. Also, the map is currently hard-coded, so I need to allow custom maps to be loaded in. These maps will contain the tiles, objects, pathing info, and any other details they would need. So the AI will have to wait a bit longer.

I did a few cosmetic things. The two central nodes for each player now glow. I also changed the color of the route sections and changed the highlight color of the nodes (which may need to be changed again, because it's hard to see beneath the central nodes' glow).

Comments? Questions?

clevceo

Friday, July 6, 2007

Options Menu, Main Menu Background, People Distribution, Grid Problems, Mini-Map, Textbox

I added the options menu to the in-game pause menu. I also made it so when the resolution changes, all forms on-screen retain positions proportionate to what they were previously (ie. forms in the center stay in the center, forms on the right side stay on the right side).

I also added an interesting series of routes in the main menu's background. They are tinted a dark blue. I also added a gradient to the background that goes from a very dark blue at the top to a...slightly lighter dark blue at the bottom.

As I was creating the routes in the main menu background, I began to notice even more anomalies in the way people are distributed. They would often move to one route section and rotate through it rather than filling up the rest of the routes.

I have a large block of code dedicated to deciding where to direct a person when he reaches a node. Should he turn around? Should he go to the first or the second route on the other side? It calculates which route needs people the most and sends them through.

However, this code being large, bugs are inevitable. My last rendition of this game had many bugs and it didn't quite do what I wanted it to. This time around, I thought I'd done a much better job, and I had, but it still wasn't sufficient. Unfortunately, there were a few things I implemented later on that conflicted with the existing code, so I had to go back and figure out a way to make it work. Unfortunately, I was only able to "jerry rig" it.

So, I completely rewrote the code. I now know better what I am doing and was able to create more organized and robust code than before. Everything seems to be working fine if not better than I've yet seen it work. It was very satisfying to see it work so well.

I also noticed a few problems with the way the game interacted with the grid squares. When collision testing a route through a series of grid squares, only the squares it passes through should be tested. It seemed to be working fine until just now when it missed a few squares. Unfortunately, this code was fairly large as well (smaller, but large enough). So I rewrote it, too. The new code is slightly shorter and more robust. So far, it has worked perfectly.

I've begun to create a min-map that displays all routes on the map. I plan to eventually show the fog of war on it. I thought this would make testing easier for the fog of war when I can see it all at once on the mini-map.

Lastly, I perfected the textbox. You can now use the mouse to move the bar. The bar blinks now, too. I also added functionality that allows a control to decide what cursor to display when the mouse is over it. Thus, the usual "I" cursor is used above the textbox.

After the mini-map is as far as it will go, I will do the fog of war. I've let my ideas brew for the last few days before I get to work on it. Only recently has it sounded so feasible. I predict I will be deep into it tomorrow or the next day after the mini-map is complete.

Comment, please.

clevceo

Wednesday, July 4, 2007

Endgame Window, Options Menu, TextBox, Fog of War

I created the endgame window and the pause menu. So far, the pause menu has two options: resume and forfeit. Forfeit, of course, destroys all of your nodes, routes, and people and displays the endgame window.

In the main menu (as you can see in the screenshot in a previous post) is an Options button. Until now, that button did nothing, but now it displays an options menu. The menu so far has only one option: windowed/fullscreen. Soon, I'll be adding the options menu into the in-game pause menu.

I also created a textbox control. It wasn't easy, but it's here. I added textboxes to the play options screen to input the player's names. The control needs a little work (it doesn't react to the mouse; you have to use the left/right buttons on the keyboard to move the bar), but it's a big step forward.

I have an idea for how I'll implement the fog of war. I thought of it last night in bed, but it's much more practical and effective than any of the methods I'd thought of previously. Anyway, it's sounding less and less intimidating every time I think about it.

To make the main menu screen a little more visually exciting, I think I'll add some routes in the background arranged in an interesting design, with the people flowing through them as in the game. Maybe it'll be a different design each time.

I've been thinking about sound and music. I want the sounds to be soft and almost soothing. The kind of music that enters my mind whenever I think about it is a soft piano melody that's like that suspenseful music you hear in a movie when the character begins to see that something's wrong.

Comment please,

clevceo

Monday, July 2, 2007

Collision Detection, Fog of War, Post-Game, Graphics

I completed the collision detection for growing sections. I found a bug or two in past code that was surfaced by the severing and retracting going on. It took me a few minutes of frustration to figure out, but I solved it.

There's a logic error I've noticed in how the people run through the routes. Fortunately, this isn't hampering the gameplay, so I've been able to put it off for a little while, but I'll have to tackle that sooner or later.

I began working on the fog of war, but I came upon some crossroads and need some time to think them through, so I instead worked on a simple tile engine for the background. It was fairly simple and was easy to build from start to finish. I've created a single tile that covers the entire map for the moment.

Now, while I'm still thinking the fog of war through, I'm going to create an post-game window that declares the winner and shows scores. An okay button at the bottom of the window will send you back to the main menu. I also need a pause function in-game that displays a list of options, including an Abort option. This way, I can start a new game without having to shut the game down.

I have to do some thinking with the graphics. The bitmaps when displayed at an unusual scale or location (floating point rather than a whole number) tend to have a grey outline. It may be due to the format I'm using (.png), when I could be using a bitmap with a mask. I'll try that and see if it fixes things.

Questions? Comments?

clevceo