zolobolo wrote:Below error pops in following save:
https://www.dropbox.com/s/g6iudf9oxylls ... 2.rar?dl=0
The error might be related to using Assault Shuttles as I haven't seen those used since the latest update and the error comes around when such a vessel is in action
zolobolo wrote:Fleet vs Carrier + Planet Defense ends in the fleet loosing as the ships move directly against the carrier instead of prioritizing the bombers sortied out (probably the firing arc issue again: moving before selecting target to move against)
zolobolo wrote:Missile focused ships do not move into firing range since decoupling exposing their missiles to counter fire and not just reaction PD - Save Mod Testing 6 (let me know if you haven't got the save for the test scenario)
zolobolo wrote:There seems to be cases where the game hangs during AI processing turns
No errors in game or in Windows Event Log, just the AI Turn not ending
Trying to reproduce
Code: Select all
-- So decoupling AI ship movement from AI ship attacks has complicated the main turn ship loop a bit
-- Instead of just iterating through all the ships in turn order, we have two separate queues.
-- Each iteration we pop a ship from the move queue, move it, then see if we can make any attacks
-- with the next ship in the attack queue.
--
-- Ships only attack after their movement has been handled, in order to give them an opportunity to
-- move within range of possible targets.
--
-- If we can attack with the next ship in the attack queue, we keep going through the attack queue until we
-- get a ship that hasn't moved yet. Then we go back into the move queue.
--
-- If a ship's move target gets destroyed, we put it back in both queues and return to handling movement.
-- This gives the ship the opportunity to move to a new target if it has movement points left
-- (and replicates the behaviour of the old close_and_attack() routine's while loop).
function CombatAI_Method:issue_ship_orders(general_retreat)
local has_moved = {}
local move_targets = {}
local move_queue = sort_move_order(current_sides_ships, self)
local attack_queue = sort_attack_order(current_sides_ships, self)
local loop_sanity = 0
while #move_queue > 0 and not battle_is_over() do
loop_sanity++
if loop_sanity > 1000 error("loop_sanity") end
-- move a ship
local move_ship = pop_back(move_queue)
-- if we are going to retreat this ship, we have to decide that now
if self:wants_to_retreat(move_ship, general_retreat)
self:do_retreat(move_ship)
else
local attack_dist = desired_attack_dist(move_ship, self.estimated_tracker_survival)
if attack_dist
local move_target = self:choose_move_target(move_ship, attack_dist) or closest_enemy_ship(object_center(move_ship))
if move_target
if invalid_move_target(move_ship, move_target)
print(move_ship.name, move_ship.empire.name, move_target.name)
error("chose a move target that was invalid")
end
move_targets[move_ship] = move_target
self:close_with_target(move_ship, move_target, attack_dist)
end
end
end
has_moved[move_ship] = true
-- perform attacks, if we can
local attack_ship = attack_queue[#attack_queue]
local inner_loop_sanity = 0
while #attack_queue > 0 and has_moved[attack_ship] and not battle_is_over() do
inner_loop_sanity++
if inner_loop_sanity > 1000 error("inner_loop_sanity") end
local move_target = move_targets[attack_ship]
if move_target
if move_target.dead or move_target.defenseless or not enemies(attack_ship,move_target)
has_moved[attack_ship] = nil
move_queue[#move_queue+1] = attack_ship
goto continue --go back to ship movement
else
self:engage_targets(attack_ship, move_target)
--check again after attacking
if move_target.dead or move_target.defenseless or not enemies(attack_ship,move_target)
has_moved[attack_ship] = nil
move_queue[#move_queue+1] = attack_ship
goto continue --go back to ship movement
end
end
else
--if cloaked, don't attack if we are retreating (since this will decloak us)
if not (attack_ship.cloaked and attack_ship.retreating)
self:fire_at_will(attack_ship)
end
end
--advance the attack queue
pop_back(attack_queue)
attack_ship = attack_queue[#attack_queue]
end
::continue::
end
assert(battle_is_over() or (#move_queue == 0 and #attack_queue == 0))
end
Code: Select all
if invalid_move_target(attack_ship, move_target)
--has_moved[attack_ship] = nil
--move_queue[#move_queue+1] = attack_ship
--goto continue --go back to ship movement
else
self:engage_targets(attack_ship, move_target)
print(attack_ship.name, "engaging targets")
--check again after attacking
if invalid_move_target(attack_ship, move_target)
--has_moved[attack_ship] = nil
--move_queue[#move_queue+1] = attack_ship
--goto continue --go back to ship movement
end
end
Code: Select all
local has_moved = {}
local move_targets = {}
local move_queue = sort_move_order(current_sides_ships, self)
local attack_queue = sort_attack_order(current_sides_ships, self)
local exit_loop
local loop_sanity = 0
while #move_queue > 0 and not battle_is_over() do
loop_sanity++
if loop_sanity > 50 error("loop_sanity") end
-- move a ship
local move_ship = pop_back(move_queue)
print(move_ship.name, "moving")
-- if we are going to retreat this ship, we have to decide that now
if self:wants_to_retreat(move_ship, general_retreat)
self:do_retreat(move_ship)
print(move_ship.name, "retreating")
else
local attack_dist = desired_attack_dist(move_ship, self.estimated_tracker_survival)
if attack_dist
local move_target = self:choose_move_target(move_ship, attack_dist) or closest_enemy_ship(object_center(move_ship))
print(move_ship.name, "selecting move target")
if move_target
if invalid_move_target(move_ship, move_target)
print(move_ship.name, move_ship.empire.name, move_target.name)
print("chose a move target that was invalid")
move_target = nil
else
move_targets[move_ship] = move_target
self:close_with_target(move_ship, move_target, attack_dist)
print(move_ship.name, "closing with target")
end
end
end
end
has_moved[move_ship] = true
-- perform attacks, if we can
local attack_ship = attack_queue[#attack_queue]
local inner_loop_sanity = 0
while #attack_queue > 0 and has_moved[attack_ship] and not battle_is_over() do
inner_loop_sanity++
if inner_loop_sanity > 50 error("inner_loop_sanity") end
local move_target = move_targets[attack_ship]
print(attack_ship.name, "attacking")
if move_target
if invalid_move_target(attack_ship, move_target)
print(attack_ship.name, "move target was invalid")
if(not exit_loop) exit_loop = 1 end
--has_moved[attack_ship] = nil
--move_queue[#move_queue+1] = attack_ship
--goto continue --go back to ship movement
else
self:engage_targets(attack_ship, move_target)
print(attack_ship.name, "engaging targets")
--check again after attacking
if invalid_move_target(attack_ship, move_target)
print(attack_ship.name, "move target was invalidated")
if(not exit_loop) exit_loop = 1 end
--has_moved[attack_ship] = nil
--move_queue[#move_queue+1] = attack_ship
--goto continue --go back to ship movement
end
end
else
--if cloaked, don't attack if we are retreating (since this will decloak us)
if not (attack_ship.cloaked and attack_ship.retreating)
self:fire_at_will(attack_ship)
print(attack_ship.name, "firing at will")
end
end
--advance the attack queue
pop_back(attack_queue)
attack_ship = attack_queue[#attack_queue]
end
::continue::
if exit_loop
exit_loop++
print(..exit_loop)
if exit_loop > 3
return
end
end
end
harpy eagle wrote:It's like object center is returning the distance between the target and where the carrier was before it moved. Maybe it's related to the game merging movement of different ships?
Users browsing this forum: No registered users and 27 guests