From b33d34b1e628f4934ed24b30483cc73cb3b2f193 Mon Sep 17 00:00:00 2001 From: MiscellaneousStuff Date: Mon, 7 Mar 2022 15:58:47 +0000 Subject: [PATCH] Added movement to ML agent --- .../__pycache__/actor.cpython-39.pyc | Bin 808 -> 1997 bytes GameplayScripts/actor.py | 96 +++++++++++++++++- GameplayScripts/{ => spare}/auto_smite.py | 0 GameplayScripts/{ => spare}/auto_spell.py | 0 GameplayScripts/{ => spare}/base_script.py | 0 GameplayScripts/{ => spare}/champ_tracker.py | 0 GameplayScripts/{ => spare}/drawings.py | 0 .../{ => spare}/execution_notifier.py | 0 GameplayScripts/{ => spare}/extractor.py | 0 GameplayScripts/{ => spare}/map_awareness.py | 0 GameplayScripts/{ => spare}/object_viewer.py | 0 GameplayScripts/{ => spare}/orb_walker.py | 0 GameplayScripts/{ => spare}/spell_tracker.py | 0 GameplayScripts/{ => spare}/tf_card_picker.py | 0 .../{ => spare}/util_make_heightmap.py____ | 0 GameplayScripts/{ => spare}/vision_tracker.py | 0 LView/config.ini | 1 + LView/imgui.ini | 2 +- 18 files changed, 97 insertions(+), 2 deletions(-) rename GameplayScripts/{ => spare}/auto_smite.py (100%) rename GameplayScripts/{ => spare}/auto_spell.py (100%) rename GameplayScripts/{ => spare}/base_script.py (100%) rename GameplayScripts/{ => spare}/champ_tracker.py (100%) rename GameplayScripts/{ => spare}/drawings.py (100%) rename GameplayScripts/{ => spare}/execution_notifier.py (100%) rename GameplayScripts/{ => spare}/extractor.py (100%) rename GameplayScripts/{ => spare}/map_awareness.py (100%) rename GameplayScripts/{ => spare}/object_viewer.py (100%) rename GameplayScripts/{ => spare}/orb_walker.py (100%) rename GameplayScripts/{ => spare}/spell_tracker.py (100%) rename GameplayScripts/{ => spare}/tf_card_picker.py (100%) rename GameplayScripts/{ => spare}/util_make_heightmap.py____ (100%) rename GameplayScripts/{ => spare}/vision_tracker.py (100%) diff --git a/GameplayScripts/__pycache__/actor.cpython-39.pyc b/GameplayScripts/__pycache__/act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4be*-Ma?*NeP*#7es%m2r6+ISVW90yz2d#U?acdP1}y*g%^*}n62 z7t)*WwSIRteH`GxZer-RkK53fZP4Jr5?%18+a|8@R9uD`d=NBcR1zy^;%%*1nuRg@ zON5Z&%oJgvE2YroN!-@3uHh{J_=NOz=5RMctZMBQ4cgQT8M-LO{)h1E8YlcC{RHGK X0N*kRuuVXJd!BFW?%-MXv19!Uw;$VG delta 240 zcmX@hzk-b~k(ZZ?0SI2yh$O``PUMsEumJK>7*ZH>7(y6Qm{OQiSW;N$Fh?<_u%)oK zFhnt>aHMboY33BJ6mB5RlERb13#3_7_<|WU`Cozz(`3BGsI_sq2qPosj69QN zn5;QhGDWeZC+4O`O-^7^=j8{gD`o= first_minion_spawn \ + else first_minion_spawn - game.time + + cur_counter = math.floor(game.time / limit_rate) + if cur_counter > counter and game.time >= 5.0: + print(game.time, limit_rate, cur_counter) + + # Construct obs + obs = [ + game.time, + min_spawn, + game.player.health, + game.player.max_health, + game.player.team, + game.player.armour, + game.player.magic_resist, + game.player.movement_speed, + game.player.is_alive, + game.player.pos.x, + game.player.pos.y, + game.player.pos.z, + 0, # is_moving + 0, # targetable + 0, # invulnerable + 0, # recallState + game.player.Q.level, + 0, # game.player.Q.cd, + game.player.W.level, + 0, # game.player.W.cd, + game.player.E.level, + 0, # game.player.E.cd, + game.player.R.level, + 0, # game.player.R.cd, + game.player.D.level, + 0, # game.player.D.cd, + 0, # D spell type + game.player.F.level, + 0, # game.player.F.cd, + 0, # F spell type + game.player.crit, + game.player.crit_multi, + 1, # game.player.level, + 200, # game.player.mana, + 245.0, # max mana + 0, # ability haste + 0, # ap + 0, # lethality + 0, # xp + 0, # mp regen + 0.8, # game.player.hp_regen, + game.player.base_atk_range, + 0, # current gold + 0, # total gold + prev_x, + prev_y, + prev_z] + + # Infer action + c = zerorpc.Client() + c.connect("tcp://127.0.0.1:4242") + move = c.infer(obs) + + # Calculate player-relative offsets + x_off = (move % 9) - 4 + z_off = (move // 9) - 4 + print(move, x_off, z_off) + + # Move to inferred location + new_pos = game.player.pos + new_pos.x = new_pos.x + (x_off * 100) + new_pos.z = new_pos.z + (z_off * 100) + game.click_at(False, game.world_to_screen(new_pos)) + + # Set prev positions for next iteration + prev_x = game.player.pos.x + prev_y = game.player.pos.y + prev_z = game.player.pos.z + + counter = cur_counter \ No newline at end of file diff --git a/GameplayScripts/auto_smite.py b/GameplayScripts/spare/auto_smite.py similarity index 100% rename from GameplayScripts/auto_smite.py rename to GameplayScripts/spare/auto_smite.py diff --git a/GameplayScripts/auto_spell.py b/GameplayScripts/spare/auto_spell.py similarity index 100% rename from GameplayScripts/auto_spell.py rename to GameplayScripts/spare/auto_spell.py diff --git a/GameplayScripts/base_script.py b/GameplayScripts/spare/base_script.py similarity index 100% rename from GameplayScripts/base_script.py rename to GameplayScripts/spare/base_script.py diff --git a/GameplayScripts/champ_tracker.py b/GameplayScripts/spare/champ_tracker.py similarity index 100% rename from GameplayScripts/champ_tracker.py rename to GameplayScripts/spare/champ_tracker.py diff --git a/GameplayScripts/drawings.py b/GameplayScripts/spare/drawings.py similarity index 100% rename from GameplayScripts/drawings.py rename to GameplayScripts/spare/drawings.py diff --git a/GameplayScripts/execution_notifier.py b/GameplayScripts/spare/execution_notifier.py similarity index 100% rename from GameplayScripts/execution_notifier.py rename to GameplayScripts/spare/execution_notifier.py diff --git a/GameplayScripts/extractor.py b/GameplayScripts/spare/extractor.py similarity index 100% rename from GameplayScripts/extractor.py rename to GameplayScripts/spare/extractor.py diff --git a/GameplayScripts/map_awareness.py b/GameplayScripts/spare/map_awareness.py similarity index 100% rename from GameplayScripts/map_awareness.py rename to GameplayScripts/spare/map_awareness.py diff --git a/GameplayScripts/object_viewer.py b/GameplayScripts/spare/object_viewer.py similarity index 100% rename from GameplayScripts/object_viewer.py rename to GameplayScripts/spare/object_viewer.py diff --git a/GameplayScripts/orb_walker.py b/GameplayScripts/spare/orb_walker.py similarity index 100% rename from GameplayScripts/orb_walker.py rename to GameplayScripts/spare/orb_walker.py diff --git a/GameplayScripts/spell_tracker.py b/GameplayScripts/spare/spell_tracker.py similarity index 100% rename from GameplayScripts/spell_tracker.py rename to GameplayScripts/spare/spell_tracker.py diff --git a/GameplayScripts/tf_card_picker.py b/GameplayScripts/spare/tf_card_picker.py similarity index 100% rename from GameplayScripts/tf_card_picker.py rename to GameplayScripts/spare/tf_card_picker.py diff --git a/GameplayScripts/util_make_heightmap.py____ b/GameplayScripts/spare/util_make_heightmap.py____ similarity index 100% rename from GameplayScripts/util_make_heightmap.py____ rename to GameplayScripts/spare/util_make_heightmap.py____ diff --git a/GameplayScripts/vision_tracker.py b/GameplayScripts/spare/vision_tracker.py similarity index 100% rename from GameplayScripts/vision_tracker.py rename to GameplayScripts/spare/vision_tracker.py diff --git a/LView/config.ini b/LView/config.ini index 20967987..c9ad99e7 100644 --- a/LView/config.ini +++ b/LView/config.ini @@ -7,6 +7,7 @@ Auto Spell::enabled=0 Auto Spell::target_jungle=1 Auto Spell::target_minions=1 Auto Spell::targeting_target=1 +Actor::enabled=1 Champion Tracker::enabled=0 Champion Tracker::seconds_to_track=15.000000 Drawings::attack_range=1 diff --git a/LView/imgui.ini b/LView/imgui.ini index fedf2567..7dd160a3 100644 --- a/LView/imgui.ini +++ b/LView/imgui.ini @@ -109,7 +109,7 @@ Size=569,442 Collapsed=0 [Window][LVIEW by leryss] -Pos=1184,126 +Pos=1204,124 Size=690,889 Collapsed=1