This week I’ve been working on the fleet combat system for Predestination. When all of the core mechanics are implemented, we’ll be releasing this as our first beta test to get some feedback and improve it. Fleet combat is an important part of a 4X game, and it will have to be iterated on extensively to make it as awesome as possible. Our goal is to create tactical turn-based combat system that’s more like a game of chess than an RTS. We’ve already tested the movement and combat mechanics with a pen-and-paper prototype, and this week I started putting it all in code.
It doesn’t look very pretty yet, but I want to show you what I’ve got so far. I’ve finished the hex grid system and ships can be placed on the grid and rotated to face any of the adjacent hexagons. All ships involved in the combat roll initiative and then take their turns in order. For moving ships, I developed an efficient recursive algorithm that determines the shortest route to a hexagon based on the three simple rules below:
- Moving into any of the three forward squares costs 1 move point
- Turning by 60 degrees costs 1 move point.
- Two ships cannot occupy the same square
The result produced the exact pattern that my prototype design predicted:
With everything in code, I finally got to see what direction the ship would be facing when it got to each square and I wasn’t happy with the results. Since you can move into any of the three squares in front, the ship often didn’t need to turn to face the direction it was moving, so it appeared to be sliding sideways. I fixed this by changing the movement rules slightly to the rules below:
- Moving into the square directly ahead costs 1 movement point
- Turning by 60 degrees costs 1 movement point
- Two ships cannot occupy the same square
- Every ship gets 1 free 60 degree turn per round.
This produced the exact same movement costs and pattern, but now the ship always turns to face the direction it’s moving in. I’m very happy with the results, and the free 60 degree turn adds an interesting mechanic, as modifying the number of free turns per round changes the movement pattern significantly. Two free turns makes moving sideways as easy as moving forward, three makes a ship able to move the same speed in all directions, and no free turns produces the pattern below:
One of the core elements of Predestination is designing your own ships and making tactical tradeoffs in the design process. You might want long range on your guns, but to get it you have to sacrifice damage or the weapons might take an extra round to recharge. Once you’ve researched the appropriate technology, you’ll be able to do the same with your movement speed and movement pattern. You’ll be able to make tactical tradeoffs by modifying your thrusters to get additional free turns every round. That will make your ship more maneuverable, but as a tradeoff you might lose some speed or have to fit power-hungry thrusters that will reduce the energy available for weapons and defensive modules.
Ships blocking each other
Since two ships can’t occupy the same square, you can actually block off a ship’s movement by putting other ships in the way, forcing them to take a longer path around. This is something I might make into a big tactical element, perhaps by letting small ships pass through the squares of larger ones. Technologies that let ships phase through each other or teleport instead of moving could also be fun. Below is an example of a ship with its movement blocked off:
Updates to follow:
The next things I’ll be adding are:
- A translucent ghost ship on the square with the mouse over it indicating the direction the ship will be facing if you move to that square. Currently this is done with an arrow, but a ghost ship would be more intuitive and obvious.
- A line showing the route from the current ship to the target square.
- Left click moves the ship to the selected square (with movement animations), right click turns toward that square.
- End turn button to move to the next ship.
After that I’ll get stuck into developing the combat system, and I’ll put up a post on that next week to keep you up to date with how it all works. The current design uses a module hotbar and lets you activate weapons and other modules at any point during your turn, but I’ll go into further detail once I’ve started implementing it and can see that it works. We also plan to have environmental effects like asteroids, gas clouds etc, which I’ll go into more detail on in a later post.
As always, if you have any thoughts, suggestions, ideas, or other feedback, please do leave a comment. I do really appreciate getting feedback on ideas, and I think it’s a vital part of the design process. Thanks for reading .