Since I have written my initial design document and committed to my game concept, I decided to get started on the code. Ordinarily, I would begin by writing a character controller script to allow the player to move their character around the level. But, as this is a strategy game of sorts, in which you control multiple characters, this will not work. In such games, the player is not represented in the level by a character. Instead, they pilot the camera and can fly around the level to command each of their characters and observe the battle from an isometric perspective. As such, I had to write a camera controller, something I hadn't done before. A camera controller is quite different to a humanoid player controller, as instead of allowing the player to steer a character around a level, you are aiming to allow them to view as much of the level as they want, as conveniently as possible, without allowing them to confuse themselves. In short, the camera needs to be able to quickly move around, but requires limitations so that it always has a decent view. To do this I allowed the player to move along 4 axis but prevented any kind of rotation.
Left-Right = A-D
Forward-Backward = W-S
Up-Down = Space-Shift
In-Out = Mouse Wheel
Here is the current camera controller script:
With the camera able to be moved around smoothly, I decided to create a base character script which all other character scripts will inherit from. This script contains all variables and functions that will be required for any character to function within the combat system. I will of course add to this script as the system develops but for now it just stores a variety of variables to track things like a character's stats and health.
Finally, I created a managed script which will control the turn-based battle system. Currently, it finds all characters in the battle, adds them to a list and then orders that list based on the characters' speed stat. This will be used to determine the order in which characters take their turn and will track who's turn it is currently. The fastest character will go first, the slowest will go last.
Comments