Game Development Community

dev|Pro Game Development Curriculum

Warscale movement (w/Screenshots)

by Guimo · 05/19/2008 (6:08 pm) · 2 comments

Hi all!

Two week have passed since my last blog. Not a lot of progress because these have been very busy weeks for me but I have something to show.

What was accomplished
The last weeks, I wanted to focus on setting up my AI architecture. I have made a lot of progress and the AI decision can handle simple unit summoning and also unit decisions like moving and attacking. Funny enough, the game still doesnt handle moving and attacking but at least the decision logic is there and working. Also the base decision architecture is there and working, I just need to enhance the code.

On the plus side, all is still being programmed on a client/server architecture so, even when I havent tested it, Im pretty sure it will work fine in the Internet version.

I have found the casting of special actions to be extremely difficult to analyze. It is extremely interesting how some simple actions can be so difficult to handle. As I said, I'm no AI programmer so I really hope my final solution is enough for the game.

Pick a unit to move
After setting up the basic AI, I decided to go for the unit movement. When you pick a unit, its action buttons (Move, attack, special) are displayed in the lower right corner. A message prompts the user to pick a target position for the unit. The movement action can be cancelled by pressing ESC or clicking the cancel button.

Movement range[b]
In D&D, moving to left, right, forward or backward costs a single movement point, but moving diagonally costs 1.5 movement points. This is a simple rule which was implemented for movement in warscale.

[b]Areas of effect

After clicking the Move button, a grid appears in the game board showing the positions the unit can move to. This should also show positions this unit can move to but are affected by some spell (I will left this for later when spells are invoked in the board). This feature will also be useful for future development like spell areas of effect. Once again, AFX did the trick and Jeff Faust helped me a lot setting this up. Even if I buy a Commercial license for Torque and AFX, I will definitely place both logos in the game.

Moving
When the player clicks in a board tile, the action is validated locally. If everything is fine, the action is sent to the server. The server will validate the move and if all is ok it sends the move command to the clients to be executed.

A* Algorithm
Warscale is a board game so it uses an A* algorithm in order to handle units moving from place to place. Not only that but units may have 5 different sizes, SMALL/MEDIUM, LARGE, HUGE, GARGANTUAN, COLOSSAL. A SMALL/MEDIUM unit covers an area of 1 square while a COLOSSAL unit covers an area of 21 squares in a 5x5 grid. So it is extremely important to make units walk appropiately so that they wont get stuck. My A* algorith mas ported from my old engine and I recall it was pretty fast. It was able to compute about 3000 routes each second in a 256x256 grid using a PIII 550Mhz. Warscale uses a 39x39 grid and the average PC now is 2.0Ghz so I guess it will be more than enough.


Running
A nice rule from D&D that can also be applied to Warscale is running. Basically, when a unit runs, it can double its movement points. But a unit can only run if it hasnt attacked or used an special action this turn. Also, if a unit decides to run, it wont be able to attack or use any special action for the remaining of the turn.

Damage from movement
This feature will be implemented when spells are working. Basically, each time a unit moves from one tile to the next, if the tile is affected by a spell, the unit will be affected when it enters that spot (np
A unit can suffer damage from spe

Screenshots!
As two weeks have passed, I have to post two screenshots and here they are. The first screenshot shows the selected unit which is going to move. You can see the grid showing in blue the positions this unit can move to.
www.spritekin.com/warscale/wsascreen5b.jpg
The second screenshot shows the unit running to the selected position. If you are observant you can also see the AI Avatar who has already summoned two units. The reason the units are still in the same place is that the AI is able to analyze the target avatar combat value and decides it is better to wait until gathering more forces in order to attack.
www.spritekin.com/warscale/wsascreen5a.jpg
You will also notice that the grid is more defined as a member of this community suggested (yes, send your suggestions, Im completely open to them). Also the grid has been enlarged in 50% so everything looks less cluttered.

The plan for this week
This week I want to continue working in the movement. Also I need to enhance the movement algorithm of the AI player.

Running
I need a button in order to allow the player to run.

Cant reach positions
In the first screenshot, the unit is trying to move but there is a spot in the grid which is occupied by the avatar. This spot is not painted blue but doesnt look nice. I think using a red color may make easier to understand that this position is unreachable.

AI movement
The Ai algorithm currently analizes that a unit must move to intercept a target unit. Obviously the target position will be occupied so the location cannot be reached. I have to find a suitable point so that the unit can move and attack its target.

I really think the following weeks I will be completely busy leaning to drive on the left side (it is really like learning to drive again after being used to driving on the right side) but will try to finish this and maybe start programming the combat system.

Luck with your own projects!
Guimo

#1
05/20/2008 (2:30 am)
That is awesome work, been looking at something like this, it reminds me of the old shining force games like shining force 3 on Sega Saturn!
This would definitely get me interested when it comes out!
#2
05/20/2008 (8:48 am)
This looks pretty cool :)