Sunday, June 17, 2007

A* Implemented

I had a lot of spare time to work this weekend! I've applied the A* algorithm and it works like a charm.

The implementation itself is very easy. I spent more time considering how to integrate path finding with DragonSiege. I made a list of properties that a good implementation of Path Finding should have:
  1. Only one PC must calculate the path for a particular unit.
  2. The processing of Path Finding must be distributed among the PCs.
  3. The server PC must take the responsibility of the path.
I've decided to run the player-initiated Path Finding on client side and dispatch the path the the server. Here is how it works:
  1. The player instructs a units to move
  2. The player PC calculates the path for the unit
  3. The path is sent to the server
  4. The server starts executing the path for the unit by sending movement commands to the clients. The server takes responsibility for the path. (If the path becomes blocked, the server will find an alternative path and communicate this to the clients.)
I fixed quite a few bugs. No broken windows!

I've also implemented semi-transparency for buildings (see screenshot). Whenever a unit is behind a building the building will automatically become semi-transparent. The semi-transparency is a crucial feature. The importance of this feature becomes apparent when critters attack buildings from behind and the building obscures the critters. You hear chewing sounds, but see nothing!
All modern strategy games have this feature.

Well, next up...
  • Monster Dens
  • First shot at game balancing.
  • Game Startup : Player starting points, player lobby?
  • Multi-Player testing : Should work in theory?

No comments: