Resource icon

C3X: EXE Mod including Bug Fixes, Stack Bombard, and Much More Release 23

Does this ever happen with a ship in port? My best guess is the pathfinder plots the city tile as 'navigable' without recognizing there's a city or garrison.

It may also explain how ships are attacking a land tile when that's supposed to be illegal.
 
Hi Everyone, has anybody encountered this issue with v.23? I noticed a weird issue while testing a mod (in progress), and not sure what this might be; I test my mod on C3X v19, but recently changed to v23, and what I see is that when a great leader appears, this cannot create an army; The create army button is there, but when clicked, the leader disappears and no army is created; changing back to v19, and the army gets created; That is a bit strange; Has anyone noticed a similar problem? / Thanks
 
@WildWeazel

I figured out what causes AI naval units to attack cities. It's a bug in the pathfinder, and turns out not be all that subtle like I was worried it might be. The issue occurs when the game has found a path and is attempting to return it. It is returned by being written into the unit object in an array of up to 256 bytes, each byte storing one direction for one move along the path. Because of the way the pathfinder keeps its internal data, the final path has to be reconstructed backwards. You begin at the destination tile, determine the direction the unit would move to get there and add it to the list in the array, then from the neighbor along that direction, you determine the direction to get there and add it to the list, and so on, until you reach the starting tile.

The bug is that the pathfinder gives up doing that once it's added 256 directions to the list. Presumably whoever wrote that figured that's a sensible stopping point since the unit can only store a list of up to 256 moves. However, that doesn't work because the path is generated backwards and so the unit gets left with the last 256 moves starting from somewhere in the middle of the path. That causes it to wander off in a nonsensical direction. The game does some double checking of the validity of each move, for example naval units can't move onto land even if the pathfinder directs them there, but that double check doesn't stop naval units from moving onto tiles with cities.

Fortunately, this bug is easy to fix. All I have to do is allow the pathfinder to reconstruct more moves along the path. There is no issue with the array of moves being limited to 256 entries since the method to add moves to that array correctly handles that. When the array is full, it starts dropping the oldest moves to make space for new ones. So when the whole path is more than 256 moves, the unit will be left with the first 256 moves from its starting location instead of, incorrectly, the last 256 moves leading up to the destination.

Hi Everyone, has anybody encountered this issue with v.23? I noticed a weird issue while testing a mod (in progress), and not sure what this might be; I test my mod on C3X v19, but recently changed to v23, and what I see is that when a great leader appears, this cannot create an army; The create army button is there, but when clicked, the leader disappears and no army is created; changing back to v19, and the army gets created; That is a bit strange; Has anyone noticed a similar problem? / Thanks
That is strange, I can't think of anything I've changed recently that would block unit spawning, especially of armies in particular. I haven't gotten any other reports about this. Can you post a save?
 
Back
Top Bottom