Sunday, December 23, 2007

New model of one of the buildings

I haven't used a modeler for years and even when I did, I never learnt how to apply textures, so it has been a rocky road trying to make somekind of a model for the game, but I did get something done after all.

This could be the new model for the construction site -building after still some tweaking and additions.

Friday, December 21, 2007

Last post for the day, I promise :)

Just a quick update. The reason I'm posting three times a day is that the christmas is coming and I try to clean the palce up, but one must take some breaks from that and what better way to relax, than to code a bit ;)

I've just finished the minimap window which was suprisingly easy - I just draw the same tiles but this time in 4x4 px size. That might take some unneccessary computing, so perhaps I'll change it some day, but for now it's working like a charm. You can't fast-travel by clicking the map just yet, but I'm planning to try to make that work as well.

And another small update is the new cursor used when hovering over structures.

Creating a power indicator bar

So here's a short tutorial about creating the power indicator bar. U'know, the bar that shows how much electricity you are currently producing and how much of it your buildings and defences are using.

We start with the background image:


Now some simple calculations. The power indicators height is 229px. Now lets assume (for simplicitys sake), that the maxium ammount of electricity producable is 200. That means that 200 (power units) = 229px. So if we are currently producing 60 (power units) the following formula describes the height of that 60 in pixels.



However, just knowing the height of the produced power bar is not enought, 'cose the Y coordinates start from the top, so Y0 is the top of the window. This following line draws the bar starting from the right position.

spriteBatch.Draw(greenDot, new Rectangle(graphics.PreferredBackBufferWidth - mapBox.Width - hudOffsetFromTheWindowEdge + barOffsetFromMapBoxLeftEdge, hudOffsetFromTheWindowEdge + barOffsetFromMapBoxTopEdge + (heightOfThePowerBarArea - ((currentPower * heightOfThePowerBarArea ) / maxPowerProducable)), widthOfThePowerBar, ((currentPower * heightOfThePowerBarArea ) / maxPowerProducable)), new Color(255, 255, 255, 100));

The new Color(255, 255, 255, 100) creates a white color with the opacity of 100 / 255, so the resulting image is semi transparent.

Now we have the ammount of power produced.



If we assume that the ammount of the currently used power is 40 (power units) we can calculate the position for the little indicator showing the ammount of power used. The formula is the same, just the height of the object drawn is changed to 2px.

Major progress for a change

The game is coming along just great! I've completed the superclass for structures and inherited two buildings from it. The superclass has the values no building can do without: the position, sprite, health, maxHealth, name, description, price, power consumption, width, height and the inherited building classes set those values (each building class has variable set for maxHealth etc., but also the accessors to modify them).

PIC1: Building can now be selected and the building info box shows the real data. Also, when the building is not selected, hovering above it shows a hint box with the building name.



PIC2: When no building is selected, there's no need for the building info box.



PIC3: Here's another buiding inherited from the structure class.



Just in case someone cares, I'm planing to release the binaries and source codes every once in a while, but can't do so just yet as the building graphics are not my own. I'm working on some building sprites of my own, but until then I can't be sharing.

Some short descriptions with code samples about the game engine functions might appear here some time in the future though...

Thursday, December 20, 2007

Progress report 20/12

The game engine now has the ability to scroll and the mouse cursor is changed to give the necessary visual aide. Some tweaking has also been made to the select box (ie. the ability to select multiple targets by dragging a box over them), mainly to draw it over the right things and under the others (units, menus).

I've also started making the class structure for the buildings by making a super class that has all the elements that every structure shares (position, texture, health, maxhealth, etc.). The next thing to do is to inherit some classes from it and to make the logig for selecting and building structures.

I've also made up my mind about the way I'm going to make the fog-of war. I've decided to use an array covering the whole map and edit that whenever a unit moves. I could have made it manipulating an image and using it as an alpha-blending map, but I think this will suite my needs better - after all, this is a tile based game, so the shadows can also be tiles.


