Update AutismBotIngame/python/ingamefollowct.py
This commit is contained in:
parent
15a8093138
commit
58afbe66af
@ -112,36 +112,44 @@ def bot_process_movement(input_line):
|
|||||||
|
|
||||||
def forward_burst(wait_ticks):
|
def forward_burst(wait_ticks):
|
||||||
return f"+forward; wait {wait_ticks}; -forward; "
|
return f"+forward; wait {wait_ticks}; -forward; "
|
||||||
|
|
||||||
# Keep movement fluid: avoid frequent full stops.
|
|
||||||
should_push_forward = False
|
|
||||||
if state >= 3 or state == 1 or state == 8:
|
|
||||||
should_push_forward = True
|
|
||||||
if dist_target > team_follow_distance or enemy_distance <= enemy_chase_distance:
|
|
||||||
should_push_forward = True
|
|
||||||
if time.time() - last_forward_time < momentum_hold_seconds:
|
|
||||||
should_push_forward = True
|
|
||||||
|
|
||||||
if should_push_forward:
|
is_aggressive_state = state >= 3 or state == 1 or state == 8
|
||||||
strInput += forward_burst(2)
|
far_from_team = dist_target > team_follow_distance
|
||||||
|
enemy_close = enemy_distance <= enemy_chase_distance
|
||||||
|
enemy_very_close = enemy_distance <= infect_chase_distance
|
||||||
|
very_close_to_team = dist_target < (team_follow_distance * 0.35)
|
||||||
|
momentum_active = time.time() - last_forward_time < momentum_hold_seconds
|
||||||
|
|
||||||
|
# Decide one primary forward burst to avoid conflicting movement bursts in a single packet.
|
||||||
|
forward_ticks = 0
|
||||||
|
if far_from_team:
|
||||||
|
# Strong regroup push when separated from teammates.
|
||||||
|
forward_ticks = random.randint(min_forward_wait, max_forward_wait + 2)
|
||||||
|
elif enemy_close:
|
||||||
|
# Controlled chase pressure when enemy is in range.
|
||||||
|
forward_ticks = random.randint(min_forward_wait - 1, max_forward_wait - 1)
|
||||||
|
elif is_aggressive_state or momentum_active:
|
||||||
|
# Keep motion alive without overcommitting.
|
||||||
|
forward_ticks = 2
|
||||||
|
|
||||||
|
# Prevent overshooting teammates when no nearby threat.
|
||||||
|
if very_close_to_team and not enemy_close:
|
||||||
|
forward_ticks = min(forward_ticks, 2)
|
||||||
|
|
||||||
|
if forward_ticks > 0:
|
||||||
|
strInput += forward_burst(forward_ticks)
|
||||||
last_forward_time = time.time()
|
last_forward_time = time.time()
|
||||||
else:
|
else:
|
||||||
strInput += "wait 2;"
|
strInput += "wait 2;"
|
||||||
|
|
||||||
#print('dist_target: ', dist_target, ' enemy distance: ', enemy_distance, ' targeteam: ', targeteam, ' state:', state)
|
if enemy_very_close:
|
||||||
if dist_target > team_follow_distance:
|
# Close-range commit with a short firing hold.
|
||||||
# Favor forward movement when drifting away from teammates.
|
strInput += "+attack; wait 16; -attack; wait 4; "
|
||||||
strInput += forward_burst(random.randint(min_forward_wait, max_forward_wait))
|
|
||||||
elif enemy_distance <= enemy_chase_distance:
|
if dist_target <= team_follow_distance and not enemy_very_close:
|
||||||
# Close enemy: keep pressure by closing distance.
|
# Lighter, steadier strafes while maintaining formation.
|
||||||
strInput += forward_burst(random.randint(min_forward_wait, max_forward_wait))
|
strafe_pulses = 1 if very_close_to_team else 2
|
||||||
if enemy_distance <= infect_chase_distance:
|
strInput = strinput_append(strInput, strafe_pulses)
|
||||||
# Chase and attack at close range.
|
|
||||||
strInput += forward_burst(10)
|
|
||||||
strInput += "+attack; wait 20; -attack; "
|
|
||||||
if dist_target <= team_follow_distance:
|
|
||||||
# Keep subtle strafes to avoid robotic straight lines.
|
|
||||||
strInput = strinput_append(strInput, 2)
|
|
||||||
if enemy_distance <= shoot_distance:
|
if enemy_distance <= shoot_distance:
|
||||||
for _ in range(shoot_burst_cycles):
|
for _ in range(shoot_burst_cycles):
|
||||||
strInput += "+attack; wait 12; -attack; wait 4; "
|
strInput += "+attack; wait 12; -attack; wait 4; "
|
||||||
@ -149,12 +157,18 @@ def bot_process_movement(input_line):
|
|||||||
writeCfgInput(strInput)
|
writeCfgInput(strInput)
|
||||||
|
|
||||||
def strinput_append(strInput, nth):
|
def strinput_append(strInput, nth):
|
||||||
for _ in range(3 * nth):
|
if nth <= 0:
|
||||||
boolean_val = random.choice([True, False])
|
return strInput
|
||||||
if boolean_val:
|
|
||||||
strInput += " +moveleft; wait 15; -moveleft; "
|
direction_left = random.choice([True, False])
|
||||||
|
for _ in range(nth):
|
||||||
|
# Keep direction for a pulse to reduce jitter, occasionally switch.
|
||||||
|
if direction_left:
|
||||||
|
strInput += f" +moveleft; wait {random.randint(10, 16)}; -moveleft; "
|
||||||
else:
|
else:
|
||||||
strInput += " +moveright; wait 15; -moveright; "
|
strInput += f" +moveright; wait {random.randint(10, 16)}; -moveright; "
|
||||||
|
if random.random() < 0.30:
|
||||||
|
direction_left = not direction_left
|
||||||
return strInput
|
return strInput
|
||||||
|
|
||||||
def kill_user_owned_pid(pid):
|
def kill_user_owned_pid(pid):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user