Tuesday, September 15, 2009

Source code available

Today after many requests I have decided to put the project folder available for download. You can get the 1.6Mb .rar file from THIS LINK.

IMPORTANT! This code is provided as is and it's only a proof-of-concept code, meaning that it's quick and dirty. I'm not sure if the code will compile with the current changes, but your best bet is probably Visual Studio 2005 Express and XNA 2.0

Tuesday, March 18, 2008

Pathfinding 1.0

So the A* pathfinding is finally up and running. Not perfect tho'

Some cases still mess the algorithm up. Specificly, when no path can be found, the algorith takesthe unit around the playfield is search for the path. And sometimes when the algorithm tries tomake a smoother path, it can drive over a corner of a structure..

Still, it feels great to finally get at least something done and for now I might focus my energy on other issues, insted of polishing the pathfinding.


Friday, February 29, 2008

Status report and a video

I've been working hard trying to get the AStart (A*) pathfinding algorithm working as effectively as possible, but it's still not done yet.

Meanwhile, I've prepared for you a small video of the select box in action, just to show that there has been some progress in the past weeks.

Thursday, February 07, 2008

The video as promised

Basic unit management

I've added an unit class structure similiar to the structure classes. It is now possible to add units to the field, select them for their information and give them a move order.

Moving keeps track of the facing of the unit and rotatets it as necessary. Well, actually the sprite is not rotated, but there are 32 different images of the same unit facing different directions. As the units move, thay push back the fog-of-war.


I'm going to make the units find paths using A* pathfinding, but for now the unit just goes x++, y++ until it reaches it's target. I recorded a video clip of the unit movement in action, but YouTube seems to be working slowly right now, so I'll just post the video once it get's processed.

Monday, February 04, 2008

A little video

Hi folks!

I've uploaded a quick video of the fog-of-war in action. Sorry for the quality, DivX wouldn't accept the file, so I compressed it with Windows Media 9...


Friday, February 01, 2008

Testing an early implementation of fog-of-war

This is an early implementation and might not be very efficent.

The idea is, that we have an array of integers that represents the maptiles and an array of integers that represents the tiles we are able to see. Then when we draw the tiles, we just check if it is visible or not.

Here's a picture with a vision radius of 5 tiles.


And here's another with vision radius set to 10 tiles.


Calculationg wether or not a point is within the visibility range is simple. The idea is from Java forums, but I trust most people can figure this out without any help.

Here's the formula:
if (Math.Pow((x1 - x), 2) + Math.Pow((y1 -y), 2) < Math.Pow(10, 2)) {
fogOfWar[x, y] = 1; //As in visible
}

the x1 and y1 are the coordinates of the center of the structure. The 10 in the end is the range of visibily, aka. the radius of the circle. And x and y are the coordinates of the point whichs visibility we are currently trying to determine.