Still having a few ups and downs with my health over the past few days, when I get sick I really get sick especially in Winter. I find it quite difficult to shake something once I get it, I tend to go into a sort of loop where I feel good for a few days but revert back to being sick for another few. Hopefully I can shake it this time around!
Day 12: Development Time; 50 minutes
After thinking about how movement will work on the world map I decided to scrap the 1 tile plan and allow the player to move each unit its maximum move range in a single move. Thinking about how the 1 tile plan would play out I figured that it would be a bit too tedious for what I was trying to achieve.
The main reason as stated in my previous post relates to how fog of war works, mainly how the player’s units would interact with fog of war on the world map. By restricting the player to moving only 1 tile I figured that it would be easier to check the new sight range of the unit, but upon thinking about it I figured that I could just add that to a system in which the player could move more than 1 tile.
The units would move 1 tile at a time, sliding from their current tile to the next, once reaching the next tile they will call a sight range function which checks their sight and makes all visible tiles visible. Tiles that were visible to units previously won’t be shrouded in fog until the end of the player’s turn, the logic behind that is that nothing will move into those tiles during your turn outside of your own units so having vision on those tiles won’t give you an unfair advantage.
Once the sight check has been completed the unit will move to the next tile on its path towards its destination and repeat the process until it has reached its destination. The only time a unit will stop before reaching its destination is if it discovers an enemy unit, at which the unit will immediately stop moving towards its destination and the player will have what remains of its movement pool to either move towards or away from the enemy unit.
The discovery of enemy units was the key factor that I was a bit concerned about as I want fighting an enemy to be a serious decision. Using the system I described above however will allow units to move their entire move distance and also stop them when they discover an enemy, so hopefully that will help streamline the strategy layer a little bit.
But enough of me rambling about what I think, here is what I did today. After deciding to allow full movement ranges for units I changed the function that tiles use to check if they are valid movement tiles, this worked as intended with the appropriate tiles being highlighted.
With moveable tiles highlighted I started the path finding aspect of navigating the world map. This started with the selection of the destination tile, right clicking on a tile that is moveable would set it as the destination tile. That tile would then get a local copy of the selected unit and pick the adjacent tile that is closest to the selected unit and is also a moveable tile.
Once the closest tile is found it tells that tile to check if the unit has enough move cost to move onto it, if it does it is added to a list of tiles that are a viable path and then repeats the above process of finding the closest adjacent tile. If the tile’s movement cost is too high however it is set so that isn’t moveable and the previous tile is told to find another tile.
The above processes repeat until the current tile being checked is the tile the selected unit is standing on, the reason for checking the move cost is so that a unit doesn’t take a path that has a higher move cost than the unit itself has. This won’t necessarily find the path with the least movement cost, just the first path that is valid. If the player wants to take the least costly path they will need to micro-manage their movement a little, but for quickly moving units around the map it does the trick.
That’s enough rambling for one night, I’m at the stage where I need to add the valid path tiles to a list the selected unit can then use to navigate to the destination tile. Once that is done then I just need to implement the functionality for stopping upon seeing an enemy unit and the strategy layer will be in a functional state to the extent of moving units around the board.