augustus
augustus copied to clipboard
Distant battle is not triggered
It seems that the conditions to trigger a distant battle are not met because no empire object is either 6 (EMPIRE_OBJECT_ROMAN_ARMY) or 7 (EMPIRE_OBJECT_ENEMY_ARMY). I loaded and created different scenarios with custom empires and I don't see how to setup those object types. In addition, distant_battle_enemy_travel_months and distant_battle_roman_travel_months are always zero. Please check file scenario/distant_battle.c method void scenario_distant_battle_process(void). Thank you to all of you for the effort to make this game the best ever.
Oh yeah if you’re talking about city rescue missions I haven’t gotten around to implementing those yet. Sounds like you’ve got a pretty good handle on the code though, I don’t suppose you’d like to put together a PR for it? 🙂
As per requirements, which cities would be selected to be saved/protected? all cities visible on the empire map? distant cities? roman cities? trader cities? invisible cities?
I would say EMPIRE_CITY_DISTANT_ROMAN = 0 and EMPIRE_CITY_TRADE = 2, for now.
Looking at the code real quick, the game appears to be determining the cities to save if their type is EMPIRE_CITY_VULNERABLE_ROMAN. It also looks like you can only have one the way things are right now. I'm looking at city_military_determine_distant_battle_city() in military.c, which is called when a scenario or saved game is first initialized.
Right but the distant battle trigger is not firing because the calculation of travel months is fishy. Once this is fixed then it can be implemented which cities would be vulnerable just adding vulnerability in the custom empire xml file. I am thinking of calculating the travel month just with our city (x,y) and to all cities (x,y) points.
A side note: just like with trade, a direct linear path may not be feasible as it may go over water/ mountains. Defining waypoints for the military movement would be better.
I took a look at how the calculation of travel months works and it's just adding 1 month per EMPIRE_OBJECT_ROMAN_ARMY or EMPIRE_OBJECT_ENEMY_ARMY. So I think the idea is you'd specify the line you want your army and the enemy army to take and for each point in that line, one month is added. That's pretty typical for how things are specified on the empire map. Trade routes work in a similar way.
I know but nowhere the types EMPIRE_OBJECT_ROMAN_ARMY or EMPIRE_OBJECT_ENEMY_ARMY are assigned. I found 7 instances of EMPIRE_OBJECT_ROMAN_ARMY for testing it but no assignment.
In the meantime, I added a quick fix. The game successfully dispatch the army requested by caesar and I got the triumph arch, that is, it behaves as the vanilla version. In empire/object.c added: #define DISTANT_BATTLE_TRAVEL_MONTHS 16
int empire_object_init_distant_battle_travel_months(int object_type) { //int month = 0; //for (int i = 0; i < MAX_EMPIRE_OBJECTS; i++) { // if (objects[i].in_use && objects[i].obj.type == object_type) { // month++; // objects[i].obj.distant_battle_travel_months = month; // } //} //return month; int found = 0; for (int i = 0; i < MAX_EMPIRE_OBJECTS; i++) { if (objects[i].in_use && (objects[i].city_type == EMPIRE_CITY_DISTANT_ROMAN || objects[i].city_type == EMPIRE_CITY_TRADE)) { objects[i].obj.distant_battle_travel_months = DISTANT_BATTLE_TRAVEL_MONTHS; found = 1; } }
return found ? DISTANT_BATTLE_TRAVEL_MONTHS : 0;
}
Yeah, we need to add some parsing code for it to empire_xml.c so that custom empires can specify the Roman and enemy army paths.
One more issue. The troops aren't displayed moving through the empire map when going to fight a distant battle.
Yep. They’ll need a list of EMPIRE_OBECT_ROMAN_ARMY and EMPIRE_OBJECT_ENEMY_ARMY defined before they do that.
@PrettyFlower This has been implemented, right?
@crudelios Yep!