And here's a shot of the selecting box.

Wednesday, December 19, 2007

Progress update on the rts game

I've got the map editor working just the way I like, so it's now time to start making the game engine. I'm not sure will I continue working with the Hard Vacuum tileset, as I kinda prefer non-sci-fi rts games.. Some of the tiles are just fine, but the structures and units just don't light my fire.

The following screenshot shows some content placements and allthough the individual components have been made separately they do not yet work through any kind of content processor - what I mean is that I've just wrote the lines of code stating that a construction site will be drawn there and a health bar next to it. (The construction site image is once again ripped from Google Image search and is used only for testing).

More to follow once I get something done..

Friday, December 14, 2007

Reanimating the dead

Todays topic involves a lot of nostalgy. One day surfing the web I stumbled upon Danc's blog. Danc was a part of the developement team responsible of creating an RTS game. 12 years ago, that is. For some reason or another the game was never finished and now Danc has published the graphics on his site for download.

The game was called Hard Vacuum (a term somehow realted to space phenomens?) and it boosted some innovative features, that have only now been gradually implemented in modern RTS games. Read the whole story here to get the idea.



Anyways, as you might guess, I got instantly intrigued by the idea of actually developing this game. Now, the original design was made some 12 years ago, as are the graphics, so it's made for 320x200 resolution :p

Not being downhearted by that, I've allready made a working map editor using the given tiles. The map is basicly just a two-dimensional array of integers and the integers tell which tile to draw by having the tiles in a row inside one image file and multiplying the given integer by the width of one tile. So the tile # 3 is in (40, 0, 20, 20) (x, y, w, h).

The map is then saved in a file and can then be read into the game engine itself. Idiotic or brilliant? At least easy.

Isometric engines, anyone?

Hey, kids! Do you know what time it is? It's time to review some old Code Projects!

Remember UFO: Enemy Unknown or SimCity? Remenber isometric projection? I do. I've spent a couple of days in the fall creating my own isometric tile engine - spiced with particle effects! This version is just some hours old, so it doesn't have much of flesh over it's bones yet, but maybe some day I'll develope it a bit (or two bits) further.

Btw, the graphics are from Age of Empires 2 by Microsoft and are here just for testing purposes.

Another Terrain Engine, please



Ok, so I got tired of the old terrain engine.. It happens. There were some major issues, basicly with the water looking like plastic and the ammount of drawing being made by the CPU.

The new "Advanced Terrain" is based heavily on the design made by Reimier in his tutorials. The water looks A LOT more realistic, with better vawes, reflections and the whats-it's-name effect where higher angle of observation makes the waters surface transparent and a lower one makes it more like a mirror.

Intrested? Read more at Riemers XNA tutorials site!

Most of the calculations are made by shaders, so this version runs much more smoothly, and the sky looks a bit better now, that the skybox has been replaced with a dome. (The textures are bad and grainy and not made by me - for testing purpose only).

Tuesday, December 11, 2007

XNA Terrain engine I



My first go at creating an XNA 3D engine. Terrain is multi-textured, generated from height map, water reflects light and is bumbmap-animated. Scene is surrounded by a simple skybox, and the player can move around and directly manipulate the terrain.

Engine can handle textured .X models, but as you can see, the shader isn't currently rendering the textures correctly :P

Tuesday, July 24, 2007

a Little fun with Photoshop

Just a quick whirl at creating a pseudo-3D-ish planet with Photoshop CS3.

Starting a new hobby ...or not

You know that feeling when inspiration hits you? Sure you do. It's the feeling that urges you to create something new, to master your skills, to simply go crazy! You know the feeling - everyone knows it.

Today I spent half 'n hour to try watercolor painting in Photoshop CS3 (inspired by the works of Bob Ross), and was supprised how easily the image manipulation software bends to the needs of a paint job. Anyways, here's the results.

As you can see, only one of them is made by painting, the other three are just Photoshop filters in action.