In which I admit to completely copping out.
I need to get the discrete event simulation working. I feel I understand the concept but it’s not something I’ve ever done before so I am having some trouble figuring out how to approach it.
So I did graphical stuff instead!
Made the hitpoint bars smaller and made them green instead of red. Changed the selection marker to a blue circle underneath the units. Went ahead and raised the resolution to 800×600, since that’s what the final game will run at.
Now, one thing that is kind of stopping me is that I need to figure out exactly how units act both when they have explicit orders from the player and when they don’t.
Here’s what I’m thinking. Comments welcome.
The current problem is that you can grab a group of units and give them an attack order and they will dutifully go and kill the unit you clicked on, but then they’ll just stand around even if his buddies are right there. And his buddies will stand around too. Obviously, units need to take the initiative and engage if they have no other orders. But units without explicit orders shouldn’t stray too far from where the player put them.
Thus, when you give units move orders, you are not only moving them, you are setting their anchor point. If units do not have orders, there should be a range within which they will move and engage enemies. Archers should never move, they should simply snipe at anything that comes into range, but warriors and barbarians should probably have a range of about three tiles…if an enemy moves into that range, the warrior or barbarian moves to intercept and attack. If the enemy moves out of that range, the warrior or barbarian breaks off contact and returns to their anchor point.
Now, three tiles is less than the range of archers (eight tiles). Thus, if a unit is attacked by the enemy (rather than simply has an enemy come into its range), it can go as far as it needs to in order to engage that enemy, but once that enemy is dead it returns to its anchor point.
These autonomous attacks happen only if the unit has no standing orders from the player. Thus, if you grab a group of units and tell them to move through a group of enemy units, they will not engage as they are attacked because your move order overrides that.
I think that should be close enough to how a “real” RTS feels. Please feel free to tell me how you think it should work.