Prevent bridge destruction & Improved fleeing enemies#1840
Prevent bridge destruction & Improved fleeing enemies#1840Johannes-callidus wants to merge 7 commits into
Conversation
|
|
The shortest route is calculated by each soldier every 300 ticks. |
|
Update: The fleeing little guys in blue pants have become more dangerous than Caesar's troops. There are also significantly more destroyed buildings now. After testing this change, I'd prefer to keep the previous behavior. P.S. I haven't checked yet, but it's possible that the bridges can be removed along with the animals as well. |
|
Now that you're mentioning that it seems kinda obvious, since I tested fighting off some big invasions. I thought I just got bad at military due to not playing a lot recently but they really destroyed that much because they were going double the speed straight through parts of my city. In terms of the bridges do you mean that you can remove wolves easily? |
|
I'm testing it. I just noticed that animals (I've only tested wolves so far) can't get onto the bridge. |
|
Grr roadblock bridges. (Since bridges are roadblocks they have TERRAIN_BUILDING and that probably prevents wolves from going there). But I should have thought about that when implementing the wolf rerouting feature. |
|
Now they should be able to go on bridges. At least on master. |
Yes. Now, if you pause the game at the right moment, you can remove a single bridge and wipe out the entire pack of wolves. |
This option should restore the enemies' retreat behavior to its fully vanilla state (they retreat back to their invasion points). As for the retreat speed, I'm not sure. It could be increased, but keeping the vanilla value is also perfectly fine. I'll leave that decision up to you. |
|
The option is actually untested so it would be very kind if someone could test it. |
|
I tested it with the option disabled. At first, everything seems to work fine, but at some point, after the enemies have taken heavy losses, they suddenly get a speed boost. However, they keep advancing instead of retreating to the invasion point. I also noticed that some enemies seem to disappear without a trace. P.S. The speed-boosted elephants charging in to destroy the city are quite a sight. P.P.S. It looks like you can no longer destroy bridges using wolves. |
|
I think trying to find the nearest retreat point is a bad idea. It creates more problems than it solves. It would be better to simply speed up retreating enemies through an option instead. Something like that. case FIGURE_ACTION_148_FLEEING:
{
f->destination_x = f->source_x;
f->destination_y = f->source_y;
int speed = 1;
if (config_get(CONFIG_GP_CH_ENEMIES_RETREAT_FAST)) {
speed += f->wait_ticks / 50; // +1 every 50 tick (1 day)
if (speed > 3) {
speed = 3;
}
}
figure_movement_move_ticks(f, f->speed_multiplier * speed);
f->wait_ticks++;
if (f->direction == DIR_FIGURE_AT_DESTINATION ||
f->direction == DIR_FIGURE_REROUTE ||
f->direction == DIR_FIGURE_LOST) {
f->state = FIGURE_STATE_DEAD;
}
break;
} |
|
Yeah I also realised that. There are so many more problems then you'd expect. Especially the huge lag due to the routing and if you only do it once you can end up with stuck troops. |
|
But at least I now understand routing and formations. |
|
You can probably remove the unnecessary #includes as well. (src/figuretype/enemy.c) |
This PR prevents players from destroying bridges while an invasion is ongoing and makes several changes to retreating enemies.
Retreating enemies now have double the speed so a fought off invasion no longer takes forever.
And they now always retreat to the nearest invasion point and not to their source for the same reason as above.