├── .gitignore ├── BuildLinuxRender.py ├── BuildLinuxServer.py ├── BuildWindowsRender.py ├── BuildWindowsServer.py ├── Config ├── DefaultEditor.ini ├── DefaultEditorPerProjectUserSettings.ini ├── DefaultEngine.ini ├── DefaultGame.ini └── DefaultInput.ini ├── Content ├── Assets │ ├── AbstractActor │ │ ├── Agent.uasset │ │ ├── DeleteOnResetActor.uasset │ │ ├── HmapDefaultPawn.uasset │ │ ├── HmapDefaultPawnLegacy.uasset │ │ ├── HmapDefaultPawnMinimap.uasset │ │ └── ReqResetActor.uasset │ ├── CoreSystem │ │ ├── CoreControl.uasset │ │ ├── CoreFunctionLib.uasset │ │ ├── HmapGameMode.uasset │ │ ├── HmapHud.uasset │ │ ├── PerceptionComponentEfficient.uasset │ │ └── PerceptionInterface.uasset │ ├── DefAction │ │ └── ParseAction.uasset │ ├── DefAgent │ │ ├── AgentTypeManifest.uasset │ │ ├── DefAirAgent │ │ │ ├── RLA_UAV.uasset │ │ │ ├── RLA_UAV_Support.uasset │ │ │ ├── RLA_UAV_Support_V2.uasset │ │ │ └── RLA_UAV_VIP.uasset │ │ ├── DefAttackPost │ │ │ ├── Attacker.uasset │ │ │ ├── Lv3_DefenceTank.uasset │ │ │ ├── Lv3_DefenceTower.uasset │ │ │ └── PosAttacker.uasset │ │ ├── DefCarAgent │ │ │ ├── RLA_CAR.uasset │ │ │ ├── RLA_CAR_RED.uasset │ │ │ └── RLA_LaserLauncher.uasset │ │ ├── DefCarrierAgent │ │ │ ├── Carrier.uasset │ │ │ ├── DroneMesh.uasset │ │ │ └── SmallDrone.uasset │ │ ├── DefControl │ │ │ ├── AC_RL.uasset │ │ │ ├── AC_RL_ACCESS.uasset │ │ │ ├── AC_RL_ACCESS_LaserWeaponV2.uasset │ │ │ └── AC_RL_ACCESS_NoWeapon.uasset │ │ ├── DefFormation │ │ │ ├── Lv2_MomentumTestAgentSensor.uasset │ │ │ └── Lv3_MomentumAgentWithHp.uasset │ │ ├── DefIntercept │ │ │ ├── Attacker.uasset │ │ │ ├── Defender.uasset │ │ │ └── Landmark.uasset │ │ ├── DefPlane │ │ │ ├── PlaneAgent.uasset │ │ │ ├── UAV_Dragon.uasset │ │ │ └── UAV_Rainbow.uasset │ │ ├── DefPreyPredator │ │ │ ├── Predator.uasset │ │ │ └── Prey.uasset │ │ ├── DefReproduce │ │ │ └── DummyAgent.uasset │ │ ├── DefTarget │ │ │ ├── AirDefense.uasset │ │ │ ├── Commander.uasset │ │ │ ├── Missile.uasset │ │ │ ├── Target_Agent.uasset │ │ │ ├── air_defense.uasset │ │ │ └── fleet.uasset │ │ ├── DefWaterdrop │ │ │ ├── Ship.uasset │ │ │ └── Waterdrop.uasset │ │ ├── Lv1_AgentCanMoveLegacy.uasset │ │ ├── Lv1_MomentumAgent.uasset │ │ ├── Lv1_MoveAgent.uasset │ │ ├── Lv1_TestFlyingAgent.uasset │ │ ├── Lv1_TestWalkingAgent.uasset │ │ ├── Lv2_AgentCanControlLegacy.uasset │ │ ├── Lv2_TestAgentSensor.uasset │ │ ├── Lv3_AgentWithHp.uasset │ │ ├── SharedBehaviorTree │ │ │ ├── ATTACK_MICRO_MANAGE.uasset │ │ │ ├── BB_RL.uasset │ │ │ ├── BT_RL_V2.uasset │ │ │ ├── RL_CMD_IDLE_SETTING.uasset │ │ │ └── RL_CMD_STATE.uasset │ │ └── SharedTask │ │ │ ├── ArgKeepDistanceToTargetOrLocationV3.uasset │ │ │ ├── BTService_CallingGuardLocationUpdateV2.uasset │ │ │ ├── CallChangeCmdStateToIdleV2.uasset │ │ │ ├── CallGuardLocationUpdateV2.uasset │ │ │ ├── SetFocusToTargetOrLocation.uasset │ │ │ ├── WeaponFiringNoFinishV2.uasset │ │ │ └── cancel_movementV2.uasset │ ├── DefNotAgent │ │ ├── BP_Explosion.uasset │ │ ├── BP_Explosion_TypeB.uasset │ │ ├── DefReqResetActor │ │ │ ├── AgentKillerWall │ │ │ │ ├── Cylinder_Brush_StaticMesh.uasset │ │ │ │ ├── KillZoneInvisible.uasset │ │ │ │ ├── KillZoneInvisible_Circle.uasset │ │ │ │ └── KillZoneInvisible_Dynamic.uasset │ │ │ ├── FlagToCapture.uasset │ │ │ ├── KeyObjDecoration.uasset │ │ │ ├── RecordWhoGetInside │ │ │ │ ├── InvisibleTrigger.uasset │ │ │ │ └── InvisibleTrigger_CanEndEpisode.uasset │ │ │ └── VipTargetToReach │ │ │ │ └── KeyObjExample.uasset │ │ ├── General_Laser.uasset │ │ ├── LaserForIntercept.uasset │ │ ├── Weapon_Laser.uasset │ │ ├── Weapon_MissileTypeC.uasset │ │ └── toy.uasset │ ├── GUI │ │ ├── ChildMap.uasset │ │ ├── ChildMapWidget.uasset │ │ ├── HpBar.uasset │ │ ├── Icon_Cmd.uasset │ │ ├── Icons.uasset │ │ ├── Icons_airport.uasset │ │ ├── Icons_cmd.uasset │ │ ├── Icons_missile.uasset │ │ ├── Icons_target.uasset │ │ ├── MouseTraceSelector.uasset │ │ ├── PlaneIcon.uasset │ │ ├── RingMark.uasset │ │ ├── SelectEffect.uasset │ │ ├── airport.uasset │ │ ├── house.uasset │ │ ├── missile.uasset │ │ └── 飞机2.uasset │ └── Trashbin │ │ └── DroneAgentBlueprint │ │ ├── AC_Drone.uasset │ │ ├── AC_Drone_Opp.uasset │ │ ├── BB_Drone.uasset │ │ ├── BT_Drone.uasset │ │ ├── BT_Drone_Opp.uasset │ │ ├── Drone.uasset │ │ ├── Drone_Ground.uasset │ │ ├── Drone_Ground_Opp.uasset │ │ ├── EndlessPatrol.uasset │ │ ├── KeepDistanceToTargetOrLocation.uasset │ │ ├── KeepMsFiringToTarget.uasset │ │ ├── LinkingPoint.uasset │ │ ├── LinkingPointGroup.uasset │ │ ├── MaintainDistanceToTargetOrLocation.uasset │ │ └── MissileTypeB.uasset └── Maps │ ├── AirportSwarmTraining.umap │ ├── AirportSwarmTraining_BuiltData.uasset │ ├── AutoEntry.umap │ ├── Entry.umap │ ├── TestCradle.umap │ ├── TestCradle_BuiltData.uasset │ ├── UhmapAttackPost.umap │ ├── UhmapAttackPost_BuiltData.uasset │ ├── UhmapBreakingBad.umap │ ├── UhmapBreakingBad_BuiltData.uasset │ ├── UhmapCarrier.umap │ ├── UhmapCarrier_BuiltData.uasset │ ├── UhmapFlagCapture.umap │ ├── UhmapFormation.umap │ ├── UhmapIntercept.umap │ ├── UhmapJustAnIsland_BuiltData.uasset │ ├── UhmapLargeScale.umap │ ├── UhmapLargeScaleLegacy.umap │ ├── UhmapLargeScale_BuiltData.uasset │ ├── UhmapPreyPredator.umap │ ├── UhmapReproduce.umap │ ├── UhmapReproduce_BuiltData.uasset │ ├── UhmapTemplate.umap │ ├── UhmapTemplate_BuiltData.uasset │ ├── UhmapWaterdrop.umap │ └── UhmapWaterdrop_BuiltData.uasset ├── Docs ├── 2022-10-17-17-14-13.png ├── 2022-10-17-17-15-37.png ├── 2022-10-17-17-16-09.png ├── 2022-10-17-17-30-42.png ├── Demo │ ├── 2023-02-12 151938.jpg │ ├── 2023-02-12 152119.jpg │ ├── 2023-02-12 155956.jpg │ ├── uhmap-bbad.jpg │ ├── uhmap-hete.jpg │ └── uhmap-island.jpg ├── Imgs │ ├── Architecture.png │ ├── Overall.png │ ├── Sim2RealEXP.png │ └── Sim2RealFra.png ├── git_coop.md ├── old_install_method │ ├── Docs │ │ ├── UHMP_1.png │ │ ├── UHMP_window.jpg │ │ ├── vs_install2.png │ │ └── vscode_install.jpg │ └── README.md ├── unreal-island.jpg └── vscode_install.jpg ├── Please_Run_This_First_To_Fetch_Big_Files.py ├── PythonExample ├── README.md └── hmp_minimal_modules │ ├── .gitattributes │ ├── .gitignore │ ├── .gitmodules │ ├── ALGORITHM │ ├── common │ │ ├── alg_base.py │ │ ├── attention.py │ │ ├── conc.py │ │ ├── dl_pool.py │ │ ├── his.py │ │ ├── hyper_net.py │ │ ├── logit2act.py │ │ ├── mlp.py │ │ ├── net_manifest.py │ │ ├── norm.py │ │ ├── pca.py │ │ ├── ppo_sampler.py │ │ ├── rl_alg_base.py │ │ ├── traj.py │ │ ├── traj_gae.py │ │ └── traj_manager.py │ ├── example_foundation.py │ ├── hete_league_onenet_fix │ │ ├── ccategorical.py │ │ ├── cython_func.pyx │ │ ├── div_tree.py │ │ ├── foundation.py │ │ ├── hete_assignment.py │ │ ├── hete_net.py │ │ ├── net.py │ │ ├── ppo.py │ │ ├── ppo_sampler.py │ │ ├── shell_env.py │ │ ├── stage_planner.py │ │ └── trajectory.py │ ├── my_ai │ │ └── foundation.py │ ├── ppo_ma │ │ ├── ccategorical.py │ │ ├── cython_func.pyx │ │ ├── div_tree.py │ │ ├── foundation.py │ │ ├── net.py │ │ ├── ppo.py │ │ ├── ppo_sampler.py │ │ ├── shell_env.py │ │ ├── stage_planner.py │ │ └── trajectory.py │ ├── random │ │ ├── actionset.py │ │ └── foundation.py │ └── script_ai │ │ ├── a_attackpost.py │ │ ├── a_escape.py │ │ ├── a_test_reproduce.py │ │ ├── assignment.py │ │ ├── blue_strategy.py │ │ ├── decision.py │ │ ├── dummy.py │ │ ├── dummy_uhmap.py │ │ ├── global_params.py │ │ ├── manual.py │ │ ├── module_evaluation.py │ │ ├── red_strategy.py │ │ ├── stance.py │ │ ├── uhmap_bb.py │ │ ├── uhmap_island.py │ │ ├── uhmap_ls.py │ │ └── uhmap_ls_mp.py │ ├── LICENSE │ ├── MISSION │ ├── common │ │ └── base_env.py │ ├── env_router.py │ ├── readme.md │ └── uhmap │ │ ├── SubTasks │ │ ├── SubtaskCommonFn.py │ │ ├── UhmapAdversial.py │ │ ├── UhmapAdversialConf.py │ │ ├── UhmapAttackPost.py │ │ ├── UhmapAttackPostConf.py │ │ ├── UhmapBreakingBad.py │ │ ├── UhmapBreakingBadConf.py │ │ ├── UhmapCarrier.py │ │ ├── UhmapCarrierConf.py │ │ ├── UhmapEscape.py │ │ ├── UhmapEscapeConf.py │ │ ├── UhmapFormation.py │ │ ├── UhmapFormationConf.py │ │ ├── UhmapHuge.py │ │ ├── UhmapHugeConf.py │ │ ├── UhmapIntercept.py │ │ ├── UhmapInterceptConf.py │ │ ├── UhmapJustAnIsland.py │ │ ├── UhmapJustAnIslandConf.py │ │ ├── UhmapLargeScale.py │ │ ├── UhmapLargeScaleConf.py │ │ ├── UhmapPreyPredator.py │ │ ├── UhmapPreyPredatorConf.py │ │ ├── UhmapReproduce.py │ │ ├── UhmapReproduceConf.py │ │ ├── UhmapWaterdrop.py │ │ ├── UhmapWaterdropConf.py │ │ └── cython_func.pyx │ │ ├── actionset.py │ │ ├── actionset_v3.py │ │ ├── actset_lookup.py │ │ ├── agent.py │ │ ├── auto_download.py │ │ ├── struct.cpp │ │ ├── uhmap.md │ │ └── uhmap_env_wrapper.py │ ├── README.md │ ├── UTIL │ ├── __init__.py │ ├── auto_gpu.py │ ├── batch_exp.py │ ├── colorful.py │ ├── config_args.py │ ├── data_struct.py │ ├── exp_helper.py │ ├── fetch_multiserver.py │ ├── file_lock.py │ ├── gpu_eater.py │ ├── gpu_share.py │ ├── hidden_print.py │ ├── hmp_daemon.py │ ├── legacy │ │ └── gpu_share_unfin.py │ ├── mem_watcher_ue.py │ ├── memleak_finder.py │ ├── mprofile.py │ ├── mserver_launcher.sh │ ├── network.py │ ├── pip_find_missing.py │ ├── shm_env.py │ ├── shm_pool.pyx │ ├── sync_exp.py │ ├── tensor_ops.py │ ├── tensor_ops_c.pyx │ └── win_pool.py │ ├── VISUALIZE │ ├── README.md │ ├── __init__.py │ ├── color.html │ ├── mcom.py │ ├── mcom_def.py │ ├── mcom_rec.py │ ├── mcom_replay.py │ ├── mcom_rt.py │ ├── mcom_test.py │ ├── mcom_v2d.py │ ├── md_imgs │ │ ├── HMP_CONF.svg │ │ ├── hmp2g_timeline.svg │ │ ├── multi_team.jpg │ │ ├── simple_framework.jpg │ │ ├── timeline.jpg │ │ ├── 动画11.gif │ │ ├── 动画12-1.gif │ │ ├── 动画13.gif │ │ ├── 动画9.gif │ │ └── 动画x7.gif │ ├── read_group_replay.ipynb │ ├── seaborn_defaults.py │ └── threejs_replay.py │ ├── ZDOCS │ ├── Dockerfile │ ├── DockerfilePython311 │ ├── bashrc_suffix │ ├── examples │ │ └── uhmap │ │ │ ├── AirAttack.jsonc │ │ │ ├── AirShow.jsonc │ │ │ ├── hlt+50vs50.jsonc │ │ │ ├── ppoma+50vs50.jsonc │ │ │ ├── ppoma+intercept.jsonc │ │ │ ├── ppoma+predatorprey.jsonc │ │ │ ├── ppoma+uhmap10vs10hete.jsonc │ │ │ ├── ppoma_waterdrop.jsonc │ │ │ ├── qmix+uhmap10vs10hete.jsonc │ │ │ ├── qmix+uhmap20vs20.jsonc │ │ │ ├── qmix+uhmap50vs50+debug.jsonc │ │ │ ├── qmix+uhmap50vs50.jsonc │ │ │ ├── qplex+uhmap10vs10hete.jsonc │ │ │ ├── qtran+uhmap10vs10hete.jsonc │ │ │ ├── random_waterdrop.jsonc │ │ │ └── uhmp_demo.gif │ ├── pip_requirement.md │ ├── sc2checkversion │ ├── setup_docker.md │ ├── setup_no_docker.md │ ├── setup_ubuntu.md │ ├── setup_ue_docker.md │ ├── ssh_pubkey.sh │ ├── test_examples.py │ ├── use_pymarl2.md │ └── use_unreal_hmap.md │ ├── ZHECKPOINT │ └── uhmap_hete10vs10 │ │ ├── experiment_test.jsonc │ │ ├── model_trained.pt │ │ ├── rec.jpeg │ │ ├── render_result.jsonc │ │ ├── render_result_editor.jsonc │ │ └── render_result_editor2.jsonc │ ├── agent_with_sensor.jsonc │ ├── attack_post.jsonc │ ├── carrier.jsonc │ ├── config.py │ ├── cradle.ipynb │ ├── cradle.py │ ├── escape.jsonc │ ├── formation.jsonc │ ├── main.py │ ├── multi_server.py │ ├── multi_team.py │ ├── multi_team_parallel.py │ ├── reproduce.jsonc │ └── task_runner.py ├── README.md ├── README_CN.md ├── Source ├── Jsonx │ ├── Jsonx.Build.cs │ ├── Private │ │ ├── Dom │ │ │ ├── JsonxObject.cpp │ │ │ └── JsonxValue.cpp │ │ ├── JsonxModule.cpp │ │ └── Tests │ │ │ └── JsonxTests.cpp │ └── Public │ │ ├── Dom │ │ ├── JsonxObject.h │ │ └── JsonxValue.h │ │ ├── Jsonx.h │ │ ├── JsonxGlobals.h │ │ ├── JsonxUtils │ │ └── JsonxObjectArrayUpdater.h │ │ ├── Policies │ │ ├── CondensedJsonxPrintPolicy.h │ │ ├── JsonxPrintPolicy.h │ │ └── PrettyJsonxPrintPolicy.h │ │ └── Serialization │ │ ├── JsonxReader.h │ │ ├── JsonxSerializer.h │ │ ├── JsonxSerializerMacros.h │ │ ├── JsonxTypes.h │ │ └── JsonxWriter.h ├── JsonxUtilities │ ├── JsonxUtilities.Build.cs │ ├── Private │ │ ├── JsonxObjectConverter.cpp │ │ ├── JsonxObjectWrapper.cpp │ │ └── JsonxUtilitiesModule.cpp │ └── Public │ │ ├── JsonxDomBuilder.h │ │ ├── JsonxObjectConverter.h │ │ ├── JsonxObjectWrapper.h │ │ └── JsonxUtilities.h ├── UHMP.Target.cs ├── UHMP │ ├── AgentBaseCpp.cpp │ ├── AgentBaseCpp.h │ ├── DataStruct.h │ ├── HMPAIController.cpp │ ├── HMPAIController.h │ ├── HMPLevelScriptActor.cpp │ ├── HMPLevelScriptActor.h │ ├── HmpCrowdFollowingComponent.cpp │ ├── HmpCrowdFollowingComponent.h │ ├── HmpPythonIO.cpp │ ├── HmpPythonIO.h │ ├── IOCompress │ │ ├── lz4.c │ │ └── lz4.h │ ├── UHMP.Build.cs │ ├── UHMP.cpp │ ├── UHMP.h │ ├── UHMPBlueprintFunctionLibrary.cpp │ └── UHMPBlueprintFunctionLibrary.h ├── UHMPEditor.Target.cs └── UHMPServer.Target.cs ├── build.py ├── compress.txt ├── current_version ├── onedrive_util.py ├── test_memory_leak.py └── upload_big_file.py /.gitignore: -------------------------------------------------------------------------------- 1 | Binaries 2 | Build 3 | DerivedDataCache 4 | Intermediate 5 | Saved 6 | TEMP 7 | Temp 8 | Py 9 | .vscode 10 | .vs 11 | *.VC.db 12 | *.opensdf 13 | *.opendb 14 | *.sdf 15 | *.sln 16 | *.suo 17 | *.xcodeproj 18 | *.xcworkspace 19 | Python 20 | 21 | 22 | __pycache__ 23 | *-datas 24 | 25 | # private* 26 | private* 27 | Content/Model3D 28 | Plugins 29 | 7-Zip 30 | UHMP.uproject 31 | EnvDesignTutorial.pptx 32 | 33 | 34 | # f'.\\7-Zip\\7z.exe a -tzip -mx4 ./Build/uhmp-big-file-v{desired_version}.zip ./Content/Model3D ./Plugins ./7-Zip ./UHMP.uproject ./EnvDesignTutorial.pptx' 35 | # ./7-Zip/7z.exe a -tzip -mx4 ./Build/tt.zip -ir!Content\Model3D\Flying\Meshes 7-Zip 36 | Content/StarterContent 37 | -------------------------------------------------------------------------------- /BuildLinuxRender.py: -------------------------------------------------------------------------------- 1 | """ 2 | After you have installed the toolchain for cross-compilation, 3 | you must open the solution for the engine in Rider (or VisualStudio) and 4 | build (rebuild is not necessary) the editor for Win64 (yes, that is Win64 and not Linux). 5 | This will create the needed folder “Engine/Binaries/Win64/Linux”. 6 | Then restart your editor, and packaging LinuxServer will work. 7 | """ 8 | 9 | import subprocess, sys, shutil, time, os 10 | 11 | EnginePath = "F:/UnrealEngine-4.27.2-release/Engine" 12 | assert os.path.exists(EnginePath), f"Cannot find Unreal Engine at this path {EnginePath}" 13 | Windows_Only = False 14 | Build = 'Test' # Development/Test/shipping 15 | Platform = 'Linux' # Win64/Linux 16 | def print亮绿(*kw,**kargs): 17 | print("\033[1;32m",*kw,"\033[0m",**kargs) 18 | 19 | time_mark = time.strftime("%Y-%m-%d-%H-%M", time.localtime()) 20 | try: 21 | shutil.rmtree('Build/LinuxNoEditor') 22 | except: 23 | pass 24 | 25 | print亮绿(f'********* Begin Build: {Build} On {Platform} ***********') 26 | # build server 27 | path = os.path.abspath('./').replace(r'\\', '/') 28 | 29 | process = subprocess.Popen([ 30 | f"{EnginePath}/Build/BatchFiles/RunUAT.bat", 31 | f"-ScriptsForProject={path}/UHMP.uproject", 32 | "BuildCookRun", 33 | "-nocompileeditor", 34 | "-nop4", 35 | f"-project={path}/UHMP.uproject", 36 | "-cook", 37 | "-stage", 38 | "-archive", 39 | f"-archivedirectory={path}/Build", 40 | "-package ", 41 | f"-ue4exe={EnginePath}/Binaries/Win64/UE4Editor-Cmd.exe", 42 | "-compressed", 43 | "-ddc=DerivedDataBackendGraph", 44 | "-pak", 45 | "-prereqs", 46 | "-nodebuginfo", 47 | f"-targetplatform={Platform}", 48 | "-build", 49 | "-target=UHMP", 50 | "-serverconfig=%s"%Build, 51 | "-utf8output", 52 | "-compile" 53 | ]) 54 | return_code = process.wait() 55 | print亮绿('********* ********************** ***********') 56 | print亮绿('********* ********************** ***********') 57 | print亮绿('********* ********************** ***********') 58 | print亮绿('********* ********************** ***********') 59 | if (return_code!=0): 60 | print('fail') 61 | sys.exit() 62 | 63 | -------------------------------------------------------------------------------- /BuildLinuxServer.py: -------------------------------------------------------------------------------- 1 | """ 2 | After you have installed the toolchain for cross-compilation, 3 | you must open the solution for the engine in Rider (or VisualStudio) and 4 | build (rebuild is not necessary) the editor for Win64 (yes, that is Win64 and not Linux). 5 | This will create the needed folder “Engine/Binaries/Win64/Linux”. 6 | Then restart your editor, and packaging LinuxServer will work. 7 | """ 8 | 9 | import subprocess, sys, shutil, time, os 10 | 11 | EnginePath = "F:/UnrealEngine-4.27.2-release/Engine" 12 | assert os.path.exists(EnginePath), f"Cannot find Unreal Engine at this path {EnginePath}" 13 | Windows_Only = False 14 | Build = 'Test' # Development/Test/shipping 15 | Platform = 'Linux' # Win64/Linux 16 | def print亮绿(*kw,**kargs): 17 | print("\033[1;32m",*kw,"\033[0m",**kargs) 18 | 19 | time_mark = time.strftime("%Y-%m-%d-%H-%M", time.localtime()) 20 | try: 21 | shutil.rmtree('Build/LinuxServer') 22 | except: 23 | pass 24 | 25 | print亮绿(f'********* Begin Build: {Build} On {Platform} ***********') 26 | # build server 27 | path = os.path.abspath('./').replace(r'\\', '/') 28 | 29 | process = subprocess.Popen([ 30 | f"{EnginePath}/Build/BatchFiles/RunUAT.bat", 31 | f"-ScriptsForProject={path}/UHMP.uproject", 32 | "BuildCookRun", 33 | "-nocompileeditor", 34 | "-nop4", 35 | f"-project={path}/UHMP.uproject", 36 | "-cook", 37 | "-stage", 38 | "-archive", 39 | f"-archivedirectory={path}/Build", 40 | "-package ", 41 | f"-ue4exe={EnginePath}/Binaries/Win64/UE4Editor-Cmd.exe", 42 | "-compressed", 43 | "-ddc=DerivedDataBackendGraph", 44 | "-pak", 45 | "-prereqs", 46 | "-nodebuginfo", 47 | f"-targetplatform={Platform}", 48 | "-build", 49 | "-target=UHMPServer", 50 | "-serverconfig=%s"%Build, 51 | "-utf8output", 52 | "-compile" 53 | ]) 54 | return_code = process.wait() 55 | print亮绿('********* ********************** ***********') 56 | print亮绿('********* ********************** ***********') 57 | print亮绿('********* ********************** ***********') 58 | print亮绿('********* ********************** ***********') 59 | if (return_code!=0): 60 | print('fail') 61 | sys.exit() 62 | 63 | -------------------------------------------------------------------------------- /BuildWindowsRender.py: -------------------------------------------------------------------------------- 1 | import subprocess, sys, shutil, time, os 2 | 3 | EnginePath = "F:/UnrealEngine-4.27.2-release/Engine" 4 | assert os.path.exists(EnginePath), f"Cannot find Unreal Engine at this path {EnginePath}" 5 | Windows_Only = False 6 | Build = 'Test' # Development/Test/shipping 7 | Platform = 'Win64' # Win64/Linux 8 | def print亮绿(*kw,**kargs): 9 | print("\033[1;32m",*kw,"\033[0m",**kargs) 10 | 11 | time_mark = time.strftime("%Y-%m-%d-%H-%M", time.localtime()) 12 | try: 13 | shutil.rmtree('Build/WindowsNoEditor') 14 | except: 15 | pass 16 | 17 | print亮绿(f'********* Begin Build: {Build} On {Platform} ***********') 18 | # build server 19 | path = os.path.abspath('./').replace(r'\\', '/') 20 | 21 | process = subprocess.Popen([ 22 | f"{EnginePath}/Build/BatchFiles/RunUAT.bat", 23 | f"-ScriptsForProject={path}/UHMP.uproject", 24 | "BuildCookRun", 25 | "-nocompileeditor", 26 | "-nop4", 27 | f"-project={path}/UHMP.uproject", 28 | "-cook", 29 | "-stage", 30 | "-archive", 31 | f"-archivedirectory={path}/Build", 32 | "-package ", 33 | f"-ue4exe={EnginePath}/Binaries/Win64/UE4Editor-Cmd.exe", 34 | "-compressed", 35 | "-ddc=DerivedDataBackendGraph", 36 | "-pak", 37 | "-prereqs", 38 | "-nodebuginfo", 39 | f"-targetplatform={Platform}", 40 | "-build", 41 | "-target=UHMP", 42 | "-serverconfig=%s"%Build, 43 | "-utf8output", 44 | "-compile" 45 | ]) 46 | return_code = process.wait() 47 | print亮绿('********* ********************** ***********') 48 | print亮绿('********* ********************** ***********') 49 | print亮绿('********* ********************** ***********') 50 | print亮绿('********* ********************** ***********') 51 | if (return_code!=0): 52 | print('fail') 53 | sys.exit() 54 | 55 | -------------------------------------------------------------------------------- /BuildWindowsServer.py: -------------------------------------------------------------------------------- 1 | import subprocess, sys, shutil, time, os 2 | 3 | EnginePath = "F:/UnrealEngine-4.27.2-release/Engine" 4 | assert os.path.exists(EnginePath), f"Cannot find Unreal Engine at this path {EnginePath}" 5 | Windows_Only = False 6 | Build = 'Test' # Development/Test/shipping 7 | Platform = 'Win64' # Win64/Linux 8 | def print亮绿(*kw,**kargs): 9 | print("\033[1;32m",*kw,"\033[0m",**kargs) 10 | 11 | time_mark = time.strftime("%Y-%m-%d-%H-%M", time.localtime()) 12 | try: 13 | shutil.rmtree('Build/WindowsServer') 14 | except: 15 | pass 16 | 17 | print亮绿(f'********* Begin Build: {Build} On {Platform} ***********') 18 | # build server 19 | path = os.path.abspath('./').replace(r'\\', '/') 20 | 21 | process = subprocess.Popen([ 22 | f"{EnginePath}/Build/BatchFiles/RunUAT.bat", 23 | f"-ScriptsForProject={path}/UHMP.uproject", 24 | "BuildCookRun", 25 | "-nocompileeditor", 26 | "-nop4", 27 | f"-project={path}/UHMP.uproject", 28 | "-cook", 29 | "-stage", 30 | "-archive", 31 | f"-archivedirectory={path}/Build", 32 | "-package ", 33 | f"-ue4exe={EnginePath}/Binaries/Win64/UE4Editor-Cmd.exe", 34 | "-compressed", 35 | "-ddc=DerivedDataBackendGraph", 36 | "-pak", 37 | "-prereqs", 38 | "-nodebuginfo", 39 | f"-targetplatform={Platform}", 40 | "-build", 41 | "-target=UHMPServer", 42 | "-serverconfig=%s"%Build, 43 | "-utf8output", 44 | "-compile" 45 | ]) 46 | return_code = process.wait() 47 | print亮绿('********* ********************** ***********') 48 | print亮绿('********* ********************** ***********') 49 | print亮绿('********* ********************** ***********') 50 | print亮绿('********* ********************** ***********') 51 | if (return_code!=0): 52 | print('fail') 53 | sys.exit() 54 | 55 | -------------------------------------------------------------------------------- /Config/DefaultEditor.ini: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Config/DefaultEditorPerProjectUserSettings.ini: -------------------------------------------------------------------------------- 1 | [/Script/BlueprintGraph.BlueprintEditorSettings] 2 | bDrawMidpointArrowsInBlueprints=False 3 | bShowGraphInstructionText=True 4 | bHideUnrelatedNodes=False 5 | bShowShortTooltips=True 6 | bSplitContextTargetSettings=True 7 | bExposeAllMemberComponentFunctions=True 8 | bShowContextualFavorites=False 9 | bExposeDeprecatedFunctions=False 10 | bCompactCallOnMemberNodes=False 11 | bFlattenFavoritesMenus=True 12 | bFavorPureCastNodes=False 13 | bAutoCastObjectConnections=False 14 | bShowViewportOnSimulate=False 15 | bShowInheritedVariables=False 16 | bAlwaysShowInterfacesInOverrides=True 17 | bShowParentClassInOverrides=True 18 | bShowEmptySections=True 19 | bShowAccessSpecifier=False 20 | bSpawnDefaultBlueprintNodes=True 21 | bHideConstructionScriptComponentsInDetailsView=True 22 | bHostFindInBlueprintsInGlobalTab=True 23 | bNavigateToNativeFunctionsFromCallNodes=True 24 | Bookmarks=() 25 | bIncludeCommentNodesInBookmarksTab=True 26 | bShowBookmarksForCurrentDocumentOnlyInTab=False 27 | GraphEditorQuickJumps=() 28 | SaveOnCompile=SoC_Never 29 | bJumpToNodeErrors=False 30 | bAllowExplicitImpureNodeDisabling=True 31 | bShowActionMenuItemSignatures=False 32 | bBlueprintNodeUniqueNames=False 33 | bShowDetailedCompileResults=False 34 | CompileEventDisplayThresholdMs=5 35 | NodeTemplateCacheCapMB=20.000000 36 | 37 | -------------------------------------------------------------------------------- /Content/Assets/AbstractActor/Agent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/AbstractActor/Agent.uasset -------------------------------------------------------------------------------- /Content/Assets/AbstractActor/DeleteOnResetActor.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/AbstractActor/DeleteOnResetActor.uasset -------------------------------------------------------------------------------- /Content/Assets/AbstractActor/HmapDefaultPawn.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/AbstractActor/HmapDefaultPawn.uasset -------------------------------------------------------------------------------- /Content/Assets/AbstractActor/HmapDefaultPawnLegacy.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/AbstractActor/HmapDefaultPawnLegacy.uasset -------------------------------------------------------------------------------- /Content/Assets/AbstractActor/HmapDefaultPawnMinimap.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/AbstractActor/HmapDefaultPawnMinimap.uasset -------------------------------------------------------------------------------- /Content/Assets/AbstractActor/ReqResetActor.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/AbstractActor/ReqResetActor.uasset -------------------------------------------------------------------------------- /Content/Assets/CoreSystem/CoreControl.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/CoreSystem/CoreControl.uasset -------------------------------------------------------------------------------- /Content/Assets/CoreSystem/CoreFunctionLib.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/CoreSystem/CoreFunctionLib.uasset -------------------------------------------------------------------------------- /Content/Assets/CoreSystem/HmapGameMode.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/CoreSystem/HmapGameMode.uasset -------------------------------------------------------------------------------- /Content/Assets/CoreSystem/HmapHud.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/CoreSystem/HmapHud.uasset -------------------------------------------------------------------------------- /Content/Assets/CoreSystem/PerceptionComponentEfficient.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/CoreSystem/PerceptionComponentEfficient.uasset -------------------------------------------------------------------------------- /Content/Assets/CoreSystem/PerceptionInterface.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/CoreSystem/PerceptionInterface.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAction/ParseAction.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAction/ParseAction.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/AgentTypeManifest.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/AgentTypeManifest.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAirAgent/RLA_UAV.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAirAgent/RLA_UAV.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAirAgent/RLA_UAV_Support.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAirAgent/RLA_UAV_Support.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAirAgent/RLA_UAV_Support_V2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAirAgent/RLA_UAV_Support_V2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAirAgent/RLA_UAV_VIP.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAirAgent/RLA_UAV_VIP.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAttackPost/Attacker.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAttackPost/Attacker.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAttackPost/Lv3_DefenceTank.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAttackPost/Lv3_DefenceTank.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAttackPost/Lv3_DefenceTower.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAttackPost/Lv3_DefenceTower.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefAttackPost/PosAttacker.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefAttackPost/PosAttacker.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefCarAgent/RLA_CAR.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefCarAgent/RLA_CAR.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefCarAgent/RLA_CAR_RED.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefCarAgent/RLA_CAR_RED.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefCarAgent/RLA_LaserLauncher.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefCarAgent/RLA_LaserLauncher.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefCarrierAgent/Carrier.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefCarrierAgent/Carrier.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefCarrierAgent/DroneMesh.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefCarrierAgent/DroneMesh.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefCarrierAgent/SmallDrone.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefCarrierAgent/SmallDrone.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefControl/AC_RL.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefControl/AC_RL.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefControl/AC_RL_ACCESS.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefControl/AC_RL_ACCESS.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefControl/AC_RL_ACCESS_LaserWeaponV2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefControl/AC_RL_ACCESS_LaserWeaponV2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefControl/AC_RL_ACCESS_NoWeapon.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefControl/AC_RL_ACCESS_NoWeapon.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefFormation/Lv2_MomentumTestAgentSensor.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefFormation/Lv2_MomentumTestAgentSensor.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefFormation/Lv3_MomentumAgentWithHp.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefFormation/Lv3_MomentumAgentWithHp.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefIntercept/Attacker.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefIntercept/Attacker.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefIntercept/Defender.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefIntercept/Defender.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefIntercept/Landmark.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefIntercept/Landmark.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefPlane/PlaneAgent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefPlane/PlaneAgent.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefPlane/UAV_Dragon.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefPlane/UAV_Dragon.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefPlane/UAV_Rainbow.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefPlane/UAV_Rainbow.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefPreyPredator/Predator.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefPreyPredator/Predator.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefPreyPredator/Prey.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefPreyPredator/Prey.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefReproduce/DummyAgent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefReproduce/DummyAgent.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefTarget/AirDefense.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefTarget/AirDefense.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefTarget/Commander.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefTarget/Commander.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefTarget/Missile.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefTarget/Missile.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefTarget/Target_Agent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefTarget/Target_Agent.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefTarget/air_defense.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefTarget/air_defense.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefTarget/fleet.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefTarget/fleet.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefWaterdrop/Ship.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefWaterdrop/Ship.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/DefWaterdrop/Waterdrop.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/DefWaterdrop/Waterdrop.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv1_AgentCanMoveLegacy.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv1_AgentCanMoveLegacy.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv1_MomentumAgent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv1_MomentumAgent.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv1_MoveAgent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv1_MoveAgent.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv1_TestFlyingAgent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv1_TestFlyingAgent.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv1_TestWalkingAgent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv1_TestWalkingAgent.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv2_AgentCanControlLegacy.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv2_AgentCanControlLegacy.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv2_TestAgentSensor.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv2_TestAgentSensor.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/Lv3_AgentWithHp.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/Lv3_AgentWithHp.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedBehaviorTree/ATTACK_MICRO_MANAGE.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedBehaviorTree/ATTACK_MICRO_MANAGE.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedBehaviorTree/BB_RL.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedBehaviorTree/BB_RL.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedBehaviorTree/BT_RL_V2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedBehaviorTree/BT_RL_V2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedBehaviorTree/RL_CMD_IDLE_SETTING.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedBehaviorTree/RL_CMD_IDLE_SETTING.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedBehaviorTree/RL_CMD_STATE.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedBehaviorTree/RL_CMD_STATE.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedTask/ArgKeepDistanceToTargetOrLocationV3.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedTask/ArgKeepDistanceToTargetOrLocationV3.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedTask/BTService_CallingGuardLocationUpdateV2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedTask/BTService_CallingGuardLocationUpdateV2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedTask/CallChangeCmdStateToIdleV2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedTask/CallChangeCmdStateToIdleV2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedTask/CallGuardLocationUpdateV2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedTask/CallGuardLocationUpdateV2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedTask/SetFocusToTargetOrLocation.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedTask/SetFocusToTargetOrLocation.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedTask/WeaponFiringNoFinishV2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedTask/WeaponFiringNoFinishV2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefAgent/SharedTask/cancel_movementV2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefAgent/SharedTask/cancel_movementV2.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/BP_Explosion.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/BP_Explosion.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/BP_Explosion_TypeB.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/BP_Explosion_TypeB.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/Cylinder_Brush_StaticMesh.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/Cylinder_Brush_StaticMesh.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/KillZoneInvisible.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/KillZoneInvisible.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/KillZoneInvisible_Circle.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/KillZoneInvisible_Circle.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/KillZoneInvisible_Dynamic.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/AgentKillerWall/KillZoneInvisible_Dynamic.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/FlagToCapture.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/FlagToCapture.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/KeyObjDecoration.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/KeyObjDecoration.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/RecordWhoGetInside/InvisibleTrigger.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/RecordWhoGetInside/InvisibleTrigger.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/RecordWhoGetInside/InvisibleTrigger_CanEndEpisode.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/RecordWhoGetInside/InvisibleTrigger_CanEndEpisode.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/DefReqResetActor/VipTargetToReach/KeyObjExample.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/DefReqResetActor/VipTargetToReach/KeyObjExample.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/General_Laser.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/General_Laser.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/LaserForIntercept.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/LaserForIntercept.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/Weapon_Laser.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/Weapon_Laser.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/Weapon_MissileTypeC.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/Weapon_MissileTypeC.uasset -------------------------------------------------------------------------------- /Content/Assets/DefNotAgent/toy.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/DefNotAgent/toy.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/ChildMap.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/ChildMap.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/ChildMapWidget.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/ChildMapWidget.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/HpBar.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/HpBar.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/Icon_Cmd.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/Icon_Cmd.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/Icons.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/Icons.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/Icons_airport.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/Icons_airport.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/Icons_cmd.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/Icons_cmd.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/Icons_missile.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/Icons_missile.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/Icons_target.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/Icons_target.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/MouseTraceSelector.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/MouseTraceSelector.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/PlaneIcon.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/PlaneIcon.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/RingMark.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/RingMark.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/SelectEffect.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/SelectEffect.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/airport.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/airport.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/house.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/house.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/missile.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/missile.uasset -------------------------------------------------------------------------------- /Content/Assets/GUI/飞机2.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/GUI/飞机2.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/AC_Drone.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/AC_Drone.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/AC_Drone_Opp.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/AC_Drone_Opp.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/BB_Drone.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/BB_Drone.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/BT_Drone.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/BT_Drone.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/BT_Drone_Opp.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/BT_Drone_Opp.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/Drone.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/Drone.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/Drone_Ground.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/Drone_Ground.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/Drone_Ground_Opp.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/Drone_Ground_Opp.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/EndlessPatrol.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/EndlessPatrol.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/KeepDistanceToTargetOrLocation.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/KeepDistanceToTargetOrLocation.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/KeepMsFiringToTarget.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/KeepMsFiringToTarget.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/LinkingPoint.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/LinkingPoint.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/LinkingPointGroup.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/LinkingPointGroup.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/MaintainDistanceToTargetOrLocation.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/MaintainDistanceToTargetOrLocation.uasset -------------------------------------------------------------------------------- /Content/Assets/Trashbin/DroneAgentBlueprint/MissileTypeB.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Assets/Trashbin/DroneAgentBlueprint/MissileTypeB.uasset -------------------------------------------------------------------------------- /Content/Maps/AirportSwarmTraining.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/AirportSwarmTraining.umap -------------------------------------------------------------------------------- /Content/Maps/AirportSwarmTraining_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/AirportSwarmTraining_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/AutoEntry.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/AutoEntry.umap -------------------------------------------------------------------------------- /Content/Maps/Entry.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/Entry.umap -------------------------------------------------------------------------------- /Content/Maps/TestCradle.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/TestCradle.umap -------------------------------------------------------------------------------- /Content/Maps/TestCradle_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/TestCradle_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapAttackPost.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapAttackPost.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapAttackPost_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapAttackPost_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapBreakingBad.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapBreakingBad.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapBreakingBad_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapBreakingBad_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapCarrier.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapCarrier.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapCarrier_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapCarrier_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapFlagCapture.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapFlagCapture.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapFormation.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapFormation.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapIntercept.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapIntercept.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapJustAnIsland_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapJustAnIsland_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapLargeScale.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapLargeScale.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapLargeScaleLegacy.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapLargeScaleLegacy.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapLargeScale_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapLargeScale_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapPreyPredator.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapPreyPredator.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapReproduce.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapReproduce.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapReproduce_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapReproduce_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapTemplate.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapTemplate.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapTemplate_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapTemplate_BuiltData.uasset -------------------------------------------------------------------------------- /Content/Maps/UhmapWaterdrop.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapWaterdrop.umap -------------------------------------------------------------------------------- /Content/Maps/UhmapWaterdrop_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Content/Maps/UhmapWaterdrop_BuiltData.uasset -------------------------------------------------------------------------------- /Docs/2022-10-17-17-14-13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/2022-10-17-17-14-13.png -------------------------------------------------------------------------------- /Docs/2022-10-17-17-15-37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/2022-10-17-17-15-37.png -------------------------------------------------------------------------------- /Docs/2022-10-17-17-16-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/2022-10-17-17-16-09.png -------------------------------------------------------------------------------- /Docs/2022-10-17-17-30-42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/2022-10-17-17-30-42.png -------------------------------------------------------------------------------- /Docs/Demo/2023-02-12 151938.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Demo/2023-02-12 151938.jpg -------------------------------------------------------------------------------- /Docs/Demo/2023-02-12 152119.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Demo/2023-02-12 152119.jpg -------------------------------------------------------------------------------- /Docs/Demo/2023-02-12 155956.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Demo/2023-02-12 155956.jpg -------------------------------------------------------------------------------- /Docs/Demo/uhmap-bbad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Demo/uhmap-bbad.jpg -------------------------------------------------------------------------------- /Docs/Demo/uhmap-hete.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Demo/uhmap-hete.jpg -------------------------------------------------------------------------------- /Docs/Demo/uhmap-island.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Demo/uhmap-island.jpg -------------------------------------------------------------------------------- /Docs/Imgs/Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Imgs/Architecture.png -------------------------------------------------------------------------------- /Docs/Imgs/Overall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Imgs/Overall.png -------------------------------------------------------------------------------- /Docs/Imgs/Sim2RealEXP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Imgs/Sim2RealEXP.png -------------------------------------------------------------------------------- /Docs/Imgs/Sim2RealFra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/Imgs/Sim2RealFra.png -------------------------------------------------------------------------------- /Docs/git_coop.md: -------------------------------------------------------------------------------- 1 | # 如何将修改同步到远程 2 | ### 0. 首先关闭虚幻引擎! 3 | 4 | ### 1. 打开vscode,切换到git页面 5 |
6 | 7 |
8 | 9 | ### 2. 填写message,然后点击commit 10 | ### 3. 再点击sync changes,然后出现下面界面(也有可能直接顺利完成,忽略以下步骤即可) 11 |
12 | 13 |
14 |
15 | 16 |
17 | 18 | ### 4. 如果没有“Merge Changes”,再次点击提交即可,但一般都会有若干项“Merge Changes”,即和其他人发生冲突的文件,需要进行处理 19 | 20 | ### 5. 如有“Merge Changes”,打开终端 21 | 22 | #### 5-1 (确实对该文件做出过有意义的修改)如果想保存本地,无视远程文件,强行把本地文件汇入远程: 23 | 终端命令: 24 | ``` 25 | git checkout --ours /path/to/file 26 | git add /path/to/file 27 | ``` 28 | 在此例子中, 29 | ``` 30 | git checkout --ours Content\Assets\DefAction\ParseAction.uasset 31 | git add Content\Assets\DefAction\ParseAction.uasset 32 | ``` 33 | #### 5-2 (无意修改此文件,或该文件属于其他人的管辖范围)如果想覆盖本地文件,采纳远程文件: 34 | 终端命令: 35 | ``` 36 | git checkout --theirs /path/to/file 37 | git add /path/to/file 38 | ``` 39 | 在此例子中, 40 | ``` 41 | git checkout --theirs Content\Assets\DefAction\ParseAction.uasset 42 | git add Content\Assets\DefAction\ParseAction.uasset 43 | ``` 44 | 45 | 46 | ### 6. 再次点击Commit,完成流程 47 | -------------------------------------------------------------------------------- /Docs/old_install_method/Docs/UHMP_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/old_install_method/Docs/UHMP_1.png -------------------------------------------------------------------------------- /Docs/old_install_method/Docs/UHMP_window.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/old_install_method/Docs/UHMP_window.jpg -------------------------------------------------------------------------------- /Docs/old_install_method/Docs/vs_install2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/old_install_method/Docs/vs_install2.png -------------------------------------------------------------------------------- /Docs/old_install_method/Docs/vscode_install.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/old_install_method/Docs/vscode_install.jpg -------------------------------------------------------------------------------- /Docs/old_install_method/README.md: -------------------------------------------------------------------------------- 1 | # UHMAP 2 | 3 | Developed with Unreal Engine 4 4 | 5 | # How to install | 如何安装自定义版本的虚幻引擎 6 | 另见视频: 7 | https://ageasga-my.sharepoint.com/:v:/g/personal/fuqingxu_yiteam_tech/EawfqsV2jF5Nsv3KF7X1-woBH-VTvELL6FSRX4cIgUboLg?e=Vmp67E 8 | 9 | ## 1. 下载 Visual Studio Community 10 | 11 | https://visualstudio.microsoft.com/zh-hans/ 12 | 13 | ## 2. 安装 Visual Studio Community 14 | 15 |
16 | 17 |
18 |
19 | 20 |
21 | 需要至少安装C++的桌面开发和C++的游戏开发两部分,安装版本见截图;另需安装.NET框架,版本为4.6.2 22 | 23 | ## 3. 下载虚幻引擎源代码 (非官方,修改过源码) 24 | 25 | https://ageasga-my.sharepoint.com/:u:/g/personal/fuqingxu_yiteam_tech/Ee3lQrUjKNFMjPITm5G-hEgBbeEN6dMOPtKP9ssgONKJcA?e=BavOoJ 26 | 27 | ## 4. 编译虚幻引擎 28 | 1. 解压源代码(到至少150GB空间的磁盘) 29 | 30 | 1. Open your source folder in Explorer and run **Setup.bat**. 31 | This will download binary content for the engine, as well as installing prerequisites and setting up Unreal file associations. 32 | On Windows 8, a warning from SmartScreen may appear. Click "More info", then "Run anyway" to continue. 运行**Setup.bat** 33 | 34 | A clean download of the engine binaries is currently 3-4gb, which may take some time to complete. 35 | Subsequent checkouts only require incremental downloads and will be much quicker. 需要一段时间 36 | 37 | 1. Run **GenerateProjectFiles.bat** to create project files for the engine. It should take less than a minute to complete. 运行 **GenerateProjectFiles.bat** 38 | 39 | 1. Load the project into Visual Studio by double-clicking on the **UE4.sln** file. Set your solution configuration to **Development Editor** and your solution 40 | platform to **Win64**, then right click on the **UE4** target and select **Build**. It may take anywhere between 10 and 40 minutes to finish compiling, depending on your system specs. 打开**UE4.sln**,界面顶部的项目配置为**Development Editor** 和 **Win64**, 右击界面右侧菜单的**UE4**,点击**Build**,需要20分钟~1小时时间编译(配置好后,点选界面上面栏目中的生成Build,点击生成UE4) 41 | 42 | 43 | 44 | 1. 右键点击项目工程文件夹中的UHMP.uproject,按照图示选择虚幻引擎版本为4.27.2-release,进行初步生成项目的操作;之后打开UHMP.sln,将界面顶部的项目配置为**Development Editor** 和 **Win64**,点选右侧资源管理器中的UHMP,再点击界面顶部的生成-->生成UHMP;完成后双击UHMP.uproject打开工程项目 45 | 46 |
47 | 48 |
49 | 50 | 6. 成功打开的虚幻编辑器加载界面应当如下图所示 51 | 52 |
53 | 54 |
-------------------------------------------------------------------------------- /Docs/unreal-island.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/unreal-island.jpg -------------------------------------------------------------------------------- /Docs/vscode_install.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/Docs/vscode_install.jpg -------------------------------------------------------------------------------- /Please_Run_This_First_To_Fetch_Big_Files.py: -------------------------------------------------------------------------------- 1 | import os, commentjson, shutil, subprocess, tqdm, shutil 2 | import zipfile 3 | from modelscope import snapshot_download 4 | try: os.makedirs('./TEMP') 5 | except: pass 6 | 7 | version = 'unreal-map-v3.4' 8 | model_dir = snapshot_download(f'BinaryHusky/{version}') 9 | zip_file_path = f'./TEMP/{version}.zip' 10 | 11 | def combine_file(model_dir, output_file_path, num_parts): 12 | with open(output_file_path, 'wb') as output_file: 13 | for i in range(0, num_parts): 14 | part_file_path = os.path.join(model_dir, "tensor", f"safetensor_{i+1}.pt") 15 | with open(part_file_path, 'rb') as part_file: 16 | output_file.write(part_file.read()) 17 | 18 | extract_to_path = './' 19 | combine_file(model_dir, output_file_path=zip_file_path, num_parts=5) 20 | 21 | # 打开 ZIP 文件 22 | with zipfile.ZipFile(zip_file_path, 'r') as zip_ref: 23 | # 解压所有文件到指定目录 24 | zip_ref.extractall(extract_to_path) 25 | print(f"files unzipped {extract_to_path}") 26 | 27 | print("everything is ready!") 28 | -------------------------------------------------------------------------------- /PythonExample/README.md: -------------------------------------------------------------------------------- 1 | This demo program can connect to developing/compiled U-MAP environment to debug your simulation. 2 | 3 | This program is a copy of another resp: https://github.com/binary-husky/hmp2g 4 | 5 | 6 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-detectable=false 2 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "THIRDPARTY/pymarl2/pymarl2src"] 2 | path = THIRDPARTY/pymarl2/pymarl2src 3 | url = https://github.com/binary-husky/pymarl-hmap-compat.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/alg_base.py: -------------------------------------------------------------------------------- 1 | import os, time, torch, traceback 2 | import numpy as np 3 | from config import GlobalConfig 4 | from UTIL.colorful import * 5 | 6 | class AlgorithmBase(): 7 | def __init__(self, n_agent, n_thread, space, mcv=None, team=None): 8 | self.n_thread = n_thread 9 | self.n_agent = n_agent 10 | self.team = team 11 | self.act_space = space['act_space'] 12 | self.obs_space = space['obs_space'] 13 | self.ScenarioConfig = GlobalConfig.ScenarioConfig 14 | self.mcv = mcv 15 | self.device = GlobalConfig.device 16 | 17 | def interact_with_env(self, team_intel): 18 | raise NotImplementedError 19 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/dl_pool.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author: Fu Qingxu,CASIA 3 | Description: deep learning sample manager 4 | 5 | """ 6 | import torch 7 | import numpy as np 8 | 9 | class DeepLearningPool(object): 10 | def __init__(self, pool_size, batch_size) -> None: 11 | super().__init__() 12 | self.x_batch = None 13 | self.y_batch = None 14 | self.size = pool_size 15 | self.batch_size = batch_size 16 | 17 | 18 | 19 | def add_and_sample(self, x, y): 20 | n_sample = x.shape[0] 21 | assert n_sample > 0 22 | if self.x_batch is None: 23 | self.x_batch = np.zeros(shape=(self.size, *x.shape[1:]), dtype=x.dtype) 24 | self.y_batch = np.zeros(shape=(self.size, *y.shape[1:]), dtype=y.dtype) 25 | self.current_idx = 0 26 | self.current_size = 0 27 | idx = self._get_storage_idx(n_sample) 28 | self.x_batch[idx] = x 29 | self.y_batch[idx] = y 30 | return self._sample() 31 | 32 | 33 | def _get_storage_idx(self, inc=None): 34 | inc = inc or 1 35 | if self.current_idx + inc <= self.size: 36 | idx = np.arange(self.current_idx, self.current_idx + inc) 37 | self.current_idx += inc 38 | elif self.current_idx < self.size: 39 | overflow = inc - (self.size - self.current_idx) 40 | idx_a = np.arange(self.current_idx, self.size) 41 | idx_b = np.arange(0, overflow) 42 | idx = np.concatenate([idx_a, idx_b]) 43 | self.current_idx = overflow 44 | else: 45 | idx = np.arange(0, inc) 46 | self.current_idx = inc 47 | self.current_size = min(self.size, self.current_size + inc) 48 | if inc == 1: 49 | idx = idx[0] 50 | return idx 51 | 52 | def _sample(self): 53 | idx = np.random.randint(0, self.current_size, self.batch_size) 54 | return self.x_batch[idx], self.y_batch[idx] 55 | 56 | 57 | if __name__ == '__main__': 58 | dlp = DeepLearningPool(10, 7) 59 | res = dlp.add_and_sample(x=np.random.rand(2,2,3),y=np.array([1,2])) 60 | print(dlp.y_batch,'res',res[1]) 61 | res = dlp.add_and_sample(x=np.random.rand(4,2,3),y=np.array([3,4,5,6])) 62 | print(dlp.y_batch,'res',res[1]) 63 | res = dlp.add_and_sample(x=np.random.rand(3,2,3),y=np.array([7,8,9])) 64 | print(dlp.y_batch,'res',res[1]) 65 | res = dlp.add_and_sample(x=np.random.rand(3,2,3),y=np.array([10,11,12])) 66 | print(dlp.y_batch,'res',res[1]) 67 | res = dlp.add_and_sample(x=np.random.rand(3,2,3),y=np.array([13,14,15])) 68 | print(dlp.y_batch,'res',res[1]) 69 | res = dlp.add_and_sample(x=np.random.rand(3,2,3),y=np.array([16,17,18])) 70 | print(dlp.y_batch,'res',res[1]) 71 | print('end of test') 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/his.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import numpy as np 3 | import matplotlib 4 | 5 | # 设置matplotlib正常显示中文和负号 6 | matplotlib.rcParams['font.sans-serif']=['SimHei'] # 用黑体显示中文 7 | matplotlib.rcParams['axes.unicode_minus']=False # 正常显示负号 8 | # 随机生成(10000,)服从正态分布的数据 9 | data = np.random.randn(10000) 10 | """ 11 | 绘制直方图 12 | data:必选参数,绘图数据 13 | bins:直方图的长条形数目,可选项,默认为10 14 | normed:是否将得到的直方图向量归一化,可选项,默认为0,代表不归一化,显示频数。normed=1,表示归一化,显示频率。 15 | facecolor:长条形的颜色 16 | edgecolor:长条形边框的颜色 17 | alpha:透明度 18 | """ 19 | plt.hist(data, bins=40, facecolor="blue", edgecolor="black", alpha=0.7) 20 | # 显示横轴标签 21 | plt.xlabel("区间") 22 | # 显示纵轴标签 23 | plt.ylabel("频数/频率") 24 | # 显示图标题 25 | plt.title("频数/频率分布直方图") 26 | plt.show() 27 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/logit2act.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | import torch.nn.functional as F 4 | from torch.distributions.categorical import Categorical 5 | from UTIL.tensor_ops import my_view, Args2tensor_Return2numpy, Args2tensor 6 | from UTIL.tensor_ops import pt_inf 7 | 8 | 9 | 10 | """ 11 | network initialize 12 | """ 13 | class Logit2Act(nn.Module): 14 | def __init__(self, *args, **kwargs): 15 | super().__init__() 16 | 17 | def _logit2act_rsn(self, logits_agent_cluster, eval_mode, greedy, eval_actions=None, avail_act=None, eprsn=None): 18 | if avail_act is not None: logits_agent_cluster = torch.where(avail_act>0, logits_agent_cluster, -pt_inf()) 19 | act_dist = self.ccategorical.feed_logits(logits_agent_cluster) 20 | 21 | if not greedy: act = self.ccategorical.sample(act_dist, eprsn) if not eval_mode else eval_actions 22 | else: act = torch.argmax(act_dist.probs, axis=2) 23 | # the policy gradient loss will feedback from here 24 | actLogProbs = self._get_act_log_probs(act_dist, act) 25 | # sum up the log prob of all agents 26 | distEntropy = act_dist.entropy().mean(-1) if eval_mode else None 27 | return act, actLogProbs, distEntropy, act_dist.probs 28 | 29 | def _logit2act(self, logits_agent_cluster, eval_mode, greedy, eval_actions=None, avail_act=None, **kwargs): 30 | if avail_act is not None: logits_agent_cluster = torch.where(avail_act>0, logits_agent_cluster, -pt_inf()) 31 | act_dist = Categorical(logits = logits_agent_cluster) 32 | if not greedy: act = act_dist.sample() if not eval_mode else eval_actions 33 | else: act = torch.argmax(act_dist.probs, axis=2) 34 | actLogProbs = self._get_act_log_probs(act_dist, act) # the policy gradient loss will feedback from here 35 | # sum up the log prob of all agents 36 | distEntropy = act_dist.entropy().mean(-1) if eval_mode else None 37 | return act, actLogProbs, distEntropy, act_dist.probs 38 | 39 | @staticmethod 40 | def _get_act_log_probs(distribution, action): 41 | return distribution.log_prob(action.squeeze(-1)).unsqueeze(-1) 42 | 43 | 44 | @Args2tensor_Return2numpy 45 | def act(self, *args, **kargs): 46 | return self._act(*args, **kargs) 47 | 48 | @Args2tensor 49 | def evaluate_actions(self, *args, **kargs): 50 | return self._act(*args, **kargs, eval_mode=True) 51 | 52 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/mlp.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | import torch.nn.functional as F 4 | from .norm import DynamicNorm 5 | 6 | class SimpleMLP(nn.Module): 7 | def __init__(self, in_dim, out_dim, hidden_dim=128, use_normalization=False): 8 | super().__init__() 9 | activation_func = nn.ReLU 10 | h_dim = hidden_dim 11 | if use_normalization: 12 | print('test DynamicNorm') 13 | self.mlp = nn.Sequential( 14 | DynamicNorm(in_dim, only_for_last_dim=True, exclude_one_hot=True), 15 | nn.Linear(in_dim, h_dim), 16 | activation_func(inplace=True), 17 | nn.Linear(h_dim, out_dim) 18 | ) 19 | else: 20 | self.mlp = nn.Sequential( 21 | nn.Linear(in_dim, h_dim), 22 | activation_func(inplace=True), 23 | nn.Linear(h_dim, out_dim) 24 | ) 25 | def forward(self,x): 26 | return self.mlp(x) 27 | 28 | class ResLinear(nn.Module): 29 | def __init__(self, io_dim, h_dim, need_input_tf=False, input_tf_dim=None, inplace_relu=True) -> None: 30 | super(ResLinear, self).__init__() 31 | self.need_input_tf = need_input_tf 32 | if need_input_tf: 33 | self.f0 = nn.Linear(input_tf_dim, io_dim) 34 | self.f1 = nn.Linear(io_dim, h_dim) 35 | self.lkrelu = nn.ReLU(inplace=True) if inplace_relu else nn.ReLU(inplace=False) 36 | self.f2 = nn.Linear(h_dim, io_dim) 37 | 38 | def forward(self, xo): 39 | if self.need_input_tf: 40 | xo = self.f0(xo) 41 | x = self.lkrelu(self.f1(xo)) 42 | x = self.f2(x) + xo 43 | x = self.lkrelu(x) 44 | return x 45 | 46 | class LinearFinal(nn.Module): 47 | 48 | __constants__ = ['in_features', 'out_features'] 49 | in_features: int 50 | out_features: int 51 | weight: torch.Tensor 52 | 53 | def __init__(self, in_features: int, out_features: int, bias: bool = True) -> None: 54 | super(LinearFinal, self).__init__() 55 | self.in_features = in_features 56 | self.out_features = out_features 57 | self.weight = nn.Parameter(torch.Tensor(out_features, in_features)) 58 | if bias: 59 | self.bias = nn.Parameter(torch.Tensor(out_features)) 60 | else: 61 | self.register_parameter('bias', None) 62 | 63 | def forward(self, input: torch.Tensor) -> torch.Tensor: 64 | return F.linear(input, self.weight, self.bias) 65 | 66 | def extra_repr(self) -> str: 67 | return 'in_features={}, out_features={}, bias={}'.format( 68 | self.in_features, self.out_features, self.bias is not None 69 | ) -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/net_manifest.py: -------------------------------------------------------------------------------- 1 | 2 | import torch.nn as nn 3 | def weights_init(m): 4 | def init_Linear(m, final_layer=False): 5 | nn.init.orthogonal_(m.weight.data) 6 | if final_layer:nn.init.orthogonal_(m.weight.data, gain=0.01) 7 | if m.bias is not None: nn.init.uniform_(m.bias.data, a=-0.02, b=0.02) 8 | 9 | initial_fn_dict = { 10 | 'Net': None, 11 | 'NetCentralCritic': None, 12 | 'DataParallel':None, 13 | 'BatchNorm1d':None, 14 | 'Concentration':None, 15 | 'ConcentrationHete':None, 16 | 'Pnet':None, 17 | 'Sequential':None, 18 | 'DataParallel':None, 19 | 'Tanh':None, 20 | 'ModuleList':None, 21 | 'ModuleDict':None, 22 | 'MultiHeadAttention':None, 23 | 'SimpleMLP':None, 24 | 'SimpleAttention':None, 25 | 'SelfAttention_Module':None, 26 | 'ReLU':None, 27 | 'Softmax':None, 28 | 'DynamicNorm':None, 29 | 'DynamicNormFix':None, 30 | 'EXTRACT':None, 31 | 'LinearFinal':lambda m:init_Linear(m, final_layer=True), 32 | 'Linear':init_Linear, 33 | 'ResLinear':None, 34 | 'LeakyReLU':None, 35 | 'HyperNet':None, 36 | 'MyHyperNet':None, 37 | 'DivTree':None, 38 | } 39 | 40 | classname = m.__class__.__name__ 41 | assert classname in initial_fn_dict.keys(), ('how to handle the initialization of this class? ', classname) 42 | init_fn = initial_fn_dict[classname] 43 | if init_fn is None: return 44 | init_fn(m) 45 | 46 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/pca.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | def pca(samples, target_dim): 4 | assert len(samples.shape) == 2 5 | data = samples - np.mean(samples,axis=0) # mean at batch dim 6 | covMat = np.cov(data,rowvar=0) 7 | fValue,fVector = np.linalg.eig(covMat) 8 | fValueSort = np.argsort(-fValue) 9 | fValueTopN = fValueSort[:target_dim] 10 | fvectormat = fVector[:,fValueTopN] 11 | down_dim_data = np.dot(data, fvectormat) 12 | return down_dim_data -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/common/traj_manager.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/ALGORITHM/common/traj_manager.py -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/example_foundation.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import copy 3 | import math 4 | import random 5 | 6 | class ExampleFoundation(): 7 | def __init__(self, n_agent, n_thread, space, mcv=None, team=None): 8 | self.n_thread = n_thread 9 | self.n_agent = n_agent 10 | self.handler = [None for _ in range(self.n_thread)] 11 | 12 | def interact_with_env(self, team_intel): 13 | info = team_intel['Latest-Team-Info'] 14 | done = team_intel['Env-Suffered-Reset'] 15 | step_cnt = team_intel['Current-Obs-Step'] 16 | action_list = np.zeros(shape=(self.n_agent, self.n_thread, 1)) 17 | return action_list, team_intel 18 | 19 | 20 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/hete_league_onenet_fix/cython_func.pyx: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | cimport numpy as np 3 | cimport cython 4 | from cython.parallel import prange 5 | np.import_array() 6 | ctypedef fused DTYPE_t: 7 | np.float32_t 8 | np.float64_t 9 | 10 | ctypedef fused DTYPE_intlong_t: 11 | np.int64_t 12 | np.int32_t # to compat Windows 13 | 14 | ctypedef np.uint8_t DTYPE_bool_t 15 | 16 | 17 | @cython.boundscheck(False) 18 | @cython.wraparound(False) 19 | @cython.nonecheck(False) 20 | def roll_hisory( DTYPE_t[:,:,:,:] obs_feed_new, 21 | DTYPE_t[:,:,:,:] prev_obs_feed, 22 | DTYPE_bool_t[:,:,:] valid_mask, 23 | DTYPE_intlong_t[:,:] N_valid, 24 | DTYPE_t[:,:,:,:] next_his_pool): 25 | # how many threads 26 | cdef Py_ssize_t vmax = N_valid.shape[0] 27 | # how many agents 28 | cdef Py_ssize_t wmax = N_valid.shape[1] 29 | # how many entity subjects (including self @0) 30 | cdef Py_ssize_t max_obs_entity = obs_feed_new.shape[2] 31 | cdef int n_v, th, a, t, k, pointer 32 | for th in prange(vmax, nogil=True): 33 | # for each thread range -> prange 34 | for a in prange(wmax): 35 | # for each agent 36 | pointer = 0 37 | # step 1 fill next_his_pool[0 ~ (nv-1)] with obs_feed_new[0 ~ max_obs_entity-1] 38 | for k in range(max_obs_entity): 39 | if valid_mask[th,a,k]: 40 | next_his_pool[th, a, pointer] = obs_feed_new[th,a,k] 41 | pointer = pointer + 1 42 | 43 | # step 2 fill next_his_pool[nv ~ (max_obs_entity-1)] with prev_obs_feed[0 ~ (max_obs_entity-1-nv)] 44 | n_v = N_valid[th,a] 45 | for k in range(n_v, max_obs_entity): 46 | next_his_pool[th,a,k] = prev_obs_feed[th,a,k-n_v] 47 | return np.asarray(next_his_pool) -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/hete_league_onenet_fix/hete_assignment.py: -------------------------------------------------------------------------------- 1 | import copy 2 | import numpy as np 3 | from UTIL.tensor_ops import my_view, __hash__, repeat_at, gather_righthand 4 | from .foundation import AlgorithmConfig 5 | 6 | 7 | 8 | def random_group(random_select_fn, n_thread, hete_type, n_hete_types, n_group, selected_tps, testing): 9 | n_agent = hete_type.shape[-1] 10 | group_sel_arr = np.zeros(shape=(n_thread, n_agent), dtype=int) 11 | gp_sel_summary = [] 12 | for i in range(n_thread): 13 | group_assignment = np.array([ 14 | random_select_fn(testing) 15 | if type not in selected_tps[i] else 0 16 | for type in range(n_hete_types) 17 | ]) 18 | assert (group_assignment[selected_tps[i]]==0).all() 19 | gp_sel_summary.append(copy.deepcopy(group_assignment)) 20 | for ht, group in enumerate(group_assignment): 21 | mask = (hete_type == ht) 22 | group_sel_arr[i,mask] = group 23 | return group_sel_arr, np.stack(gp_sel_summary).astype(np.int64) 24 | 25 | 26 | 27 | 28 | def select_nets_for_shellenv(n_types, policy, hete_type_list, n_thread, n_gp, testing): 29 | if (not testing) or (AlgorithmConfig.policy_matrix_testing): 30 | n_alive_frontend = AlgorithmConfig.hete_n_alive_frontend 31 | tmp = np.arange(n_types) 32 | # select types to use frontier 33 | if not AlgorithmConfig.type_sel_override: 34 | selected_types = np.stack([ 35 | np.random.choice( 36 | a=tmp, 37 | size=(n_alive_frontend), 38 | replace=False, 39 | p=None) 40 | for _ in range(n_thread) 41 | ]) 42 | else: 43 | selected_types = np.stack([ 44 | AlgorithmConfig.type_sel_override_list 45 | for _ in range(n_thread) 46 | ]) 47 | else: 48 | # testing but not policy_matrix_testing: select all types to use frontier 49 | selected_types = np.stack([np.arange(n_types) for _ in range(n_thread)]) 50 | 51 | # generate a random group selection array 52 | if not AlgorithmConfig.policy_matrix_testing: 53 | random_select_fn = policy.random_select 54 | else: 55 | random_select_fn = policy.random_select_matrix_test 56 | 57 | group_sel_arr, gp_sel_summary = random_group( 58 | random_select_fn=random_select_fn, n_thread=n_thread, hete_type=hete_type_list, 59 | n_hete_types=n_types, n_group=n_gp, selected_tps=selected_types, testing=testing) 60 | # group to net index 61 | n_tp = n_types 62 | get_placeholder = lambda type, group: group*n_tp + type 63 | hete_type_arr = repeat_at(hete_type_list, 0, n_thread) 64 | selected_nets = get_placeholder(type=hete_type_arr, group=group_sel_arr) 65 | 66 | return selected_nets, gp_sel_summary 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/my_ai/foundation.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from UTIL.colorful import * 3 | from UTIL.tensor_ops import my_view, __hash__ 4 | from config import GlobalConfig 5 | from MISSION.uhmap.actionset import strActionToDigits, ActDigitLen 6 | class AlgorithmConfig: 7 | preserve = '' 8 | 9 | 10 | 11 | class ReinforceAlgorithmFoundation(object): 12 | def __init__(self, n_agent, n_thread, space, mcv=None, team=None): 13 | self.n_agent = n_agent 14 | self.n_thread = n_thread 15 | self.space = space 16 | self.mcv = mcv 17 | 18 | def interact_with_env(self, StateRecall): 19 | obs = StateRecall['Latest-Obs'] 20 | P = StateRecall['ENV-PAUSE'] 21 | active_thread_obs = obs[~P] 22 | actions = np.zeros(shape=(self.n_thread, self.n_agent, ActDigitLen)) 23 | 24 | for env_index in range(self.n_thread): 25 | for agent_index in range(self.n_agent): 26 | if np.random.rand() < 0.5: 27 | color_index = np.random.randint(low=0, high=4) 28 | actions[env_index, agent_index] = strActionToDigits(f'ActionSetDemo::ChangeColor;{color_index}') 29 | else: 30 | uid = 11 if agent_index % 2 == 0 else 10 31 | actions[env_index, agent_index] = strActionToDigits(f'ActionSetDemo::FireToWaterdrop;{uid}') 32 | 33 | 34 | StateRecall['_hook_'] = None 35 | return actions, StateRecall 36 | 37 | 38 | 39 | 40 | class DiscreteRLFoundation(object): 41 | def __init__(self, n_agent, n_thread, space, mcv=None, team=None): 42 | self.n_agent = n_agent 43 | self.n_thread = n_thread 44 | self.space = space 45 | self.mcv = mcv 46 | self.action_list = [ 47 | strActionToDigits('ActionSetDemo::ChangeColor;0'), 48 | strActionToDigits('ActionSetDemo::ChangeColor;1'), 49 | strActionToDigits('ActionSetDemo::ChangeColor;2'), 50 | strActionToDigits('ActionSetDemo::ChangeColor;3'), 51 | strActionToDigits('ActionSetDemo::FireToWaterdrop;10'), 52 | strActionToDigits('ActionSetDemo::FireToWaterdrop;11'), 53 | strActionToDigits('ActionSetDemo::MoveToDirection;X=1.0 Y=0.0 Z=0.0'), 54 | strActionToDigits('ActionSetDemo::MoveToDirection;X=1.0 Y=1.0 Z=0.0'), 55 | strActionToDigits('ActionSetDemo::MoveToDirection;X=0.0 Y=1.0 Z=0.0'), 56 | strActionToDigits('ActionSetDemo::MoveToDirection;X=-1.0 Y=1.0 Z=0.0'), 57 | strActionToDigits('ActionSetDemo::MoveToDirection;X=-1.0 Y=0.0 Z=0.0'), 58 | strActionToDigits('ActionSetDemo::MoveToDirection;X=-1.0 Y=-1.0 Z=0.0'), 59 | strActionToDigits('ActionSetDemo::MoveToDirection;X=0.0 Y=-1.0 Z=0.0'), 60 | strActionToDigits('ActionSetDemo::MoveToDirection;X=1.0 Y=-1.0 Z=0.0'), 61 | strActionToDigits('ActionSetDemo::MoveToDirection;X=0.0 Y=0.0 Z=1.0'), 62 | strActionToDigits('ActionSetDemo::MoveToDirection;X=0.0 Y=0.0 Z=-1.0'), 63 | ] 64 | self.how_many_actions = len(self.action_list) 65 | 66 | def interact_with_env(self, StateRecall): 67 | obs = StateRecall['Latest-Obs'] 68 | P = StateRecall['ENV-PAUSE'] 69 | active_thread_obs = obs[~P] 70 | actions = np.zeros(shape=(self.n_thread, self.n_agent, ActDigitLen)) 71 | 72 | for env_index in range(self.n_thread): 73 | for agent_index in range(self.n_agent): 74 | action_x = np.random.randint(low=0,high=self.how_many_actions) 75 | actions[env_index, agent_index] = self.action_list[action_x] 76 | 77 | 78 | StateRecall['_hook_'] = None 79 | return actions, StateRecall 80 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/ppo_ma/cython_func.pyx: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | cimport numpy as np 3 | cimport cython 4 | from cython.parallel import prange 5 | np.import_array() 6 | ctypedef fused DTYPE_float: 7 | np.float32_t 8 | np.float64_t 9 | ctypedef fused DTYPE_int64_t: 10 | np.int64_t 11 | np.int32_t # to compat Windows 12 | ctypedef np.uint8_t DTYPE_bool_t 13 | 14 | 15 | @cython.boundscheck(False) 16 | @cython.wraparound(False) 17 | @cython.nonecheck(False) 18 | def roll_hisory( DTYPE_float[:,:,:,:] obs_feed_new, 19 | DTYPE_float[:,:,:,:] prev_obs_feed, 20 | DTYPE_bool_t[:,:,:] valid_mask, 21 | DTYPE_int64_t[:,:] N_valid, 22 | DTYPE_float[:,:,:,:] next_his_pool): 23 | # how many threads 24 | cdef Py_ssize_t vmax = N_valid.shape[0] 25 | # how many agents 26 | cdef Py_ssize_t wmax = N_valid.shape[1] 27 | # how many entity subjects (including self @0) 28 | cdef Py_ssize_t max_obs_entity = obs_feed_new.shape[2] 29 | cdef int n_v, th, a, t, k, pointer 30 | for th in prange(vmax, nogil=True): 31 | # for each thread range -> prange 32 | for a in prange(wmax): 33 | # for each agent 34 | pointer = 0 35 | # step 1 fill next_his_pool[0 ~ (nv-1)] with obs_feed_new[0 ~ max_obs_entity-1] 36 | for k in range(max_obs_entity): 37 | if valid_mask[th,a,k]: 38 | next_his_pool[th,a, pointer] = obs_feed_new[th,a, k] 39 | pointer = pointer + 1 40 | 41 | # step 2 fill next_his_pool[nv ~ (max_obs_entity-1)] with prev_obs_feed[0 ~ (max_obs_entity-1-nv)] 42 | n_v = N_valid[th,a] 43 | for k in range(n_v, max_obs_entity): 44 | next_his_pool[th,a, k] = prev_obs_feed[th,a, k-n_v] 45 | return np.asarray(next_his_pool) 46 | 47 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/script_ai/a_attackpost.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from UTIL.colorful import * 3 | from UTIL.tensor_ops import my_view, __hash__ 4 | from config import GlobalConfig 5 | from MISSION.uhmap.actionset_v3 import strActionToDigits, ActDigitLen 6 | 7 | class AlgorithmConfig: 8 | preserve = '' 9 | 10 | class DummyAlgorithmBase(): 11 | def __init__(self, n_agent, n_thread, space, mcv=None, team=None): 12 | self.n_agent = n_agent 13 | self.n_thread = n_thread 14 | self.ScenarioConfig = GlobalConfig.ScenarioConfig 15 | self.attack_order = {} 16 | self.team = team 17 | 18 | def forward(self, inp, state, mask=None): 19 | raise NotImplementedError 20 | 21 | def to(self, device): 22 | return self 23 | 24 | def interact_with_env(self, State_Recall): 25 | assert State_Recall['Latest-Obs'] is not None, ('make sure obs is ok') 26 | 27 | ENV_PAUSE = State_Recall['ENV-PAUSE'] 28 | ENV_ACTIVE = ~ENV_PAUSE 29 | 30 | assert self.n_thread == len(ENV_ACTIVE), ('the number of thread is wrong?') 31 | 32 | n_active_thread = sum(ENV_ACTIVE) 33 | 34 | # assert len(State_Recall['Latest-Obs']) == n_active_thread, ('make sure we have the right batch of obs') 35 | actions = np.zeros(shape=(self.n_thread, self.n_agent, ActDigitLen)) 36 | 37 | # set actions of in-active threads to NaN (will be done again in multi_team.py, this line is not necessary) 38 | actions[ENV_PAUSE] = np.nan 39 | 40 | # swap (self.n_thread, self.n_agent) -> (self.n_agent, self.n_thread) 41 | actions = np.swapaxes(actions, 0, 1) 42 | return actions, {} 43 | 44 | class AttackPostPreprogramBaseline(DummyAlgorithmBase): 45 | def interact_with_env(self, State_Recall): 46 | assert State_Recall['Latest-Obs'] is not None, ('make sure obs is ok') 47 | ENV_PAUSE = State_Recall['ENV-PAUSE'] 48 | ENV_ACTIVE = ~ENV_PAUSE 49 | assert self.n_thread == len(ENV_ACTIVE), ('the number of thread is wrong?') 50 | 51 | n_active_thread = sum(ENV_ACTIVE) 52 | AirCarrierUID = 2 53 | 54 | # assert len(State_Recall['Latest-Obs']) == n_active_thread, ('make sure we have the right batch of obs') 55 | 56 | actions = np.zeros(shape=(self.n_thread, self.n_agent, ActDigitLen)) 57 | self_agent_uid_range = GlobalConfig.ScenarioConfig.AGENT_ID_EACH_TEAM[self.team] 58 | 59 | for thread in range(self.n_thread): 60 | if ENV_PAUSE[thread]: 61 | # 如果,该线程停止,不做任何处理 62 | continue 63 | x_arr = np.array([d['agentLocationArr'][0] for d in np.array(State_Recall['Latest-Team-Info'][thread]['dataArr'])[self_agent_uid_range]]) 64 | x_arr_valid = np.array([x for x in x_arr if np.isfinite(x)]) 65 | x_avg = x_arr_valid.mean() 66 | for index, x in enumerate(x_arr): 67 | if not np.isfinite(x): pass 68 | 69 | if x > x_avg-1000: 70 | actions[thread, index] = strActionToDigits(f'ActionSet2::SpecificAttacking;T1-0') 71 | else: 72 | actions[thread, index] = strActionToDigits(f'ActionSet2::Idle;DynamicGuard') 73 | 74 | # actions[thread, :] = strActionToDigits(f'ActionSet2::SpecificAttacking;T1-0') 75 | 76 | # set actions of in-active threads to NaN (will be done again in multi_team.py, this line is not necessary) 77 | actions[ENV_PAUSE] = np.nan 78 | return actions, {} -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/script_ai/dummy.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from UTIL.tensor_ops import copy_clone 3 | 4 | class DummyAlgConfig(): 5 | reserve = "" 6 | 7 | class DummyAlgorithmBase(): 8 | def __init__(self, n_agent, n_thread, space, mcv=None, team=None): 9 | from config import GlobalConfig 10 | self.n_agent = n_agent 11 | self.n_thread = n_thread 12 | self.ScenarioConfig = GlobalConfig.ScenarioConfig 13 | 14 | def forward(self, inp, state, mask=None): 15 | raise NotImplementedError 16 | 17 | def to(self, device): 18 | return self 19 | 20 | def interact_with_env(self, State_Recall): 21 | assert State_Recall['Latest-Obs'] is not None, ('make sure obs is ok') 22 | 23 | ENV_PAUSE = State_Recall['ENV-PAUSE'] 24 | ENV_ACTIVE = ~ENV_PAUSE 25 | 26 | assert self.n_thread == len(ENV_ACTIVE), ('the number of thread is wrong?') 27 | 28 | n_active_thread = sum(ENV_ACTIVE) 29 | 30 | assert len(State_Recall['Latest-Obs']) == n_active_thread, ('make sure we have the right batch of obs') 31 | 32 | actions = np.zeros(shape=(self.n_thread, self.n_agent)) 33 | 34 | # set actions of in-active threads to NaN (will be done again in multi_team.py, this line is not necessary) 35 | actions[ENV_PAUSE] = np.nan 36 | 37 | # swap (self.n_thread, self.n_agent) -> (self.n_agent, self.n_thread) 38 | actions = np.swapaxes(actions, 0, 1) 39 | return actions, {} 40 | 41 | 42 | class DummyAlgorithm(DummyAlgorithmBase): 43 | def interact_with_env(self, State_Recall): 44 | assert State_Recall['Latest-Obs'] is not None, ('make sure obs is ok') 45 | 46 | ENV_PAUSE = State_Recall['ENV-PAUSE'] 47 | ENV_ACTIVE = ~ENV_PAUSE 48 | 49 | assert self.n_thread == len(ENV_ACTIVE), ('the number of thread is wrong?') 50 | 51 | n_active_thread = sum(ENV_ACTIVE) 52 | 53 | assert len(State_Recall['Latest-Obs']) == n_active_thread, ('make sure we have the right batch of obs') 54 | 55 | actions = np.zeros(shape=(self.n_thread, self.n_agent, 4)) 56 | 57 | env0_step = State_Recall['Current-Obs-Step'] 58 | if env0_step%2==0: 59 | actions[..., 0] = 1 # AT 60 | for i in range(5): actions[:, i, 1] = i # TT 61 | actions[..., 2] = 0 # HT 62 | actions[..., 3] = 0 # SP 63 | else: 64 | actions[..., 0] = 5 # AT 65 | for i in range(5): actions[:, i, 1] = i # TT 66 | actions[..., 2] = 0 # HT 67 | actions[..., 3] = 0 # SP 68 | 69 | # set actions of in-active threads to NaN (will be done again in multi_team.py, this line is not necessary) 70 | actions[ENV_PAUSE] = np.nan 71 | 72 | # swap (self.n_thread, self.n_agent) -> (self.n_agent, self.n_thread) 73 | actions = np.swapaxes(actions, 0, 1) 74 | return actions, {} 75 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ALGORITHM/script_ai/global_params.py: -------------------------------------------------------------------------------- 1 | # # expel dist 2 | # DRIVE_AWAY_DIST = 1.2 3 | # 4 | # # defend dist 5 | # DEFEND_DIST = 2 6 | # 7 | # # retreat to the safe entrance 8 | # ATTA_RETREAT_POS = [-0.5, -3] 9 | # 10 | # # retreat to the dangerous entrance 11 | # DEF_RETREAT_POS = [3, 2] 12 | # 13 | # # key points 14 | # key_points = [[0.7, -3.3], [-3, 0.7]] 15 | 16 | # stance thres 17 | RETREAT_STANCE = 0.3 18 | 19 | 20 | # expel dist 21 | DRIVE_AWAY_DIST = 1000 22 | 23 | # defend dist 24 | DEFEND_DIST = 1000 25 | 26 | # retreat to the safe entrance 27 | ATTA_RETREAT_POS = [-500, -3000] 28 | 29 | # retreat to the dangerous entrance 30 | DEF_RETREAT_POS = [3000, 2000] 31 | 32 | # key points 33 | key_points = [[700, -3300], [-3000, 700]] -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Ankur Deka 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/common/base_env.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | class BaseEnv(object): 3 | def __init__(self, rank) -> None: 4 | self.observation_space = None 5 | self.action_space = None 6 | self.rank = rank 7 | 8 | def step(self, act): 9 | # obs: a Tensor with shape (n_agent, ...) 10 | # reward: a Tensor with shape (n_agent, 1) or (n_team, 1) 11 | # done: a Bool 12 | # info: a dict 13 | raise NotImplementedError 14 | # Warning: if you have only one team and RewardAsUnity, 15 | # you must make sure that reward has shape=[n_team=1, 1] 16 | # e.g. 17 | # >> RewardForTheOnlyTeam = +1 18 | # >> RewardForAllTeams = np.array([RewardForTheOnlyTeam, ]) 19 | # >> return (ob, RewardForAllTeams, done, info) 20 | return (ob, RewardForAllTeams, done, info) # choose this if RewardAsUnity 21 | return (ob, RewardForAllAgents, done, info) # choose this if not RewardAsUnity 22 | 23 | def reset(self): 24 | # obs: a Tensor with shape (n_agent, ...) 25 | # info: a dict 26 | raise NotImplementedError 27 | return ob, info 28 | 29 | 30 | class RawObsArray(object): 31 | raw_obs_size = {} # shared 32 | def __init__(self, key='default'): 33 | self.key = key 34 | if self.key not in self.raw_obs_size: 35 | self.guards_group = [] 36 | self.nosize = True 37 | else: 38 | self.guards_group = np.zeros(shape=(self.raw_obs_size[self.key]), dtype=np.float32) 39 | self.nosize = False 40 | self.p = 0 41 | 42 | def append(self, buf): 43 | if self.nosize: 44 | self.guards_group.append(buf) 45 | else: 46 | L = len(buf) 47 | self.guards_group[self.p:self.p+L] = buf[:] 48 | self.p += L 49 | 50 | def get(self): 51 | if self.nosize: 52 | self.guards_group = np.concatenate(self.guards_group) 53 | self.raw_obs_size[self.key] = len(self.guards_group) 54 | return self.guards_group 55 | 56 | def get_group_size(self): 57 | return len(self.guards_group) 58 | 59 | def get_raw_obs_size(self): 60 | assert self.key in self.raw_obs_size 61 | return self.raw_obs_size[self.key] -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapAdversialConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { "team": 0, "type": "RLA_UAV_Support", "init_fn_name": "init_air" }, 5 | { "team": 0, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 6 | { "team": 0, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 7 | { "team": 0, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 8 | { "team": 0, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 9 | { "team": 0, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 10 | { "team": 0, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 11 | { "team": 0, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 12 | { "team": 0, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 13 | { "team": 0, "type": "RLA_UAV_Support", "init_fn_name": "init_air" }, 14 | { "team": 1, "type": "RLA_UAV_Support", "init_fn_name": "init_air" }, 15 | { "team": 1, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 16 | { "team": 1, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 17 | { "team": 1, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 18 | { "team": 1, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 19 | { "team": 1, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 20 | { "team": 1, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 21 | { "team": 1, "type": "RLA_CAR", "init_fn_name": "init_ground"}, 22 | { "team": 1, "type": "RLA_CAR_Laser", "init_fn_name": "init_ground_tank"}, 23 | { "team": 1, "type": "RLA_UAV_Support", "init_fn_name": "init_air" } 24 | ] 25 | 26 | obs_vec_length = 23 27 | obs_n_entity = 11 28 | ActionFormat = 'Multi-Digit' 29 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapAttackPostConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 5 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 6 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 7 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 8 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 9 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 10 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 11 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 12 | 13 | 14 | { 'team':1, 'type':'Lv3_DefenceTower', 'init_fn_name':'init_defence', }, 15 | 16 | ] 17 | 18 | 19 | AgentPropertyDefaults = { 20 | 'ClassName': 'RLA_CAR', # FString ClassName = ""; 21 | 'DebugAgent': False, 22 | 'AgentTeam': 0, # int AgentTeam = 0; 23 | 'IndexInTeam': 0, # int IndexInTeam = 0; 24 | 'UID': 0, # int UID = 0; 25 | 'MaxMoveSpeed': 600, # move speed, test ok 26 | 'InitLocation': { 'x': 0, 'y': 0, 'z': 0, }, 27 | 'InitRotation': { 'x': 0, 'y': 0, 'z': 0, }, 28 | 'AgentScale' : { 'x': 1, 'y': 1, 'z': 1, }, # agent size, test ok 29 | 'InitVelocity': { 'x': 0, 'y': 0, 'z': 0, }, 30 | 'AgentHp':100, 31 | "WeaponCD": 1, # weapon fire rate 32 | "IsTeamReward": True, 33 | "Type": "", 34 | "DodgeProb": 0.8, # probability of escaping dmg 闪避概率, test ok 35 | "ExplodeDmg": 25, # ms explode dmg. test ok 36 | "FireRange": 1000.0, # <= 1500 37 | "GuardRange": 1400.0, # <= 1500 38 | "PerceptionRange": 1500.0, # <= 1500 39 | 'Color':'(R=0,G=1,B=0,A=1)', # color 40 | "FireRange": 1000, 41 | 'RSVD1':'', 42 | 'RSVD2':'', 43 | } 44 | 45 | obs_vec_length = 23 46 | obs_n_entity = 10 47 | ActionFormat = 'ASCII' 48 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapBreakingBadConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | empty = "" 4 | obs_vec_length = 23 5 | obs_n_entity = 11 6 | ActionFormat = 'Multi-Digit' -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapEscapeConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 5 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 6 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 7 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 8 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 9 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 10 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 11 | { 'team':0, 'type':'PosAttacker', 'init_fn_name':'init_attack', }, 12 | 13 | 14 | { 'team':1, 'type':'Lv3_DefenceTank', 'init_fn_name':'init_defence', }, 15 | { 'team':1, 'type':'Lv3_DefenceTank', 'init_fn_name':'init_defence', }, 16 | { 'team':1, 'type':'Lv3_DefenceTank', 'init_fn_name':'init_defence', }, 17 | { 'team':1, 'type':'Lv3_DefenceTank', 'init_fn_name':'init_defence', }, 18 | 19 | ] 20 | 21 | 22 | AgentPropertyDefaults = { 23 | 'ClassName': 'RLA_CAR', # FString ClassName = ""; 24 | 'DebugAgent': False, 25 | 'AgentTeam': 0, # int AgentTeam = 0; 26 | 'IndexInTeam': 0, # int IndexInTeam = 0; 27 | 'UID': 0, # int UID = 0; 28 | 'MaxMoveSpeed': 600, # move speed, test ok 29 | 'InitLocation': { 'x': 0, 'y': 0, 'z': 0, }, 30 | 'InitRotation': { 'x': 0, 'y': 0, 'z': 0, }, 31 | 'AgentScale' : { 'x': 1, 'y': 1, 'z': 1, }, # agent size, test ok 32 | 'InitVelocity': { 'x': 0, 'y': 0, 'z': 0, }, 33 | 'AgentHp':100, 34 | "WeaponCD": 1, # weapon fire rate 35 | "IsTeamReward": True, 36 | "Type": "", 37 | "DodgeProb": 0.8, # probability of escaping dmg 闪避概率, test ok 38 | "ExplodeDmg": 25, # ms explode dmg. test ok 39 | "FireRange": 1000.0, # <= 1500 40 | "GuardRange": 1400.0, # <= 1500 41 | "PerceptionRange": 1500.0, # <= 1500 42 | 'Color':'(R=0,G=1,B=0,A=1)', # color 43 | "FireRange": 1000, 44 | 'RSVD1':'', 45 | 'RSVD2':'', 46 | } 47 | 48 | obs_vec_length = 23 49 | obs_n_entity = 10 50 | ActionFormat = 'ASCII' 51 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapHugeConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'tid':0, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 5 | { 'team':0, 'tid':1, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 6 | { 'team':0, 'tid':2, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 7 | { 'team':0, 'tid':3, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 8 | { 'team':0, 'tid':4, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 9 | { 'team':0, 'tid':5, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 10 | { 'team':0, 'tid':6, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 11 | { 'team':0, 'tid':7, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 12 | { 'team':0, 'tid':8, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 13 | { 'team':0, 'tid':9, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 14 | 15 | { 'team':1, 'tid':0, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 16 | { 'team':1, 'tid':1, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 17 | { 'team':1, 'tid':2, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 18 | { 'team':1, 'tid':3, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 19 | { 'team':1, 'tid':4, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 20 | { 'team':1, 'tid':5, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 21 | { 'team':1, 'tid':6, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 22 | { 'team':1, 'tid':7, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 23 | { 'team':1, 'tid':8, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 24 | { 'team':1, 'tid':9, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 25 | ] 26 | obs_vec_length = 23 27 | obs_n_entity = 11 28 | ActionFormat = 'Multi-Digit' 29 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapInterceptConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'type':'Landmark', 'init_fn_name':'init_landmark', }, 5 | { 'team':0, 'type':'Landmark', 'init_fn_name':'init_landmark', }, 6 | { 'team':0, 'type':'Landmark', 'init_fn_name':'init_landmark', }, 7 | { 'team':0, 'type':'Defender', 'init_fn_name':'init_defender', }, 8 | { 'team':0, 'type':'Defender', 'init_fn_name':'init_defender', }, 9 | 10 | 11 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 12 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 13 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 14 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 15 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 16 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 17 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 18 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 19 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 20 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 21 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 22 | { 'team':1, 'type':'Attacker', 'init_fn_name':'init_attacker', }, 23 | ] 24 | 25 | 26 | AgentPropertyDefaults = { 27 | 'ClassName': 'RLA_CAR', # FString ClassName = ""; 28 | 'DebugAgent': False, 29 | 'AgentTeam': 0, # int AgentTeam = 0; 30 | 'IndexInTeam': 0, # int IndexInTeam = 0; 31 | 'UID': 0, # int UID = 0; 32 | 'MaxMoveSpeed': 600, # move speed, test ok 33 | 'InitLocation': { 'x': 0, 'y': 0, 'z': 0, }, 34 | 'InitRotation': { 'x': 0, 'y': 0, 'z': 0, }, 35 | 'AgentScale' : { 'x': 1, 'y': 1, 'z': 1, }, # agent size, test ok 36 | 'InitVelocity': { 'x': 0, 'y': 0, 'z': 0, }, 37 | 'AgentHp':100, 38 | "WeaponCD": 1, # weapon fire rate 39 | "IsTeamReward": True, 40 | "Type": "", 41 | "DodgeProb": 0.8, # probability of escaping dmg 闪避概率, test ok 42 | "ExplodeDmg": 25, # ms explode dmg. test ok 43 | "FireRange": 1000.0, # <= 1500 44 | "GuardRange": 1400.0, # <= 1500 45 | "PerceptionRange": 1500.0, # <= 1500 46 | 'Color':'(R=0,G=1,B=0,A=1)', # color 47 | "FireRange": 1000, 48 | 'RSVD1':'', 49 | 'RSVD2':'', 50 | } 51 | 52 | obs_vec_length = 23 53 | obs_n_entity = 10 54 | ActionFormat = 'ASCII' 55 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapJustAnIslandConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'tid':0, 'uid':0, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 5 | { 'team':0, 'tid':1, 'uid':1, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 6 | { 'team':0, 'tid':2, 'uid':2, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 7 | { 'team':0, 'tid':3, 'uid':3, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 8 | { 'team':0, 'tid':4, 'uid':4, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 9 | { 'team':0, 'tid':5, 'uid':5, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 10 | { 'team':0, 'tid':6, 'uid':6, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 11 | { 'team':0, 'tid':7, 'uid':7, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 12 | { 'team':0, 'tid':8, 'uid':8, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 13 | { 'team':0, 'tid':9, 'uid':9, 'n_team_agent':10, 'type':'PlaneAgent', 'init_fn_name':'init_air', }, 14 | ] 15 | 16 | 17 | AgentPropertyDefaults = { 18 | 'ClassName': 'RLA_CAR', # FString ClassName = ""; 19 | 'DebugAgent': False, 20 | 'AgentTeam': 0, # int AgentTeam = 0; 21 | 'IndexInTeam': 0, # int IndexInTeam = 0; 22 | 'UID': 0, # int UID = 0; 23 | 'MaxMoveSpeed': 600, # move speed, test ok 24 | 'InitLocation': { 'x': 0, 'y': 0, 'z': 0, }, 25 | 'InitRotation': { 'x': 0, 'y': 0, 'z': 0, }, 26 | 'AgentScale' : { 'x': 1, 'y': 1, 'z': 1, }, # agent size, test ok 27 | 'InitVelocity': { 'x': 0, 'y': 0, 'z': 0, }, 28 | 'AgentHp':100, 29 | "WeaponCD": 1, # weapon fire rate 30 | "IsTeamReward": True, 31 | "Type": "", 32 | "DodgeProb": 0.8, # probability of escaping dmg 闪避概率, test ok 33 | "ExplodeDmg": 25, # ms explode dmg. test ok 34 | "FireRange": 1000.0, # <= 1500 35 | "GuardRange": 1400.0, # <= 1500 36 | "PerceptionRange": 1500.0, # <= 1500 37 | 'Color':'(R=0,G=1,B=0,A=1)', # color 38 | "FireRange": 1000, 39 | 'RSVD1':'', 40 | 'RSVD2':'', 41 | } 42 | 43 | 44 | obs_vec_length = 23 45 | obs_n_entity = 11 46 | ActionFormat = 'ASCII' 47 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapLargeScaleConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'tid':0, 'uid':0, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 5 | { 'team':0, 'tid':1, 'uid':1, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 6 | { 'team':0, 'tid':2, 'uid':2, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 7 | { 'team':0, 'tid':3, 'uid':3, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 8 | { 'team':0, 'tid':4, 'uid':4, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 9 | { 'team':0, 'tid':5, 'uid':5, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 10 | { 'team':0, 'tid':6, 'uid':6, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 11 | { 'team':0, 'tid':7, 'uid':7, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 12 | { 'team':0, 'tid':8, 'uid':8, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 13 | { 'team':0, 'tid':9, 'uid':9, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 14 | 15 | { 'team':1, 'tid':0, 'uid':10, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 16 | { 'team':1, 'tid':1, 'uid':11, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 17 | { 'team':1, 'tid':2, 'uid':12, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 18 | { 'team':1, 'tid':3, 'uid':13, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 19 | { 'team':1, 'tid':4, 'uid':14, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 20 | { 'team':1, 'tid':5, 'uid':15, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 21 | { 'team':1, 'tid':6, 'uid':16, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 22 | { 'team':1, 'tid':7, 'uid':17, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 23 | { 'team':1, 'tid':8, 'uid':18, 'n_team_agent':10, 'type':'RLA_CAR_Laser', 'init_fn_name':'init_ground', }, 24 | { 'team':1, 'tid':9, 'uid':19, 'n_team_agent':10, 'type':'RLA_CAR', 'init_fn_name':'init_ground', }, 25 | ] 26 | 27 | obs_vec_length = 23 28 | obs_n_entity = 11 29 | ActionFormat = 'Multi-Digit' 30 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapPreyPredatorConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 5 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 6 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 7 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 8 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 9 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 10 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 11 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 12 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 13 | { 'team':0, 'type':'Prey', 'init_fn_name':'init_ground', }, 14 | 15 | { 'team':1, 'type':'Predator', 'init_fn_name':'init_ground', }, 16 | { 'team':1, 'type':'Predator', 'init_fn_name':'init_ground', }, 17 | { 'team':1, 'type':'Predator', 'init_fn_name':'init_ground', }, 18 | 19 | ] 20 | 21 | 22 | AgentPropertyDefaults = { 23 | 'ClassName': 'RLA_CAR', # FString ClassName = ""; 24 | 'DebugAgent': False, 25 | 'AgentTeam': 0, # int AgentTeam = 0; 26 | 'IndexInTeam': 0, # int IndexInTeam = 0; 27 | 'UID': 0, # int UID = 0; 28 | 'MaxMoveSpeed': 600, # move speed, test ok 29 | 'InitLocation': { 'x': 0, 'y': 0, 'z': 0, }, 30 | 'InitRotation': { 'x': 0, 'y': 0, 'z': 0, }, 31 | 'AgentScale' : { 'x': 1, 'y': 1, 'z': 1, }, # agent size, test ok 32 | 'InitVelocity': { 'x': 0, 'y': 0, 'z': 0, }, 33 | 'AgentHp':100, 34 | "WeaponCD": 1, # weapon fire rate 35 | "IsTeamReward": True, 36 | "Type": "", 37 | "DodgeProb": 0.8, # probability of escaping dmg 闪避概率, test ok 38 | "ExplodeDmg": 25, # ms explode dmg. test ok 39 | "FireRange": 1000.0, # <= 1500 40 | "GuardRange": 1400.0, # <= 1500 41 | "PerceptionRange": 1500.0, # <= 1500 42 | 'Color':'(R=0,G=1,B=0,A=1)', # color 43 | "FireRange": 1000, 44 | 'RSVD1':'', 45 | 'RSVD2':'', 46 | } 47 | 48 | obs_vec_length = 23 49 | obs_n_entity = 10 50 | ActionFormat = 'ASCII' 51 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapReproduceConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'type':'DummyAgent', 'init_fn_name':'init_attack', } for i in range(200) 5 | ] 6 | 7 | 8 | AgentPropertyDefaults = { 9 | 'ClassName': 'RLA_CAR', # FString ClassName = ""; 10 | 'DebugAgent': False, 11 | 'AgentTeam': 0, # int AgentTeam = 0; 12 | 'IndexInTeam': 0, # int IndexInTeam = 0; 13 | 'UID': 0, # int UID = 0; 14 | 'MaxMoveSpeed': 600, # move speed, test ok 15 | 'InitLocation': { 'x': 0, 'y': 0, 'z': 0, }, 16 | 'InitRotation': { 'x': 0, 'y': 0, 'z': 0, }, 17 | 'AgentScale' : { 'x': 1, 'y': 1, 'z': 1, }, # agent size, test ok 18 | 'InitVelocity': { 'x': 0, 'y': 0, 'z': 0, }, 19 | 'AgentHp':100, 20 | "WeaponCD": 1, # weapon fire rate 21 | "IsTeamReward": True, 22 | "Type": "", 23 | "DodgeProb": 0.8, # probability of escaping dmg 闪避概率, test ok 24 | "ExplodeDmg": 25, # ms explode dmg. test ok 25 | "FireRange": 1000.0, # <= 1500 26 | "GuardRange": 1400.0, # <= 1500 27 | "PerceptionRange": 1500.0, # <= 1500 28 | 'Color':'(R=0,G=1,B=0,A=1)', # color 29 | "FireRange": 1000, 30 | 'RSVD1':'', 31 | 'RSVD2':'', 32 | } 33 | 34 | obs_vec_length = 23 35 | obs_n_entity = 10 36 | ActionFormat = 'ASCII' 37 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/UhmapWaterdropConf.py: -------------------------------------------------------------------------------- 1 | 2 | class SubTaskConfig(): 3 | agent_list = [ 4 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, # 0 5 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 6 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 7 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 8 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 9 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 10 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 11 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 12 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, 13 | { 'team':0, 'type':'Ship', 'init_fn_name':'init_ship', }, # 9 14 | 15 | { 'team':1, 'type':'Waterdrop', 'init_fn_name':'init_waterdrop', }, # 10 16 | { 'team':1, 'type':'Waterdrop', 'init_fn_name':'init_waterdrop', }, # 11 17 | ] 18 | 19 | 20 | AgentPropertyDefaults = { 21 | 'ClassName': 'RLA_CAR', # FString ClassName = ""; 22 | 'DebugAgent': False, 23 | 'AgentTeam': 0, # int AgentTeam = 0; 24 | 'IndexInTeam': 0, # int IndexInTeam = 0; 25 | 'UID': 0, # int UID = 0; 26 | 'MaxMoveSpeed': 600, # move speed, test ok 27 | 'InitLocation': { 'x': 0, 'y': 0, 'z': 0, }, 28 | 'InitRotation': { 'x': 0, 'y': 0, 'z': 0, }, 29 | 'AgentScale' : { 'x': 1, 'y': 1, 'z': 1, }, # agent size, test ok 30 | 'InitVelocity': { 'x': 0, 'y': 0, 'z': 0, }, 31 | 'AgentHp':100, 32 | "WeaponCD": 1, # weapon fire rate 33 | "IsTeamReward": True, 34 | "Type": "", 35 | "DodgeProb": 0.8, # probability of escaping dmg 闪避概率, test ok 36 | "ExplodeDmg": 25, # ms explode dmg. test ok 37 | "FireRange": 1000.0, # <= 1500 38 | "GuardRange": 1400.0, # <= 1500 39 | "PerceptionRange": 1500.0, # <= 1500 40 | 'Color':'(R=0,G=1,B=0,A=1)', # color 41 | "FireRange": 1000, 42 | 'RSVD1':'', 43 | 'RSVD2':'', 44 | } 45 | 46 | obs_vec_length = 23 47 | obs_n_entity = 10 48 | ActionFormat = 'ASCII' 49 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/SubTasks/cython_func.pyx: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | cimport numpy as np 3 | cimport cython 4 | np.import_array() 5 | 6 | 7 | ctypedef fused DTYPE_all_t: 8 | np.float32_t 9 | np.float64_t 10 | np.int64_t 11 | np.int32_t # to compat Wi 12 | ctypedef fused DTYPE_t: 13 | np.float32_t 14 | np.float64_t 15 | 16 | 17 | ctypedef fused DTYPE_intlong_t: 18 | np.int64_t 19 | np.int32_t # to compat Windows 20 | 21 | 22 | 23 | # x: input 24 | # n_digit: output dimension 25 | # base: 进制 26 | @cython.boundscheck(False) 27 | @cython.wraparound(False) 28 | @cython.nonecheck(False) 29 | def tear_number_apart(np.float64_t x, DTYPE_intlong_t n_digit, DTYPE_intlong_t base=16, DTYPE_all_t mv_left=8): 30 | cdef np.ndarray out = np.zeros(n_digit, dtype=float) 31 | cdef int p = n_digit 32 | cdef float tmp = 0 33 | reverse = x < 0 34 | cdef float m_init = base 35 | if reverse: x = -x 36 | m_init = m_init ** mv_left 37 | x = x * m_init 38 | for _ in range(n_digit): 39 | p -= 1 40 | if p==0: 41 | out[p] = x 42 | break 43 | tmp = x % base 44 | out[p] = tmp 45 | x = x // base 46 | if reverse: out = -out 47 | return out 48 | 49 | 50 | def tear_num_arr(arr, DTYPE_intlong_t n_digit, DTYPE_intlong_t base, DTYPE_all_t mv_left): 51 | return np.concatenate([tear_number_apart(x, n_digit, base, mv_left) for x in arr], axis=0) 52 | 53 | def comb_num_back(arr, n_digit, base, mv_left): 54 | out = 0 55 | tmp = base ** (n_digit - mv_left - 1) 56 | for x in arr: 57 | out += x * tmp 58 | tmp = tmp/base 59 | 60 | return out 61 | 62 | 63 | ''' 64 | test <1> 65 | 66 | parts = tear_number_apart(255, n_digit=10, base=2, mv_left=1) 67 | print(parts) 68 | comb_num_back(parts, n_digit=10, base=2, mv_left=1) 69 | 70 | 71 | test <2> 72 | 73 | parts = tear_number_apart(255.778, n_digit=10, base=10, mv_left=-1) 74 | print(parts) 75 | comb_num_back(parts, n_digit=10, base=10, mv_left=-1) 76 | 77 | test <3> 78 | 79 | for i in range(1000): 80 | q = (np.random.rand() - 0.5)*1e3 81 | parts = tear_number_apart(q, n_digit=10, base=10, mv_left=0) 82 | print(q, parts) 83 | res = np.abs(comb_num_back(parts, n_digit=10, base=10, mv_left=0)-q) < 1e-6 84 | if not res: 85 | print('??? np.abs(comb_num_back(parts, n_digit=10, base=10, mv_left=0)-q)', np.abs(comb_num_back(parts, n_digit=10, base=10, mv_left=0)-q)) 86 | assert False 87 | ''' -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/actionset.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | ActDigitLen = 100 3 | def strActionToDigits(act_string): 4 | t = [ord(c) for c in act_string] 5 | d_len = len(t) 6 | assert d_len <= ActDigitLen, ("Action string is tooo long! Don't be wordy. Or you can increase ActDigitLen above.") 7 | pad = [-1 for _ in range(ActDigitLen-d_len)] 8 | return (t+pad) 9 | 10 | def digitsToStrAction(digits): 11 | if all([a==0 for a in digits]): return 'ActionSet3::N/A;N/A' 12 | arr = [chr(d) for d in digits.astype(int) if d >= 0] 13 | return ''.join(arr) 14 | 15 | """ 16 | 'ActionSet3::ChangeHeight;100' 17 | """ -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/actionset_v3.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | ActDigitLen = 100 3 | def strActionToDigits(act_string): 4 | t = [ord(c) for c in act_string] 5 | d_len = len(t) 6 | assert d_len <= ActDigitLen, ("Action string is tooo long! Don't be wordy. Or you can increase ActDigitLen above.") 7 | pad = [-1 for _ in range(ActDigitLen-d_len)] 8 | return (t+pad) 9 | 10 | def digitsToStrAction(digits): 11 | if all([a==0 for a in digits]): return 'ActionSet3::N/A;N/A' 12 | arr = [chr(d) for d in digits.astype(int) if d >= 0] 13 | return ''.join(arr) 14 | 15 | """ 16 | 'ActionSet3::ChangeHeight;100' 17 | """ -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/agent.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from .actset_lookup import agent_json2local_attrs 3 | 4 | class Agent(object): 5 | def __init__(self, team, team_id, uid) -> None: 6 | self.team = team 7 | self.team_id = team_id 8 | self.uid = uid 9 | self.attrs = agent_json2local_attrs 10 | for attr_json, attr_agent in self.attrs: setattr(self, attr_agent, None) 11 | self.pos3d = np.array([np.nan, np.nan, np.nan]) 12 | self.pos2d = np.array([np.nan, np.nan]) 13 | 14 | def update_agent_attrs(self, dictionary): 15 | if (not dictionary['agentAlive']): 16 | self.alive = False 17 | else: 18 | assert dictionary['valid'] 19 | for attr_json, attr_agent in self.attrs: 20 | setattr(self, attr_agent, dictionary[attr_json]) 21 | assert self.uid == self.uid_remote 22 | self.pos3d = np.array(self.location) 23 | self.pos2d = self.pos3d[:2] 24 | self.vel3d = np.array(self.velocity) 25 | self.vel2d = self.pos3d[:2] 26 | self.scale3d = np.array(self.scale3) 27 | self.scale = self.scale3[0] 28 | self.yaw = self.rotation[0] 29 | 30 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/MISSION/uhmap/auto_download.py: -------------------------------------------------------------------------------- 1 | import os, commentjson, shutil, subprocess, tqdm, shutil, distutils 2 | from onedrivedownloader import download 3 | 4 | try: os.makedirs('./TEMP') 5 | except: pass 6 | 7 | def download_from_shared_server(key = 'cat'): 8 | # download uhmap file manifest | 下载manifest目录文件 9 | print('download uhmap file manifest | 下载manifest目录文件') 10 | manifest_url = "https://ageasga-my.sharepoint.com/:u:/g/personal/fuqingxu_yiteam_tech/EVmCQMSUWV5MgREWaxiz_GoBalBRV3DWBU3ToSJ5OTQaLQ?e=I8yjl9" 11 | 12 | try: 13 | file = download(manifest_url, filename="./TEMP/", force_download=True) 14 | except: 15 | print('failed to connect to onedrive | 连接onedrive失败, 您可能需要翻墙才能下载资源') 16 | 17 | with open("./TEMP/uhmap_manifest.jsonc", "r") as f: 18 | manifest = commentjson.load(f) 19 | if key not in key: 20 | print('The version you are looking for does not exists!') 21 | uhmap_url = manifest[key] 22 | print('download main files | 下载预定文件') 23 | try: 24 | file = download(uhmap_url, filename="./TEMP/DOWNLOAD", unzip=True, unzip_path='./TEMP/UNZIP') 25 | except: 26 | print(f'download timeout | 下载失败, 您可能需要翻墙才能下载资源。另外如果您想手动下载的话: {uhmap_url}') 27 | return file 28 | 29 | def download_client_binary_on_platform(desired_path, desired_version, is_render_client, platform): 30 | key = f"Uhmap_{platform}_Build_Version{desired_version}" 31 | print('downloading', key) 32 | download_from_shared_server(key = key) 33 | print('download and extract complete, moving files') 34 | from distutils import dir_util 35 | target_dir = os.path.abspath(os.path.dirname(desired_path) + './..') 36 | dir_util.copy_tree('./TEMP/UNZIP', target_dir) 37 | assert os.path.exists(desired_path), "unexpected path error! Are you using Linux style path on Windows?" 38 | return 39 | 40 | 41 | def download_client_binary(desired_path, desired_version, is_render_client): 42 | import platform 43 | plat = "Windows" 44 | if platform.system()=="Linux": plat = "Linux" 45 | download_client_binary_on_platform(desired_path, desired_version, is_render_client, platform=plat) 46 | return 47 | 48 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/README.md: -------------------------------------------------------------------------------- 1 | # HMP:Hybrid Multi-agent Playground 2 | 3 | See https://github.com/binary-husky/hmp2g 4 | 5 | 6 | 7 | # Run demo in Editor mode 8 | ``` 9 | (Open map UhmapLargeScale in Unreal Editor) 10 | 11 | cd PythonExample/hmp_minimal_modules 12 | python main.py -c ZHECKPOINT/uhmap_hete10vs10/render_result_editor.jsonc 13 | ``` 14 | 15 | # Run tutorial of designing custom actions in Editor mode 16 | ``` 17 | (Open map UhmapWaterdrop or UhmapLargeScale in Unreal Editor) 18 | 19 | cd PythonExample/hmp_minimal_modules 20 | python main.py -c ZDOCS/examples/uhmap/random_waterdrop.jsonc 21 | ``` 22 | 23 | 24 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/UTIL/__init__.py -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/colorful.py: -------------------------------------------------------------------------------- 1 | import platform 2 | from sys import stdout 3 | 4 | if platform.system()=="Linux": 5 | pass 6 | else: 7 | from colorama import init 8 | init() 9 | 10 | # Do you like the elegance of Chinese characters? 11 | def print红(*kw,**kargs): 12 | print("\033[0;31m",*kw,"\033[0m",**kargs) 13 | def print绿(*kw,**kargs): 14 | print("\033[0;32m",*kw,"\033[0m",**kargs) 15 | def print黄(*kw,**kargs): 16 | print("\033[0;33m",*kw,"\033[0m",**kargs) 17 | def print蓝(*kw,**kargs): 18 | print("\033[0;34m",*kw,"\033[0m",**kargs) 19 | def print紫(*kw,**kargs): 20 | print("\033[0;35m",*kw,"\033[0m",**kargs) 21 | def print靛(*kw,**kargs): 22 | print("\033[0;36m",*kw,"\033[0m",**kargs) 23 | 24 | def print亮红(*kw,**kargs): 25 | print("\033[1;31m",*kw,"\033[0m",**kargs) 26 | def print亮绿(*kw,**kargs): 27 | print("\033[1;32m",*kw,"\033[0m",**kargs) 28 | def print亮黄(*kw,**kargs): 29 | print("\033[1;33m",*kw,"\033[0m",**kargs) 30 | def print亮蓝(*kw,**kargs): 31 | print("\033[1;34m",*kw,"\033[0m",**kargs) 32 | def print亮紫(*kw,**kargs): 33 | print("\033[1;35m",*kw,"\033[0m",**kargs) 34 | def print亮靛(*kw,**kargs): 35 | print("\033[1;36m",*kw,"\033[0m",**kargs) 36 | 37 | 38 | 39 | def print亮红(*kw,**kargs): 40 | print("\033[1;31m",*kw,"\033[0m",**kargs) 41 | def print亮绿(*kw,**kargs): 42 | print("\033[1;32m",*kw,"\033[0m",**kargs) 43 | def print亮黄(*kw,**kargs): 44 | print("\033[1;33m",*kw,"\033[0m",**kargs) 45 | def print亮蓝(*kw,**kargs): 46 | print("\033[1;34m",*kw,"\033[0m",**kargs) 47 | def print亮紫(*kw,**kargs): 48 | print("\033[1;35m",*kw,"\033[0m",**kargs) 49 | def print亮靛(*kw,**kargs): 50 | print("\033[1;36m",*kw,"\033[0m",**kargs) 51 | 52 | print_red = print红 53 | print_green = print绿 54 | print_yellow = print黄 55 | print_blue = print蓝 56 | print_purple = print紫 57 | print_indigo = print靛 58 | 59 | print_bold_red = print亮红 60 | print_bold_green = print亮绿 61 | print_bold_yellow = print亮黄 62 | print_bold_blue = print亮蓝 63 | print_bold_purple = print亮紫 64 | print_bold_indigo = print亮靛 65 | 66 | if not stdout.isatty(): 67 | # redirection, avoid a fucked up log file 68 | print红 = print 69 | print绿 = print 70 | print黄 = print 71 | print蓝 = print 72 | print紫 = print 73 | print靛 = print 74 | print亮红 = print 75 | print亮绿 = print 76 | print亮黄 = print 77 | print亮蓝 = print 78 | print亮紫 = print 79 | print亮靛 = print 80 | print_red = print 81 | print_green = print 82 | print_yellow = print 83 | print_blue = print 84 | print_purple = print 85 | print_indigo = print 86 | print_bold_red = print 87 | print_bold_green = print 88 | print_bold_yellow = print 89 | print_bold_blue = print 90 | print_bold_purple = print 91 | print_bold_indigo = print -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/data_struct.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | class UniqueList(): 4 | def __init__(self, list_input=None): 5 | self._list = [] 6 | if list_input is not None: 7 | self.extend_unique(list_input) 8 | 9 | def append_unique(self, item): 10 | if item in self._list: 11 | return False 12 | else: 13 | self._list.append(item) 14 | 15 | def extend_unique(self, list_input): 16 | for item in list_input: 17 | self.append_unique(item) 18 | 19 | def has(self, item): 20 | return (item in self._list) 21 | 22 | def len(self): 23 | return len(self._list) 24 | 25 | def __len__(self): 26 | return len(self._list) 27 | 28 | def get(self): 29 | return self._list 30 | 31 | def __iter__(self): 32 | return self._list.__iter__() 33 | 34 | # # https://stackoverflow.com/questions/16891340/remove-a-prefix-from-a-string 35 | # def remove_prefix(text, prefix): 36 | # return text[text.startswith(prefix) and len(prefix):] 37 | 38 | # https://stackoverflow.com/questions/3663450/remove-substring-only-at-the-end-of-string 39 | def remove_suffix(s, sub): 40 | return s[:-len(sub)] if s.endswith(sub) else s 41 | 42 | def remove_prefix(s, sub): 43 | return s[len(sub):] if s.startswith(sub) else s -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/fetch_multiserver.py: -------------------------------------------------------------------------------- 1 | from UTIL.exp_helper import get_ssh_sftp 2 | from UTIL.colorful import * 3 | import time,os 4 | 5 | ''' 6 | Fetch experiment results from worker servers 7 | ''' 8 | 9 | n_run_mode = [ 10 | # { # @1 11 | # "addr": "172.18.116.149:2233", 12 | # "usr": "hmp", 13 | # "pwd": "hmp" 14 | # }, 15 | # { # @2 16 | # "addr": "172.18.116.150:2233", 17 | # "usr": "fuqingxu", 18 | # "pwd": "clara" 19 | # }, 20 | { # @3 21 | "addr": "172.18.116.149:2233", 22 | "usr": "fuqingxu", 23 | "pwd": "clara" 24 | } 25 | 26 | ] 27 | download_dir = './fetch/' 28 | after_date = '2022-03-22-17-22-00' 29 | consider_days = None 30 | 31 | info_list = {} 32 | to_download = {} 33 | for ith_run in range(len(n_run_mode)): 34 | addr = n_run_mode[ith_run]['addr'] 35 | usr = n_run_mode[ith_run]['usr'] 36 | pwd = n_run_mode[ith_run]['pwd'] 37 | ssh, sftp = get_ssh_sftp(addr, usr, pwd) 38 | experiments_path = sftp.listdir(path='./MultiServerMission/') 39 | # 将顺序改为从最早到最晚 40 | experiments_path = reversed(sorted(experiments_path)) 41 | for index, exp_time in enumerate(experiments_path): 42 | time_then = time.mktime(time.strptime(exp_time,"%Y-%m-%d-%H:%M:%S")) 43 | time_now = time.mktime(time.localtime()) 44 | diff_time_days = (time_now - time_then)/3600/24 45 | if consider_days is None: 46 | consider_days = (time_now - time.mktime(time.strptime(after_date,"%Y-%m-%d-%H-%M-%S")))/3600/24 47 | if diff_time_days > consider_days: continue 48 | path_ckpt = './MultiServerMission/%s/src/ZHECKPOINT/'%exp_time 49 | try: 50 | list_of_sub_exp = sftp.listdir(path=path_ckpt) 51 | except: 52 | print('No ZHECKPOINT directory found!') 53 | continue 54 | key = str(ith_run)+'-'+str(index) 55 | print亮绿(key,':',exp_time) 56 | for sep in list_of_sub_exp: 57 | print亮紫('\t- ',sep) 58 | info_list[key] = {'ith_run':ith_run, 'index':index, 'path':path_ckpt} 59 | target_path = (download_dir+'/%s/'%exp_time.replace(':','-')) 60 | try: 61 | os.mkdir(target_path) 62 | sftp.get_dir(source=path_ckpt,target=target_path) # 下载! 63 | except BaseException as e: 64 | print('This directory already exists, skipping:', target_path) 65 | 66 | print('download complete') 67 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/file_lock.py: -------------------------------------------------------------------------------- 1 | # pip install filelock 2 | from filelock import FileLock as FileLockBase 3 | 4 | class FileLock(FileLockBase): 5 | def __init__(self, lock_file, timeout: float = -1) -> None: 6 | assert lock_file.endswith('.lock') 7 | super().__init__(lock_file, timeout) 8 | 9 | 10 | def is_file_empty(file_path): 11 | with open(file_path, 'r') as f: 12 | file_content = f.read() 13 | if file_content == '' or file_content == '\n': 14 | return True 15 | else: 16 | return False 17 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/hidden_print.py: -------------------------------------------------------------------------------- 1 | import sys, os 2 | class HiddenPrints: 3 | def __enter__(self): 4 | self._original_stdout = sys.stdout 5 | sys.stdout = open(os.devnull, 'w') 6 | 7 | def __exit__(self, exc_type, exc_val, exc_tb): 8 | sys.stdout.close() 9 | sys.stdout = self._original_stdout -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/mem_watcher_ue.py: -------------------------------------------------------------------------------- 1 | def validate_path(): 2 | import os, sys 3 | # '/home/hmp/xx/hmp2g-heterogeneous-phase2/UTIL' 4 | dir_name = os.path.dirname(__file__) 5 | # '/home/hmp/xx/hmp2g-heterogeneous-phase2' 6 | root_dir_assume = os.path.abspath(os.path.dirname(__file__) + '/..') 7 | # change working dir 8 | os.chdir(root_dir_assume) 9 | # import root 10 | sys.path.append(root_dir_assume) 11 | 12 | validate_path() 13 | import time, requests, threading, os, atexit, psutil 14 | from UTIL.colorful import * 15 | 16 | def thread_dfs(p, depth=0, info=None): 17 | try: 18 | if isinstance(p, int): 19 | p = psutil.Process(p) 20 | elif isinstance(p, psutil.Process): 21 | pass 22 | else: 23 | p = psutil.Process(p.pid) 24 | 25 | pp = p 26 | print_info(depth, pp, info) 27 | if len(p.children())>0: 28 | # print('有子进程') 29 | for child in p.children(): 30 | if hasattr(child,'children') and len(child.children())>0: 31 | thread_dfs(child, depth = depth+1, info=info) 32 | else: 33 | pp = child 34 | print_info(depth+1, pp, info) 35 | else: 36 | pass 37 | except: 38 | return 39 | 40 | def print_info(depth, pp, info=None): 41 | pid = pp.pid 42 | name = pp.name() 43 | name_trim = 'HmapShmPoolWorker' if name.startswith('HmapShmPoolWorker') else name 44 | mem = (psutil.Process(pid).memory_info().rss / 1024 / 1024 / 1024) 45 | info['tot_mem'] += mem 46 | info['tot_procs'] += 1 47 | if name_trim not in info: 48 | info[name_trim] = { 49 | 'mem':0, 50 | 'procs':0, 51 | } 52 | info[name_trim]['mem'] += mem 53 | info[name_trim]['procs'] += 1 54 | 55 | 56 | def find_procs_by_name(name): 57 | "Return a list of processes matching 'name'." 58 | ls = [] 59 | for p in psutil.process_iter(["name", "exe", "cmdline"]): 60 | if name == p.info['name'] or \ 61 | p.info['exe'] and os.path.basename(p.info['exe']) == name or \ 62 | p.info['cmdline'] and p.info['cmdline'][0] == name: 63 | ls.append(p) 64 | return ls[0] 65 | 66 | if __name__ == "__main__": 67 | from VISUALIZE.mcom import mcom 68 | mcv = mcom( 69 | path='TEMP', 70 | digit=-1, 71 | rapid_flush=True, draw_mode='Img' 72 | ) 73 | 74 | 75 | def main(root_name = 'UE4Editor.exe'): 76 | pid = find_procs_by_name(root_name) 77 | mem = (pid.memory_info().rss / 1024 / 1024 / 1024) 78 | mcv.rec(mem, 'mem') 79 | mcv.rec_show() 80 | 81 | if __name__ == "__main__": 82 | while True: 83 | main() 84 | time.sleep(10) # 十分钟一次 85 | # time.sleep(300) # 十分钟一次 -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/memleak_finder.py: -------------------------------------------------------------------------------- 1 | from pympler import tracker 2 | tr = tracker.SummaryTracker() 3 | 4 | def memdb_print_diff(): 5 | tr.print_diff() 6 | 7 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/mserver_launcher.sh: -------------------------------------------------------------------------------- 1 | byobu new-session -d -s $USER -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/sync_exp.py: -------------------------------------------------------------------------------- 1 | import torch, time 2 | import pickle, os 3 | 4 | from UTIL.colorful import print亮红 5 | from .tensor_ops import __hash__ 6 | from UTIL.exp_helper import singleton 7 | 8 | @singleton 9 | class SynWorker: 10 | 11 | def __init__(self, mod) -> None: 12 | self.sychronize_FILE_hashdict = 'TEMP/sychronize_hashdict' 13 | self.sychronize_FILE_cnt = 'TEMP/sychronize_cnt' 14 | self.mod = mod 15 | self.sychronize_internal_hashdict = {} 16 | self.sychronize_internal_cnt = {} 17 | self.follow_cnt = {} 18 | print亮红('warning, SynWorker init, mod is', mod) 19 | time.sleep(5) 20 | if mod == 'follow': 21 | with open(self.sychronize_FILE_hashdict, 'rb') as f: 22 | self.sychronize_internal_hashdict = pickle.load(f) 23 | with open(self.sychronize_FILE_cnt, 'rb') as f: 24 | self.sychronize_internal_cnt = pickle.load(f) 25 | else: 26 | try: 27 | os.remove(self.sychronize_FILE_hashdict) 28 | os.remove(self.sychronize_FILE_cnt) 29 | except: pass 30 | 31 | def dump_sychronize_data(self): 32 | if self.mod == 'follow': 33 | return 34 | with open(self.sychronize_FILE_hashdict, 'wb+') as f: 35 | pickle.dump(self.sychronize_internal_hashdict, f) 36 | with open(self.sychronize_FILE_cnt, 'wb+') as f: 37 | pickle.dump(self.sychronize_internal_cnt, f) 38 | 39 | def sychronize_experiment(self, key, data, reset_when_close=False): 40 | if self.mod == 'lead': 41 | hash_code = __hash__(data) 42 | if key not in self.sychronize_internal_hashdict: 43 | self.sychronize_internal_cnt[key] = 0 44 | self.sychronize_internal_hashdict[key] = [ 45 | { 46 | 'hash_code':hash_code, 47 | 'data': data, 48 | } 49 | , 50 | ] 51 | else: 52 | self.sychronize_internal_hashdict[key].append({ 53 | 'hash_code':hash_code, 54 | 'data': data, 55 | }) 56 | 57 | self.sychronize_internal_cnt[key] += 1 58 | 59 | if self.mod == 'follow': 60 | hash_code = __hash__(data) 61 | if key not in self.follow_cnt: 62 | self.follow_cnt[key] = 0 63 | 64 | if hash_code != self.sychronize_internal_hashdict[key][self.follow_cnt[key]]['hash_code']: 65 | if not (torch.isclose(self.sychronize_internal_hashdict[key][self.follow_cnt[key]]['data'],data).all()) or (not isinstance(data, torch.Tensor)): 66 | print('%s: error expected hash: %s, get hash %s, data %s'%(key, 67 | self.sychronize_internal_hashdict[key][self.follow_cnt[key]]['hash_code'], 68 | hash_code, 69 | str(data) 70 | )) 71 | else: 72 | print('%s: error expected hash, but very very close (<1e-5)'%key) 73 | if reset_when_close: 74 | return data 75 | self.follow_cnt[key] += 1 -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/UTIL/tensor_ops_c.pyx: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | cimport numpy as np 3 | cimport cython 4 | from cython.parallel import prange 5 | from libc.math cimport cos, atan2, abs 6 | 7 | np.import_array() 8 | ctypedef np.float64_t DTYPE_F64_t 9 | ctypedef np.float32_t DTYPE_t 10 | ctypedef fused DTYPE_int64_t: 11 | np.int64_t 12 | np.int32_t # to compat Windows 13 | ctypedef np.uint8_t DTYPE_bool_t 14 | 15 | PI = np.pi 16 | @cython.boundscheck(False) 17 | @cython.wraparound(False) 18 | @cython.nonecheck(False) 19 | def reg_rad_arr(DTYPE_F64_t[:] rad): 20 | cdef Py_ssize_t dim = rad.shape[0] 21 | cdef Py_ssize_t x, y 22 | result = np.zeros(dim, dtype=np.double) 23 | cdef DTYPE_F64_t[:] result_view = result 24 | cdef DTYPE_F64_t PI = np.pi 25 | 26 | for x in prange(dim, nogil=True): 27 | result_view[x] = (rad[x] + PI) % (2*PI) - PI 28 | return result 29 | 30 | 31 | # @cython.boundscheck(False) 32 | # @cython.wraparound(False) 33 | # @cython.nonecheck(False) 34 | # def roll_hisory( DTYPE_t[:,:,:,:] obs_feed_new, 35 | # DTYPE_t[:,:,:,:] prev_obs_feed, 36 | # DTYPE_bool_t[:,:,:] valid_mask, 37 | # DTYPE_int64_t[:,:] N_valid, 38 | # DTYPE_t[:,:,:,:] next_his_pool): 39 | # cdef Py_ssize_t vmax = N_valid.shape[0] 40 | # cdef Py_ssize_t wmax = N_valid.shape[1] 41 | # cdef Py_ssize_t max_obs_entity = obs_feed_new.shape[2] 42 | # cdef int n_v, th, a, t, k, pointer 43 | # for th in prange(vmax, nogil=True): 44 | # for a in range(wmax): 45 | # pointer = 0 46 | # for k in range(max_obs_entity): 47 | # if valid_mask[th,a,k]: 48 | # next_his_pool[th, a, pointer] = obs_feed_new[th,a,k] 49 | # pointer = pointer + 1 50 | # n_v = N_valid[th,a] 51 | # for k in range(n_v, max_obs_entity): 52 | # next_his_pool[th,a,k] = prev_obs_feed[th,a,k-n_v] 53 | # return np.asarray(next_his_pool) 54 | 55 | 56 | # https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html?highlight=wraparound#compiler-directives 57 | ''' 58 | binding (True): Python函数的内省, 查看函数内部的细节['__class__', '__delatrr__', ...., 'co_code', 'co_filename', 'co_argcount', 'co_varnames',...]等等 59 | boundscheck (True): 数组的边界检查 60 | wraparound (True) : 是否支持索引倒数,如a[-1] 61 | 62 | initializedcheck (True / False): ? 63 | nonecheck (False) 64 | always_allow_keywords (True / False) 65 | profile (False): Write hooks for Python profilers into the compiled C code. Default is False. 66 | 67 | 68 | infer_types (True / False): Infer types of untyped variables in function bodies. Default is None, indicating that only safe (semantically-unchanging) inferences are allowed. In particular, inferring integral types for variables used in arithmetic expressions is considered unsafe (due to possible overflow) and must be explicitly requested. 69 | 70 | ''' -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/__init__.py -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/mcom_def.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | fn_names = [ 4 | "v2dx", "flash", "plot", "figure", "hold", "box", "pause", "clf", "xlim", "ylim", "xlabel", 5 | "ylabel", "drawnow", "v2d", "v2d_init", "v3d_init", "v2L", "title", "plot3", "grid", "v3dx", "v2d_show", 6 | "v2d_pop", "v2d_line_object", "v2d_clear", "v2d_add_terrain", "set_style", "set_env", "use_geometry", 7 | "rec_disable_percentile_clamp", "rec_enable_percentile_clamp", 8 | "geometry_rotate_scale_translate", "test_function_terrain", 'line3d', 'advanced_geometry_rotate_scale_translate', 9 | "advanced_geometry_material", "skip" 10 | ] 11 | align_names = [ 12 | ('初始化3D', 'v2d_init'), 13 | ('设置样式', 'set_style'), 14 | ('形状之旋转缩放和平移','geometry_rotate_scale_translate'), 15 | ('其他几何体之旋转缩放和平移','advanced_geometry_rotate_scale_translate'), 16 | ('其他几何体之材质','advanced_geometry_material'), 17 | ('发送几何体','v2dx'), 18 | ('结束关键帧','v2d_show'), 19 | ('发送线条','line3d'), 20 | ('发射光束','flash'), 21 | ('空指令','skip'), 22 | ] 23 | 24 | def find_where_to_log(path): 25 | if not os.path.exists(path): os.makedirs(path) 26 | 27 | def find_previous_start_end(): 28 | start = None; end = None; t = 0 29 | while True: 30 | is_body = os.path.exists(path + '/mcom_buffer_%d.txt' % t) 31 | is_head = os.path.exists(path + '/mcom_buffer_%d____starting_session.txt' % t) 32 | if is_head: start = t 33 | if is_head or is_body: end = t; t += 1 34 | else: 35 | new = t 36 | return (start, end, new) 37 | 38 | prev_start, prev_end, new = find_previous_start_end() 39 | return prev_start, prev_end, new 40 | 41 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/mcom_test.py: -------------------------------------------------------------------------------- 1 | def validate_path(): 2 | import os, sys 3 | dir_name = os.path.dirname(__file__) 4 | root_dir_assume = os.path.abspath(os.path.dirname(__file__) + '/..') 5 | os.chdir(root_dir_assume) 6 | sys.path.append(root_dir_assume) 7 | 8 | validate_path() # validate path so you can run from base directory 9 | 10 | from VISUALIZE.mcom import mcom 11 | 12 | mcv = mcom( 13 | path='./TEMP', # path to generate log 14 | draw_mode='Img', # draw mode 15 | resume_mod=True, # resume from previous session 16 | # figsize=(48,12), # manual fig size 17 | resume_file='ZHECKPOINT/RVE-drone2-ppoma-run1/logger/mcom_buffer_0____starting_session.txt', # pick up from a specific session txt 18 | image_path='./temp2.jpg', # target image directory 19 | smooth_level=40, # smooth line level 20 | # rec_exclude=["r*", "n*", 21 | # "*0.00*", 22 | # "*0.01*", 23 | # "*0.04*", 24 | # "*0.06*", 25 | # "*0.11*", 26 | # "*0.18*", 27 | # "*0.25*", 28 | # ], 29 | ) 30 | 31 | input('wait complete') 32 | 33 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/multi_team.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/multi_team.jpg -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/simple_framework.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/simple_framework.jpg -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/timeline.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/timeline.jpg -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画11.gif -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画12-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画12-1.gif -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画13.gif -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画9.gif -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画x7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/VISUALIZE/md_imgs/动画x7.gif -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/VISUALIZE/threejs_replay.py: -------------------------------------------------------------------------------- 1 | import os, sys 2 | import argparse 3 | from VISUALIZE.mcom import * 4 | from VISUALIZE.mcom_replay import RecallProcessThreejs 5 | from UTIL.network import find_free_port 6 | 7 | 8 | if __name__ == '__main__': 9 | parser = argparse.ArgumentParser(description='HMP') 10 | parser.add_argument('-f', '--file', help='Directory of chosen file', default='TEMP/v2d_logger/backup.dp.gz') 11 | parser.add_argument('-p', '--port', help='The port for web server') 12 | args, unknown = parser.parse_known_args() 13 | if hasattr(args, 'file'): 14 | path = args.file 15 | else: 16 | assert False, (r"parser.add_argument('-f', '--file', help='The node name is?')") 17 | 18 | if hasattr(args, 'port') and args.port is not None: 19 | port = int(args.port) 20 | else: 21 | port = find_free_port() 22 | print('no --port arg, auto find:', port) 23 | 24 | load_via_json = (hasattr(args, 'cfg') and args.cfg is not None) 25 | 26 | rp = RecallProcessThreejs(path, port) 27 | rp.start() 28 | rp.join() 29 | 30 | 31 | ''' 32 | 33 | note=RVE-drone1-fixaa-run2 34 | cp -r ./ZHECKPOINT/$note ./ZHECKPOINT/$note-bk 35 | cp -r ./ZHECKPOINT/$note/experiment.jsonc ./ZHECKPOINT/$note/experiment-bk.jsonc 36 | cp -r ./ZHECKPOINT/$note/experiment.jsonc ./ZHECKPOINT/$note/train.jsonc 37 | cp -r ./ZHECKPOINT/$note/experiment.jsonc ./ZHECKPOINT/$note/test.jsonc 38 | 39 | python << __EOF__ 40 | import commentjson as json 41 | file = "./ZHECKPOINT/$note/test.jsonc" 42 | print(file) 43 | with open(file, encoding='utf8') as f: 44 | json_data = json.load(f) 45 | json_data["config.py->GlobalConfig"]["num_threads"] = 1 46 | json_data["config.py->GlobalConfig"]["fold"] = 1 47 | json_data["config.py->GlobalConfig"]["test_only"] = True 48 | json_data["MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig"]["TimeDilation"] = 1 49 | json_data["ALGORITHM.conc_4hist_hete.foundation.py->AlgorithmConfig"]["load_checkpoint"] = True 50 | with open(file, 'w') as f: 51 | json.dump(json_data, f, indent=4) 52 | __EOF__ 53 | 54 | python main.py -c ./ZHECKPOINT/$note/test.jsonc 55 | 56 | 57 | 58 | 59 | ''' -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/bashrc_suffix: -------------------------------------------------------------------------------- 1 | ulimit -n 4096 2 | alias nv='watch -n 0.35 nvidia-smi' 3 | alias xrdp_reset='rm -f /var/run/xrdp/xrdp-sesman.pid' 4 | alias fq='proxychains' 5 | alias killhmp='kill -9 $(ps -ef | grep Hmap | grep hmp | grep -v grep | awk '"'"'{print $ 2}'"'"')' 6 | alias killpy='kill -9 $(ps -ef | grep python | grep hmp | grep -v grep | awk '"'"'{print $ 2}'"'"')' 7 | alias killsc='kill -9 $(ps -ef | grep StarCraft | grep hmp | grep -v grep | awk '"'"'{print $ 2}'"'"')' 8 | alias killvs='kill -9 $(ps -ef | grep vscode | grep hmp | grep -v grep | awk '"'"'{print $ 2}'"'"')' 9 | alias killnb='kill -9 $(ps -ef | grep ipykernel | grep hmp | grep -v grep | awk '"'"'{print $ 2}'"'"')' 10 | alias hmp='python main.py --cfg' 11 | alias vscode='code --no-sandbox' 12 | alias killue='kill -9 $(ps -ef | grep UHMP | grep hmp | grep -v grep | awk '"'"'{print $ 2}'"'"')' 13 | alias ftop='top -E g -s' -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/examples/uhmap/ppoma+intercept.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "ppoma-intercept",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "test_epoch": 512, 13 | "interested_team": 0, 14 | "seed": 10098, 15 | "device": "cpu", 16 | "max_n_episode": 5000000, 17 | "fold": 1, 18 | "backup_files": [ 19 | "MISSION/uhmap" 20 | ] 21 | }, 22 | 23 | 24 | // --- Part2: config MISSION --- 25 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 26 | "N_AGENT_EACH_TEAM": [5, 12], 27 | "MaxEpisodeStep": 100, 28 | "StepGameTime": 0.5, 29 | "StateProvided": false, 30 | "render": false, // note: random seed has different impact on renderer and server 31 | "UElink2editor": false, 32 | "HeteAgents": true, 33 | "UnrealLevel": "UhmapIntercept", 34 | "SubTaskSelection": "UhmapIntercept", 35 | "UhmapVersion":"3.5", 36 | "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxNoEditor/UHMP.sh", 37 | "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxServer/UHMPServer.sh", 38 | "TimeDilation": 2, // simulation time speed up, larger is faster 39 | "TEAM_NAMES": [ 40 | "ALGORITHM.ppo_ma.foundation->ReinforceAlgorithmFoundation", 41 | "TEMP.TEAM2.ALGORITHM.ppo_ma.foundation->ReinforceAlgorithmFoundation", 42 | ] 43 | }, 44 | 45 | 46 | // --- Part3: config ALGORITHM 1/2 --- 47 | "ALGORITHM.ppo_ma.shell_env.py->ShellEnvConfig": { 48 | "add_avail_act": true 49 | }, 50 | "ALGORITHM.ppo_ma.foundation.py->AlgorithmConfig": { 51 | "train_traj_needed": 64, 52 | "use_normalization": true, 53 | "load_specific_checkpoint": "", 54 | "gamma": 0.99, 55 | "gamma_in_reward_forwarding": "True", 56 | "gamma_in_reward_forwarding_value": 0.95, 57 | "prevent_batchsize_oom": "True", 58 | "lr": 0.0004, 59 | "ppo_epoch": 24, 60 | "policy_resonance": false, 61 | "debug": true, 62 | "n_entity_placeholder": 11 63 | }, 64 | // --- Part3: config ALGORITHM 2/2 --- 65 | "TEMP.TEAM2.ALGORITHM.ppo_ma.shell_env.py->ShellEnvConfig": { 66 | "add_avail_act": true 67 | }, 68 | "TEMP.TEAM2.ALGORITHM.ppo_ma.foundation.py->AlgorithmConfig": { 69 | "train_traj_needed": 64, 70 | "use_normalization": true, 71 | "load_specific_checkpoint": "", 72 | "gamma": 0.99, 73 | "gamma_in_reward_forwarding": "True", 74 | "gamma_in_reward_forwarding_value": 0.95, 75 | "prevent_batchsize_oom": "True", 76 | "lr": 0.0004, 77 | "ppo_epoch": 24, 78 | "policy_resonance": false, 79 | "debug": true, 80 | "n_entity_placeholder": 11 81 | }, 82 | 83 | 84 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/examples/uhmap/ppoma+predatorprey.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "ppoma-predatorprey",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "test_epoch": 512, 13 | "interested_team": 0, 14 | "seed": 10098, 15 | "device": "cpu", 16 | "max_n_episode": 5000000, 17 | "fold": 1, 18 | "backup_files": [ 19 | "MISSION/uhmap" 20 | ] 21 | }, 22 | 23 | 24 | // --- Part2: config MISSION --- 25 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 26 | "N_AGENT_EACH_TEAM": [10, 3], 27 | "MaxEpisodeStep": 100, 28 | "StepGameTime": 0.5, 29 | "StateProvided": false, 30 | "render": false, // note: random seed has different impact on renderer and server 31 | "UElink2editor": false, 32 | "HeteAgents": true, 33 | "UnrealLevel": "UhmapLargeScale", 34 | "SubTaskSelection": "UhmapPreyPredator", 35 | "UhmapVersion":"3.5", 36 | "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxNoEditor/UHMP.sh", 37 | "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxServer/UHMPServer.sh", 38 | "TimeDilation": 2, // simulation time speed up, larger is faster 39 | "TEAM_NAMES": [ 40 | "ALGORITHM.ppo_ma.foundation->ReinforceAlgorithmFoundation", 41 | "TEMP.TEAM2.ALGORITHM.ppo_ma.foundation->ReinforceAlgorithmFoundation", 42 | ] 43 | }, 44 | 45 | 46 | // --- Part3: config ALGORITHM 1/2 --- 47 | "ALGORITHM.ppo_ma.shell_env.py->ShellEnvConfig": { 48 | "add_avail_act": true 49 | }, 50 | "ALGORITHM.ppo_ma.foundation.py->AlgorithmConfig": { 51 | "train_traj_needed": 64, 52 | "use_normalization": true, 53 | "load_specific_checkpoint": "", 54 | "gamma": 0.99, 55 | "gamma_in_reward_forwarding": "True", 56 | "gamma_in_reward_forwarding_value": 0.95, 57 | "prevent_batchsize_oom": "True", 58 | "lr": 0.0004, 59 | "ppo_epoch": 24, 60 | "policy_resonance": false, 61 | "debug": true, 62 | "n_entity_placeholder": 11 63 | }, 64 | // --- Part3: config ALGORITHM 2/2 --- 65 | "TEMP.TEAM2.ALGORITHM.ppo_ma.shell_env.py->ShellEnvConfig": { 66 | "add_avail_act": true 67 | }, 68 | "TEMP.TEAM2.ALGORITHM.ppo_ma.foundation.py->AlgorithmConfig": { 69 | "train_traj_needed": 64, 70 | "use_normalization": true, 71 | "load_specific_checkpoint": "", 72 | "gamma": 0.99, 73 | "gamma_in_reward_forwarding": "True", 74 | "gamma_in_reward_forwarding_value": 0.95, 75 | "prevent_batchsize_oom": "True", 76 | "lr": 0.0004, 77 | "ppo_epoch": 24, 78 | "policy_resonance": false, 79 | "debug": true, 80 | "n_entity_placeholder": 11 81 | }, 82 | 83 | 84 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/examples/uhmap/ppoma_waterdrop.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "ppoma-waterdorp",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "mt_act_order": "new_method", 13 | "test_epoch": 512, 14 | "interested_team": 0, 15 | "seed": 10098, 16 | "device": "cpu", 17 | "max_n_episode": 5000000, 18 | "fold": 1, 19 | "backup_files": [ 20 | "MISSION/uhmap" 21 | ] 22 | }, 23 | 24 | 25 | // --- Part2: config MISSION --- 26 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 27 | "N_AGENT_EACH_TEAM": [ 10, 2 ], // 10 ships, 2 waterdrops 28 | "MaxEpisodeStep": 100, 29 | "StepGameTime": 0.5, 30 | "StateProvided": false, 31 | "render": false, // note: random seed has different impact on renderer and server 32 | "UElink2editor": true, 33 | "HeteAgents": true, 34 | "UnrealLevel": "UhmapWaterdrop", 35 | "SubTaskSelection": "UhmapWaterdrop", 36 | "UhmapVersion":"3.5", 37 | "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxNoEditor/UHMP.sh", 38 | "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxServer/UHMPServer.sh", 39 | "TimeDilation": 64, // simulation time speed up, larger is faster 40 | "TEAM_NAMES": [ 41 | "ALGORITHM.my_ai.foundation->ReinforceAlgorithmFoundation", 42 | "TEMP.TEAM2.ALGORITHM.my_ai.foundation->ReinforceAlgorithmFoundation", 43 | ] 44 | }, 45 | 46 | 47 | // --- Part3: config ALGORITHM 1/2 --- 48 | "ALGORITHM.my_ai.foundation.py->AlgorithmConfig": { 49 | }, 50 | 51 | // --- Part3: config ALGORITHM 2/2 --- 52 | "TEMP.TEAM2.ALGORITHM.my_ai.foundation.py->AlgorithmConfig": { 53 | }, 54 | 55 | 56 | 57 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/examples/uhmap/random_waterdrop.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "ppoma-waterdorp",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "mt_act_order": "new_method", 13 | "test_epoch": 512, 14 | "interested_team": 0, 15 | "seed": 10098, 16 | "device": "cpu", 17 | "max_n_episode": 5000000, 18 | "fold": 1, 19 | "backup_files": [ 20 | "MISSION/uhmap" 21 | ] 22 | }, 23 | 24 | 25 | // --- Part2: config MISSION --- 26 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 27 | "N_AGENT_EACH_TEAM": [ 10, 2 ], // 10 ships, 2 waterdrops 28 | "MaxEpisodeStep": 100, 29 | "StepGameTime": 0.5, 30 | "StateProvided": false, 31 | "render": false, // note: random seed has different impact on renderer and server 32 | "UElink2editor": true, 33 | "HeteAgents": true, 34 | "UnrealLevel": "UhmapWaterdrop", 35 | "SubTaskSelection": "UhmapWaterdrop", 36 | "UhmapVersion":"3.5", 37 | "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxNoEditor/UHMP.sh", 38 | "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxServer/UHMPServer.sh", 39 | "TimeDilation": 64, // simulation time speed up, larger is faster 40 | "TEAM_NAMES": [ 41 | "ALGORITHM.my_ai.foundation->DiscreteRLFoundation", 42 | "TEMP.TEAM2.ALGORITHM.my_ai.foundation->DiscreteRLFoundation", 43 | ] 44 | }, 45 | 46 | 47 | // --- Part3: config ALGORITHM 1/2 --- 48 | "ALGORITHM.my_ai.foundation.py->AlgorithmConfig": { 49 | }, 50 | 51 | // --- Part3: config ALGORITHM 2/2 --- 52 | "TEMP.TEAM2.ALGORITHM.my_ai.foundation.py->AlgorithmConfig": { 53 | }, 54 | 55 | 56 | 57 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/examples/uhmap/uhmp_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/ZDOCS/examples/uhmap/uhmp_demo.gif -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/pip_requirement.md: -------------------------------------------------------------------------------- 1 | # all pip requirements 2 | 3 | First of all, python version must >= 3.8, then, use pip to install following packages: 4 | 5 | ## Group 1: Common 6 | ``` 7 | numpy scipy torch gym scikit-learn pygame 8 | ``` 9 | 10 | 11 | ## Group 2: Unreal-HMAP and Starcraft 12 | ``` 13 | lz4 smac 14 | ``` 15 | 16 | ## Group 3: Visual 17 | ``` 18 | flask waitress colorama matplotlib ipykernel 19 | ``` 20 | 21 | ## Group 4: Performance 22 | ``` 23 | numba cython 24 | ``` 25 | 26 | ## Group 5: Functional 27 | ``` 28 | func_timeout commentjson PyYAML onedrivedownloader redis filelock 29 | ``` 30 | 31 | ## Group 6: Remote and management 32 | ``` 33 | paramiko psutil setproctitle sacred 34 | ``` 35 | 36 | ## install 37 | ``` 38 | pip install torch 39 | pip install numpy scipy gym scikit-learn pygame lz4 smac flask waitress colorama matplotlib ipykernel numba cython func_timeout commentjson PyYAML onedrivedownloader redis filelock paramiko psutil setproctitle sacred 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/setup_no_docker.md: -------------------------------------------------------------------------------- 1 | # setup on ubuntu without docker 2 | 3 | Warning! Always use docker if possible! 4 | 5 | 如果可以选择,请一定先尝试docker方案 6 | 7 | This file is written for those who are very confident to solve all kinds of problems and errors on their own! 8 | 9 | 本文件仅写给对解决各种软件依赖十分自信的老手作为参考 10 | 11 | ## python version 12 | 13 | ``` sh 14 | python 3.8 15 | ``` 16 | ## pip requirements 17 | Please read [pip_requirement](pip_requirement.md) 18 | 19 | 20 | ## Download and extract starcraft 21 | ``` sh 22 | cd /home/hmp 23 | git clone https://github.com/binary-husky/uhmap-visual-tool.git 24 | python linux_deploy_starcraft_all_versions.py 25 | mv /home/hmp/uhmap-visual-tool/UnrealEngine/home/hmp/* /home/hmp 26 | ``` 27 | 28 | ## Download Unreal-HMAP binary client 29 | Please read [get UHMP](use_unreal_hmap.md) 30 | 39 | 40 | ## Download and extract HMAP main framework 41 | ``` sh 42 | cd /home/hmp 43 | git clone https://github.com/binary-husky/hmp2g.git 44 | cd /home/hmp/hmp2g 45 | ``` 46 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/setup_ubuntu.md: -------------------------------------------------------------------------------- 1 | # 1. install docker 2 | ``` 3 | sudo apt update 4 | sudo apt install docker docker.io curl 5 | ``` 6 | 7 | # 2. intsall nvidia-runtime 8 | 9 | ``` sh 10 | # https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#installing-on-ubuntu-and-debian 11 | 12 | # step 1 13 | curl https://get.docker.com | sh \ 14 | && sudo systemctl --now enable docker 15 | 16 | # step 2 17 | distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ 18 | && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ 19 | && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \ 20 | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ 21 | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list 22 | 23 | # step 3:Install the nvidia-docker2 package (and dependencies) after updating the package listing: 24 | 25 | sudo apt-get update 26 | sudo apt-get install -y nvidia-docker2 27 | 28 | # Restart the Docker daemon to complete the installation after setting the default runtime: 29 | 30 | sudo systemctl restart docker 31 | ``` 32 | 33 | 34 | # 3. Download docker image and open it 35 | 36 | In this part, please read [SetupDocker](./setup_docker.md) 37 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/setup_ue_docker.md: -------------------------------------------------------------------------------- 1 | # Start up UE Docker Container | 2 | Warning! Unreal engine is included in this docker, 500GB disk space is needed. 3 | 4 | 5 | ```sh 6 | # 检查docker是否可用 (如果已经身处某个docker容器内,则docker不可用,请找到宿主系统,然后再运行以下命令) 7 | sudo docker ps 8 | ``` 9 | 10 | ```sh 11 | # 启动docker容器 12 | sudo docker run -itd --name $USER-swarm \ 13 | --net host \ 14 | --memory 500G \ 15 | --gpus all \ 16 | --shm-size=32G \ 17 | fuqingxu/hmp:unreal-trim 18 | 19 | 20 | # 修改docker容器的ssh的端口到 4567,自行选择合适的空闲端口 21 | sudo docker exec -it $USER-swarm sed -i 's/2266/4567/g' /etc/ssh/sshd_config 22 | # 运行docker容器的ssh 23 | sudo docker exec -it $USER-swarm service ssh start 24 | # 运行docker容器的bash 25 | sudo docker exec -it $USER-swarm bash 26 | ``` 27 | 28 | Now find a computer to ssh into it: ```ssh hmp@your_host_ip -p 2233``` 29 | ``` 30 | # IP Addr: share with the host 31 | # SSH Port 4567 32 | # UserName: hmp 33 | # Password: hmp 34 | ``` 35 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/ssh_pubkey.sh: -------------------------------------------------------------------------------- 1 | key_name=home2 2 | mkdir -p ./TEMP 3 | wget --user=fuqingxu --password=PASSWORD_FOR_NEXTCLOUD http://cloud.fuqingxu.top:4080/remote.php/dav/files/fuqingxu/keys/$key_name.pub -O ./TEMP/_xkey 4 | mkdir -p ~/.ssh/ 5 | cat ./TEMP/_xkey >> ~/.ssh/authorized_keys 6 | cat ~/.ssh/authorized_keys 7 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZDOCS/use_unreal_hmap.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Get Unreal-HMAP Binary Client (Win & Linux) 4 | 5 | - Method 1: 6 | ``` python 7 | from MISSION.uhmap.auto_download import download_client_binary_on_platform 8 | download_client_binary_on_platform( 9 | desired_path="./UnrealHmapBinary/Version3.5/LinuxNoEditor/UHMP.sh", 10 | # desired_path="./UnrealHmapBinary/Version3.5/LinuxNoEditor/UHMP.exe", 11 | desired_version="3.5", 12 | is_render_client=True, 13 | platform="Linux", 14 | # platform="Windows", 15 | 16 | 17 | ) 18 | ``` 19 | 20 | - Method 2 (manual): download uhmap file manifest (a json file) 21 | ``` 22 | https://ageasga-my.sharepoint.com/:u:/g/personal/fuqingxu_yiteam_tech/EVmCQMSUWV5MgREWaxiz_GoBalBRV3DWBU3ToSJ5OTQaLQ?e=I8yjl9 23 | ``` 24 | Open this json file, choose the version and platform you want, download and unzip it. 25 | 26 | - Method 3 (Compile from source): 27 | ``` 28 | https://github.com/binary-husky/unreal-hmp 29 | ``` 30 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZHECKPOINT/uhmap_hete10vs10/model_trained.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/ZHECKPOINT/uhmap_hete10vs10/model_trained.pt -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/ZHECKPOINT/uhmap_hete10vs10/rec.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binary-husky/unreal-map/6454c72cc242c47b67b9eea8681c6e188543bec0/PythonExample/hmp_minimal_modules/ZHECKPOINT/uhmap_hete10vs10/rec.jpeg -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/agent_with_sensor.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "config.py->GlobalConfig": { 3 | "note": "ppoma-uhmap10vs10", 4 | "env_name": "uhmap", 5 | "env_path": "MISSION.uhmap", 6 | "draw_mode": "Img", 7 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 8 | "report_reward_interval": 256, 9 | "test_interval": 5120, 10 | "test_epoch": 256, 11 | "interested_team": 0, 12 | "seed": 8834, 13 | "device": "cuda", 14 | "mt_act_order": "new_method", 15 | "max_n_episode": 5000000, 16 | "fold": 1, 17 | "backup_files": [ 18 | "ALGORITHM/ppo_ma", 19 | "MISSION/uhmap" 20 | ] 21 | }, 22 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 23 | "N_AGENT_EACH_TEAM": [4, 4], // update N_AGENT_EACH_TEAM 24 | "MaxEpisodeStep": 125, 25 | "StepGameTime": 0.5, 26 | "StateProvided": false, 27 | "render": false, 28 | "UElink2editor": true, 29 | "HeteAgents": true, 30 | "UnrealLevel": "UhmapLargeScale", 31 | "SubTaskSelection": "UhmapLargeScale", 32 | "UhmapVersion": "3.5", 33 | "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxNoEditor/UHMP.sh", 34 | "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.5/LinuxServer/UHMPServer.sh", 35 | "TimeDilation": 64, 36 | "TEAM_NAMES": [ 37 | "ALGORITHM.random.foundation->DummyRandomControllerWithActionSetV1", 38 | "TEMP.ALGORITHM.random.foundation->DummyRandomControllerWithActionSetV1", 39 | ] 40 | }, 41 | "MISSION.uhmap.SubTasks.UhmapLargeScaleConf.py->SubTaskConfig":{ 42 | "agent_list": [ 43 | { "team":0, "tid":0, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_air" }, 44 | { "team":0, "tid":1, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_ground" }, 45 | { "team":0, "tid":2, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_ground" }, 46 | { "team":0, "tid":3, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_ground" }, 47 | 48 | 49 | { "team":1, "tid":0, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_air" }, 50 | { "team":1, "tid":1, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_ground" }, 51 | { "team":1, "tid":2, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_ground" }, 52 | { "team":1, "tid":3, "type":"Lv2_TestAgentSensor", "init_fn_name":"init_ground" }, 53 | 54 | ], 55 | "ActionFormat": "ASCII" 56 | 57 | }, 58 | // --- Part3: config ALGORITHM 1/2 --- 59 | "ALGORITHM.random.foundation.py->AlgorithmConfig": { 60 | "preserve": "" 61 | }, 62 | 63 | // --- Part3: config ALGORITHM 2/2 --- 64 | "ALGORITHM.ppo_ma.shell_env.py->ShellEnvConfig": { 65 | "add_avail_act": true 66 | }, 67 | "ALGORITHM.ppo_ma.foundation.py->AlgorithmConfig": { 68 | "train_traj_needed": 256, 69 | "use_normalization": true, 70 | "load_specific_checkpoint": "", 71 | "gamma": 0.99, 72 | "gamma_in_reward_forwarding": "True", 73 | "gamma_in_reward_forwarding_value": 0.95, 74 | "prevent_batchsize_oom": "True", 75 | "lr": 0.0004, 76 | "ppo_epoch": 24, 77 | "policy_resonance": false, 78 | "debug": true, 79 | "n_entity_placeholder": 11 80 | } 81 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/attack_post.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "random-attackpost",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "mt_act_order": "new_method", 13 | "test_epoch": 512, 14 | "interested_team": 0, 15 | "seed": 10098, 16 | "device": "cpu", 17 | "max_n_episode": 5000000, 18 | "fold": 1, 19 | "backup_files": [ 20 | "MISSION/uhmap" 21 | ] 22 | }, 23 | 24 | 25 | // --- Part2: config MISSION --- 26 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 27 | "N_AGENT_EACH_TEAM": [ 8, 1 ], // 10 ships, 2 waterdrops 28 | "MaxEpisodeStep": 100, 29 | "StepGameTime": 0.5, 30 | "StateProvided": false, 31 | "render": true, // note: random seed has different impact on renderer and server 32 | "UElink2editor": false, 33 | "HeteAgents": false, 34 | "UnrealLevel": "UhmapAttackPost", 35 | "SubTaskSelection": "UhmapAttackPost", 36 | "UhmapVersion":"3.8", 37 | "UhmapRenderExe": "../../Build/WindowsNoEditor/UHMP.exe", 38 | "UhmapServerExe": "../../Build/WindowsServer/UHMPServer.exe", 39 | // "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxNoEditor/UHMP.sh", 40 | // "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxServer/UHMPServer.sh", 41 | "TimeDilation": 64, // simulation time speed up, larger is faster 42 | "TEAM_NAMES": [ 43 | "ALGORITHM.script_ai.a_attackpost->AttackPostPreprogramBaseline", 44 | // "ALGORITHM.random.foundation->RandomControllerWithActionSetV2", 45 | "TEMP.TEAM2.ALGORITHM.random.foundation->RandomControllerWithActionSetV4", 46 | ] 47 | }, 48 | 49 | 50 | // --- Part3: config ALGORITHM 1/2 --- 51 | "ALGORITHM.script_ai.a_attackpost.py->AlgorithmConfig": { 52 | }, 53 | 54 | // --- Part3: config ALGORITHM 2/2 --- 55 | "TEMP.TEAM2.ALGORITHM.random.foundation.py->AlgorithmConfig": { 56 | }, 57 | 58 | 59 | 60 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/carrier.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "random-attackpost",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "mt_act_order": "new_method", 13 | "test_epoch": 512, 14 | "interested_team": 0, 15 | "seed": 10098, 16 | "device": "cpu", 17 | "max_n_episode": 5000000, 18 | "fold": 1, 19 | "backup_files": [ 20 | "MISSION/uhmap" 21 | ] 22 | }, 23 | 24 | 25 | // --- Part2: config MISSION --- 26 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 27 | "N_AGENT_EACH_TEAM": [ 20, 20 ], // 10 ships, 2 waterdrops 28 | "MaxEpisodeStep": 100, 29 | "StepGameTime": 0.5, 30 | "StateProvided": false, 31 | "render": false, // note: random seed has different impact on renderer and server 32 | "UElink2editor": true, 33 | "HeteAgents": false, 34 | "UnrealLevel": "UhmapCarrier", 35 | "SubTaskSelection": "UhmapCarrier", 36 | "UhmapVersion":"3.8", 37 | "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxNoEditor/UHMP.sh", 38 | "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxServer/UHMPServer.sh", 39 | "TimeDilation": 64, // simulation time speed up, larger is faster 40 | "TEAM_NAMES": [ 41 | "ALGORITHM.random.foundation->RandomControllerWithActionSetV1", 42 | // "ALGORITHM.random.foundation->RandomControllerWithActionSetV2", 43 | "TEMP.TEAM2.ALGORITHM.random.foundation->RandomControllerWithActionSetV1", 44 | ] 45 | }, 46 | 47 | 48 | // --- Part3: config ALGORITHM 1/2 --- 49 | "ALGORITHM.random.foundation.py->AlgorithmConfig": { 50 | }, 51 | 52 | // --- Part3: config ALGORITHM 2/2 --- 53 | "TEMP.TEAM2.ALGORITHM.random.foundation.py->AlgorithmConfig": { 54 | }, 55 | 56 | 57 | 58 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/cradle.py: -------------------------------------------------------------------------------- 1 | from UTIL.network import UnixTcpClientP2P, UnixTcpServerP2P 2 | import time 3 | 4 | 5 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/escape.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "random-escape",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "mt_act_order": "new_method", 13 | "test_epoch": 512, 14 | "interested_team": 0, 15 | "seed": 10098, 16 | "device": "cpu", 17 | "max_n_episode": 5000000, 18 | "fold": 1, 19 | "backup_files": [ 20 | "MISSION/uhmap" 21 | ] 22 | }, 23 | 24 | 25 | // --- Part2: config MISSION --- 26 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 27 | "N_AGENT_EACH_TEAM": [ 8, 4 ], 28 | "MaxEpisodeStep": 100, 29 | "StepGameTime": 0.5, 30 | "StateProvided": false, 31 | "render": true, // note: random seed has different impact on renderer and server 32 | "UElink2editor": true, 33 | "HeteAgents": false, 34 | "UnrealLevel": "UhmapAttackPost", 35 | "SubTaskSelection": "UhmapEscape", 36 | "UhmapVersion":"3.8", 37 | "UhmapRenderExe": "../../Build/WindowsNoEditor/UHMP.exe", 38 | "UhmapServerExe": "../../Build/WindowsServer/UHMPServer.exe", 39 | // "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxNoEditor/UHMP.sh", 40 | // "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxServer/UHMPServer.sh", 41 | "TimeDilation": 64, // simulation time speed up, larger is faster 42 | "TEAM_NAMES": [ 43 | "ALGORITHM.script_ai.a_escape->EscapeGreenPreprogramBaseline", 44 | // "ALGORITHM.random.foundation->RandomControllerWithActionSetV2", 45 | "ALGORITHM.script_ai.a_escape->EscapeRedPreprogramBaseline", 46 | ] 47 | }, 48 | 49 | 50 | "ALGORITHM.script_ai.a_escape.py->AlgorithmConfig": { 51 | }, 52 | 53 | 54 | 55 | 56 | 57 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/formation.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "random-attackpost",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "mt_act_order": "new_method", 13 | "test_epoch": 512, 14 | "interested_team": 0, 15 | "seed": 10098, 16 | "device": "cpu", 17 | "max_n_episode": 5000000, 18 | "fold": 1, 19 | "backup_files": [ 20 | "MISSION/uhmap" 21 | ] 22 | }, 23 | 24 | 25 | // --- Part2: config MISSION --- 26 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 27 | "N_AGENT_EACH_TEAM": [ 20, 20 ], // 10 ships, 2 waterdrops 28 | "MaxEpisodeStep": 100, 29 | "StepGameTime": 0.5, 30 | "StateProvided": false, 31 | "render": false, // note: random seed has different impact on renderer and server 32 | "UElink2editor": true, 33 | "HeteAgents": false, 34 | "UnrealLevel": "UhmapFormation", 35 | "SubTaskSelection": "UhmapFormation", 36 | "UhmapVersion":"3.8", 37 | "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxNoEditor/UHMP.sh", 38 | "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxServer/UHMPServer.sh", 39 | "TimeDilation": 64, // simulation time speed up, larger is faster 40 | "TEAM_NAMES": [ 41 | "ALGORITHM.random.foundation->RandomControllerWithMomentumAgent", 42 | // "ALGORITHM.random.foundation->RandomControllerWithActionSetV2", 43 | "TEMP.TEAM2.ALGORITHM.random.foundation->RandomControllerWithMomentumAgent" 44 | ] 45 | }, 46 | 47 | 48 | // --- Part3: config ALGORITHM 1/2 --- 49 | "ALGORITHM.random.foundation.py->AlgorithmConfig": { 50 | }, 51 | 52 | // --- Part3: config ALGORITHM 2/2 --- 53 | "TEMP.TEAM2.ALGORITHM.random.foundation.py->AlgorithmConfig": { 54 | } 55 | 56 | 57 | 58 | } -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/multi_server.py: -------------------------------------------------------------------------------- 1 | base = """ 2 | { 3 | "config.py->GlobalConfig": { 4 | "note": "sc-MMM2-conc-db1", // experiment note, also means the log saving directory 5 | // "train_time_testing": "False", // do not manage train time testing, pymarl env manage the testing itself 6 | "env_name":"sc2", // starcraft 2 7 | "env_path":"MISSION.starcraft.sc2_env_wrapper", // starcraft 2 8 | // "interested_agent_num":100, // only for reward logging, **not needed because sc2 use uniform team reward 9 | "draw_mode": "Img", // plot curlves as image 10 | "num_threads": "16", // number of parallel envs 11 | "report_reward_interval": "128", // report the reward averaging x episodes 12 | "test_interval": "512", // begin a test run every x episodes, test run is managed by pymarl side 13 | "test_epoch": "64", // begin a test run every x episodes, test run is managed by pymarl side 14 | "device": "cuda", 15 | "max_n_episode": 1500000, 16 | "fold": "1", // each linux process handle x parallel envs 17 | "backup_files":[ 18 | ] 19 | }, 20 | 21 | "MISSION.starcraft.sc2_env_wrapper.py->ScenarioConfig": { 22 | "map_": "MMM2", 23 | "sc_version": "2.4.6", 24 | // "map_": "5m_vs_6m", 25 | // "SINGLE_TEAM_N_AGENT": 5, 26 | // "episode_limit": 60, 27 | // "reward_vec": true, 28 | "TEAM_NAMES": [ 29 | "ALGORITHM.conc_4hist_scdb.foundation->ReinforceAlgorithmFoundation" 30 | ] 31 | }, 32 | 33 | "ALGORITHM.conc_4hist_scdb.foundation.py->AlgorithmConfig": { 34 | "train_traj_needed": "128", 35 | "n_focus_on": 3, 36 | "actor_attn_mod": "False", 37 | "lr": 0.0001, 38 | "ppo_epoch": 24, 39 | "load_checkpoint": "False" 40 | } 41 | } 42 | """ 43 | 44 | 45 | import commentjson as json 46 | import numpy as np 47 | base_conf = json.loads(base) 48 | n_run = 4 49 | n_run_mode = [ 50 | { 51 | "addr": "localhost:2266", 52 | "usr": "hmp", 53 | "pwd": "hmp" 54 | }, 55 | ]*n_run 56 | assert len(n_run_mode)==n_run 57 | 58 | sum_note = "MMM2-conc4hist" 59 | conf_override = { 60 | 61 | "config.py->GlobalConfig-->seed": 62 | [ 63 | np.random.randint(0, 10000) for _ in range(n_run) 64 | ], 65 | 66 | "config.py->GlobalConfig-->device": 67 | [ 68 | 'cuda', 69 | 'cuda', 70 | 'cuda', 71 | 'cuda', 72 | ], 73 | 74 | "config.py->GlobalConfig-->note": 75 | [ 76 | "n_focus_on_run1_3focus", 77 | "n_focus_on_run2_3focus", 78 | "n_focus_on_run1_5focus", 79 | "n_focus_on_run2_5focus", 80 | ], 81 | 82 | "ALGORITHM.conc_4hist_scdb.foundation.py->AlgorithmConfig-->n_focus_on": 83 | [ 84 | 3, 85 | 3, 86 | 5, 87 | 5, 88 | ], 89 | } 90 | 91 | if __name__ == '__main__': 92 | # copy the experiments 93 | import shutil, os 94 | shutil.copyfile(__file__, os.path.join(os.path.dirname(__file__), 'batch_experiment_backup.py')) 95 | # run experiments remotely 96 | from UTIL.batch_exp import run_batch_exp 97 | run_batch_exp(sum_note, n_run, n_run_mode, base_conf, conf_override, __file__) 98 | -------------------------------------------------------------------------------- /PythonExample/hmp_minimal_modules/reproduce.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | // --- Part1: config HMP core --- 3 | "config.py->GlobalConfig": { 4 | "note": "random-reproduce",// http://localhost:59547 5 | "env_name": "uhmap", 6 | "env_path": "MISSION.uhmap", 7 | // "heartbeat_on": "False", 8 | "draw_mode": "Img", 9 | "num_threads": 1, // 请预留 num_threads * 1 GB 的内存空间 10 | "report_reward_interval": 128, 11 | "test_interval": 1280, 12 | "mt_act_order": "new_method", 13 | "test_epoch": 512, 14 | "interested_team": 0, 15 | "seed": 10098, 16 | "device": "cpu", 17 | "max_n_episode": 5000000, 18 | "fold": 1, 19 | "backup_files": [ 20 | "MISSION/uhmap" 21 | ] 22 | }, 23 | 24 | 25 | // --- Part2: config MISSION --- 26 | "MISSION.uhmap.uhmap_env_wrapper.py->ScenarioConfig": { 27 | "N_AGENT_EACH_TEAM": [ 200 ], // 8 agent, single team 28 | "MaxEpisodeStep": 50, 29 | "StepGameTime": 0.5, 30 | "StateProvided": false, 31 | "render": false, // note: random seed has different impact on renderer and server 32 | "UElink2editor": false, 33 | "HeteAgents": false, 34 | "UnrealLevel": "UhmapReproduce", 35 | "SubTaskSelection": "UhmapReproduce", 36 | "UhmapVersion":"3.8", 37 | "UhmapRenderExe": "../../Build/WindowsNoEditor/UHMP.exe", 38 | "UhmapServerExe": "../../Build/WindowsServer/UHMPServer.exe", 39 | // "UhmapRenderExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxNoEditor/UHMP.sh", 40 | // "UhmapServerExe": "/home/hmp/UnrealHmapBinary/Version3.8/LinuxServer/UHMPServer.sh", 41 | "TimeDilation": 1, // simulation time speed up, larger is faster 42 | "TEAM_NAMES": [ 43 | "ALGORITHM.script_ai.a_test_reproduce->TestReproduce", 44 | ] 45 | }, 46 | 47 | // --- Part3: config ALGORITHM 1/2 --- 48 | "ALGORITHM.script_ai.a_test_reproduce.py->AlgorithmConfig": { 49 | }, 50 | 51 | 52 | } -------------------------------------------------------------------------------- /Source/Jsonx/Jsonx.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | namespace UnrealBuildTool.Rules 4 | { 5 | public class Jsonx : ModuleRules 6 | { 7 | public Jsonx(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PublicDependencyModuleNames.AddRange( 10 | new string[] 11 | { 12 | "Core", 13 | } 14 | ); 15 | 16 | PrivateIncludePaths.AddRange( 17 | new string[] { 18 | "Jsonx/Private", 19 | } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/Jsonx/Private/JsonxModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "CoreMinimal.h" 4 | #include "JsonxGlobals.h" 5 | #include "Modules/ModuleInterface.h" 6 | #include "Modules/ModuleManager.h" 7 | 8 | 9 | DEFINE_LOG_CATEGORY(LogJsonx); 10 | 11 | 12 | /** 13 | * Implements the Jsonx module. 14 | */ 15 | class FJsonxModule 16 | : public IModuleInterface 17 | { 18 | public: 19 | 20 | // IModuleInterface interface 21 | 22 | virtual void StartupModule( ) override { } 23 | virtual void ShutdownModule( ) override { } 24 | 25 | virtual bool SupportsDynamicReloading( ) override 26 | { 27 | return false; 28 | } 29 | }; 30 | 31 | 32 | IMPLEMENT_MODULE(FJsonxModule, Jsonx); 33 | -------------------------------------------------------------------------------- /Source/Jsonx/Public/Jsonx.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | 6 | /* Boilerplate 7 | *****************************************************************************/ 8 | 9 | #include "Misc/MonolithicHeaderBoilerplate.h" 10 | MONOLITHIC_HEADER_BOILERPLATE() 11 | 12 | 13 | /* Public dependencies 14 | *****************************************************************************/ 15 | 16 | #include "Core.h" 17 | 18 | 19 | /* Public includes 20 | *****************************************************************************/ 21 | 22 | #include "JsonxGlobals.h" 23 | 24 | #include "Policies/JsonxPrintPolicy.h" 25 | #include "Policies/PrettyJsonxPrintPolicy.h" 26 | #include "Policies/CondensedJsonxPrintPolicy.h" 27 | 28 | #include "Serialization/JsonxTypes.h" 29 | #include "Dom/JsonxValue.h" 30 | #include "Dom/JsonxObject.h" 31 | 32 | #include "Serialization/JsonxReader.h" 33 | #include "Serialization/JsonxWriter.h" 34 | #include "Serialization/JsonxSerializer.h" 35 | #include "Serialization/JsonxSerializerMacros.h" 36 | -------------------------------------------------------------------------------- /Source/Jsonx/Public/JsonxGlobals.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | JSONX_API DECLARE_LOG_CATEGORY_EXTERN(LogJsonx, Log, All); 8 | -------------------------------------------------------------------------------- /Source/Jsonx/Public/Policies/CondensedJsonxPrintPolicy.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Policies/JsonxPrintPolicy.h" 7 | 8 | /** 9 | * Template for print policies that generate compressed output. 10 | * 11 | * @param CharType The type of characters to print, i.e. TCHAR or ANSICHAR. 12 | */ 13 | template 14 | struct TCondensedJsonxPrintPolicy 15 | : public TJsonxPrintPolicy 16 | { 17 | static inline void WriteLineTerminator(FArchive* Stream) {} 18 | static inline void WriteTabs(FArchive* Stream, int32 Count) {} 19 | static inline void WriteSpace(FArchive* Stream) {} 20 | }; 21 | -------------------------------------------------------------------------------- /Source/Jsonx/Public/Policies/JsonxPrintPolicy.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | /** 8 | * Base template for Jsonx print policies. 9 | * 10 | * @param CharType The type of characters to print, i.e. TCHAR or ANSICHAR. 11 | */ 12 | template 13 | struct TJsonxPrintPolicy 14 | { 15 | /** 16 | * Writes a single character to the output stream. 17 | * 18 | * @param Stream The stream to write to. 19 | * @param Char The character to write. 20 | */ 21 | static inline void WriteChar( FArchive* Stream, CharType Char ) 22 | { 23 | Stream->Serialize(&Char, sizeof(CharType)); 24 | } 25 | 26 | /** 27 | * Writes a string to the output stream. 28 | * 29 | * @param Stream The stream to write to. 30 | * @param String The string to write. 31 | */ 32 | static inline void WriteString( FArchive* Stream, const FString& String ) 33 | { 34 | const TCHAR* CharPtr = *String; 35 | 36 | for (int32 CharIndex = 0; CharIndex < String.Len(); ++CharIndex, ++CharPtr) 37 | { 38 | WriteChar(Stream, *CharPtr); 39 | } 40 | } 41 | }; 42 | 43 | 44 | /** 45 | * Specialization for TCHAR that allows direct copying from FString data. 46 | */ 47 | template <> 48 | inline void TJsonxPrintPolicy::WriteString( FArchive* Stream, const FString& String ) 49 | { 50 | Stream->Serialize((void*)*String, String.Len() * sizeof(TCHAR)); 51 | } 52 | 53 | 54 | #if !PLATFORM_TCHAR_IS_CHAR16 55 | 56 | /** 57 | * Specialization for UTF16CHAR that writes FString data UTF-16. 58 | */ 59 | template <> 60 | inline void TJsonxPrintPolicy::WriteString(FArchive* Stream, const FString& String) 61 | { 62 | // Note: This is a no-op on platforms that are using a 16-bit TCHAR 63 | FTCHARToUTF16 UTF16String(*String, String.Len()); 64 | 65 | Stream->Serialize((void*)UTF16String.Get(), UTF16String.Length() * sizeof(UTF16CHAR)); 66 | } 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /Source/Jsonx/Public/Policies/PrettyJsonxPrintPolicy.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Policies/JsonxPrintPolicy.h" 7 | 8 | /** 9 | * Template for print policies that generate human readable output. 10 | * 11 | * @param CharType The type of characters to print, i.e. TCHAR or ANSICHAR. 12 | */ 13 | template 14 | struct TPrettyJsonxPrintPolicy 15 | : public TJsonxPrintPolicy 16 | { 17 | static inline void WriteLineTerminator( FArchive* Stream ) 18 | { 19 | TJsonxPrintPolicy::WriteString(Stream, LINE_TERMINATOR); 20 | } 21 | 22 | static inline void WriteTabs( FArchive* Stream, int32 Count ) 23 | { 24 | CharType Tab = CharType('\t'); 25 | 26 | for (int32 i = 0; i < Count; ++i) 27 | { 28 | TJsonxPrintPolicy::WriteChar(Stream, Tab); 29 | } 30 | } 31 | 32 | static inline void WriteSpace( FArchive* Stream ) 33 | { 34 | TJsonxPrintPolicy::WriteChar(Stream, CharType(' ')); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /Source/Jsonx/Public/Serialization/JsonxTypes.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | class Error; 8 | 9 | /** 10 | * Jsonx (JavaScript Object Notation) is a lightweight data-interchange format. 11 | * Information on how it works can be found here: http://www.json.org/. 12 | * This code was written from scratch with only the Jsonx spec as a guide. 13 | * 14 | * In order to use Jsonx effectively, you need to be familiar with the Object/Value 15 | * hierarchy, and you should use the FJsonxObject class and FJsonxValue subclasses. 16 | */ 17 | 18 | /** 19 | * Represents all the types a Jsonx Value can be. 20 | */ 21 | enum class EJsonx 22 | { 23 | None, 24 | Null, 25 | String, 26 | Number, 27 | Boolean, 28 | Array, 29 | Object 30 | }; 31 | 32 | 33 | enum class EJsonxToken 34 | { 35 | None, 36 | Comma, 37 | CurlyOpen, 38 | CurlyClose, 39 | SquareOpen, 40 | SquareClose, 41 | Colon, 42 | String, 43 | 44 | // short values 45 | Number, 46 | True, 47 | False, 48 | Null, 49 | 50 | Identifier 51 | }; 52 | 53 | FORCEINLINE bool EJsonxToken_IsShortValue(EJsonxToken Token) 54 | { 55 | return Token >= EJsonxToken::Number && Token <= EJsonxToken::Null; 56 | } 57 | 58 | enum class EJsonxNotation 59 | { 60 | ObjectStart, 61 | ObjectEnd, 62 | ArrayStart, 63 | ArrayEnd, 64 | Boolean, 65 | String, 66 | Number, 67 | Null, 68 | Error 69 | }; 70 | -------------------------------------------------------------------------------- /Source/JsonxUtilities/JsonxUtilities.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class JsonxUtilities : ModuleRules 6 | { 7 | public JsonxUtilities( ReadOnlyTargetRules Target ) : base(Target) 8 | { 9 | PublicDependencyModuleNames.AddRange( 10 | new string[] 11 | { 12 | "Core", 13 | "CoreUObject", 14 | "Jsonx", 15 | } 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Source/JsonxUtilities/Private/JsonxObjectWrapper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "JsonxObjectWrapper.h" 4 | #include "Policies/CondensedJsonxPrintPolicy.h" 5 | #include "Serialization/JsonxReader.h" 6 | #include "Serialization/JsonxSerializer.h" 7 | 8 | bool FJsonxObjectWrapper::ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText) 9 | { 10 | // read JSONX string from Buffer 11 | FString Jsonx; 12 | if (*Buffer == TCHAR('"')) 13 | { 14 | int32 NumCharsRead = 0; 15 | if (!FParse::QuotedString(Buffer, Jsonx, &NumCharsRead)) 16 | { 17 | ErrorText->Logf(ELogVerbosity::Warning, TEXT("FJsonxObjectWrapper::ImportTextItem: Bad quoted string: %s\n"), Buffer); 18 | return false; 19 | } 20 | Buffer += NumCharsRead; 21 | } 22 | else 23 | { 24 | // consume the rest of the string (this happens on Paste) 25 | Jsonx = Buffer; 26 | Buffer += Jsonx.Len(); 27 | } 28 | 29 | // empty string yields empty shared pointer 30 | if (Jsonx.IsEmpty()) 31 | { 32 | JsonxString.Empty(); 33 | JsonxObject.Reset(); 34 | return true; 35 | } 36 | 37 | // parse the json 38 | if (!JsonxObjectFromString(Jsonx)) 39 | { 40 | if (ErrorText) 41 | { 42 | ErrorText->Logf(ELogVerbosity::Warning, TEXT("FJsonxObjectWrapper::ImportTextItem - Unable to parse json: %s\n"), *Jsonx); 43 | } 44 | return false; 45 | } 46 | JsonxString = Jsonx; 47 | return true; 48 | } 49 | 50 | bool FJsonxObjectWrapper::ExportTextItem(FString& ValueStr, FJsonxObjectWrapper const& DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const 51 | { 52 | // empty pointer yields empty string 53 | if (!JsonxObject.IsValid()) 54 | { 55 | ValueStr.Empty(); 56 | return true; 57 | } 58 | 59 | // serialize the json 60 | return JsonxObjectToString(ValueStr); 61 | } 62 | 63 | void FJsonxObjectWrapper::PostSerialize(const FArchive& Ar) 64 | { 65 | if (!JsonxString.IsEmpty()) 66 | { 67 | // try to parse JsonxString 68 | if (!JsonxObjectFromString(JsonxString)) 69 | { 70 | // do not abide a string that won't parse 71 | JsonxString.Empty(); 72 | } 73 | } 74 | } 75 | 76 | bool FJsonxObjectWrapper::JsonxObjectToString(FString& Str) const 77 | { 78 | TSharedRef>> JsonxWriter = TJsonxWriterFactory>::Create(&Str, 0); 79 | return FJsonxSerializer::Serialize(JsonxObject.ToSharedRef(), JsonxWriter, true); 80 | } 81 | 82 | bool FJsonxObjectWrapper::JsonxObjectFromString(const FString& Str) 83 | { 84 | TSharedRef> JsonxReader = TJsonxReaderFactory<>::Create(Str); 85 | return FJsonxSerializer::Deserialize(JsonxReader, JsonxObject); 86 | } 87 | 88 | -------------------------------------------------------------------------------- /Source/JsonxUtilities/Private/JsonxUtilitiesModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "CoreMinimal.h" 4 | #include "Modules/ModuleManager.h" 5 | 6 | IMPLEMENT_MODULE( FDefaultModuleImpl, JsonxUtilities ); 7 | -------------------------------------------------------------------------------- /Source/JsonxUtilities/Public/JsonxObjectWrapper.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "UObject/ObjectMacros.h" 7 | #include "UObject/Object.h" 8 | #include "UObject/Class.h" 9 | 10 | #include "JsonxObjectWrapper.generated.h" 11 | 12 | class FJsonxObject; 13 | 14 | /** UStruct that holds a JsonxObject, can be used by structs passed to JsonxObjectConverter to pass through JsonxObjects directly */ 15 | USTRUCT(BlueprintType) 16 | struct JSONXUTILITIES_API FJsonxObjectWrapper 17 | { 18 | GENERATED_USTRUCT_BODY() 19 | public: 20 | 21 | UPROPERTY(EditAnywhere, Category = "JSONX") 22 | FString JsonxString; 23 | 24 | TSharedPtr JsonxObject; 25 | 26 | bool ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText); 27 | bool ExportTextItem(FString& ValueStr, FJsonxObjectWrapper const& DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const; 28 | void PostSerialize(const FArchive& Ar); 29 | 30 | explicit operator bool() const 31 | { 32 | return JsonxObject.IsValid(); 33 | } 34 | 35 | bool JsonxObjectToString(FString& Str) const; 36 | bool JsonxObjectFromString(const FString& Str); 37 | }; 38 | 39 | template<> 40 | struct TStructOpsTypeTraits : public TStructOpsTypeTraitsBase2 41 | { 42 | enum 43 | { 44 | WithImportTextItem = true, 45 | WithExportTextItem = true, 46 | WithPostSerialize = true, 47 | }; 48 | }; 49 | UCLASS() 50 | class UJsonxUtilitiesDummyObject : public UObject 51 | { 52 | GENERATED_BODY() 53 | }; 54 | -------------------------------------------------------------------------------- /Source/JsonxUtilities/Public/JsonxUtilities.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "Misc/MonolithicHeaderBoilerplate.h" 6 | MONOLITHIC_HEADER_BOILERPLATE() 7 | 8 | #include "Jsonx.h" 9 | #include "JsonxObjectConverter.h" 10 | #include "JsonxObjectWrapper.h" 11 | 12 | -------------------------------------------------------------------------------- /Source/UHMP.Target.cs: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class UHMPTarget : TargetRules 7 | { 8 | public UHMPTarget(TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Game; 11 | DefaultBuildSettings = BuildSettingsVersion.V2; 12 | bUseChecksInShipping = true; 13 | 14 | ExtraModuleNames.AddRange( new string[] { "UHMP" } ); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Source/UHMP/AgentBaseCpp.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | 4 | #include "AgentBaseCpp.h" 5 | 6 | // Sets default values 7 | AAgentBaseCpp::AAgentBaseCpp() 8 | { 9 | // Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it. 10 | PrimaryActorTick.bCanEverTick = true; 11 | 12 | } 13 | 14 | // Called when the game starts or when spawned 15 | void AAgentBaseCpp::BeginPlay() 16 | { 17 | Super::BeginPlay(); 18 | 19 | } 20 | 21 | 22 | // Called to bind functionality to input 23 | void AAgentBaseCpp::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) 24 | { 25 | Super::SetupPlayerInputComponent(PlayerInputComponent); 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Source/UHMP/AgentBaseCpp.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/Character.h" 7 | #include "GenericTeamAgentInterface.h" 8 | #include "AgentBaseCpp.generated.h" 9 | 10 | UCLASS() 11 | class UHMP_API AAgentBaseCpp : public ACharacter, public IGenericTeamAgentInterface 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | // Sets default values for this character's properties 17 | AAgentBaseCpp(); 18 | UPROPERTY(BlueprintReadWrite) 19 | FGenericTeamId GenericTeamNo; 20 | 21 | 22 | protected: 23 | // Called when the game starts or when spawned 24 | virtual void BeginPlay() override; 25 | 26 | 27 | 28 | public: 29 | 30 | // Called to bind functionality to input 31 | virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; 32 | 33 | 34 | virtual FGenericTeamId GetGenericTeamId() const override { return GenericTeamNo; } 35 | 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /Source/UHMP/HMPAIController.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | 4 | #include "HMPAIController.h" 5 | 6 | -------------------------------------------------------------------------------- /Source/UHMP/HMPAIController.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "AIController.h" 7 | #include "HMPAIController.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class UHMP_API AHMPAIController : public AAIController 14 | { 15 | GENERATED_BODY() 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /Source/UHMP/HMPLevelScriptActor.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | 4 | #include "HMPLevelScriptActor.h" 5 | #include "Math/UnrealMathUtility.h" -------------------------------------------------------------------------------- /Source/UHMP/HmpCrowdFollowingComponent.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | #include "CoreMinimal.h" 5 | #include "UObject/ObjectMacros.h" 6 | #include "UObject/WeakInterfacePtr.h" 7 | #include "EngineDefines.h" 8 | #include "AITypes.h" 9 | #include "Navigation/PathFollowingComponent.h" 10 | #include "Navigation/CrowdAgentInterface.h" 11 | #include "AI/Navigation/NavigationAvoidanceTypes.h" 12 | #include "Navigation/CrowdFollowingComponent.h" 13 | #include "HmpCrowdFollowingComponent.generated.h" 14 | 15 | /** 16 | * 17 | */ 18 | UCLASS(ClassGroup = AI, HideCategories = (Activation, Collision), meta = (BlueprintSpawnableComponent), config = Game) 19 | class UHMP_API UHmpCrowdFollowingComponent : public UCrowdFollowingComponent 20 | { 21 | GENERATED_BODY() 22 | 23 | protected: 24 | void UpdatePathSegment() override; 25 | 26 | }; 27 | -------------------------------------------------------------------------------- /Source/UHMP/UHMP.Build.cs: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class UHMP : ModuleRules 6 | { 7 | public UHMP(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Sockets", "Networking", "Jsonx", "JsonxUtilities", "XtensorAPI" }); 12 | 13 | PrivateDependencyModuleNames.AddRange(new string[] { }); 14 | 15 | bEnableExceptions = true; 16 | 17 | // Uncomment if you are using Slate UI 18 | // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); 19 | 20 | // Uncomment if you are using online features 21 | // PrivateDependencyModuleNames.Add("OnlineSubsystem"); 22 | 23 | // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Source/UHMP/UHMP.cpp: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #include "UHMP.h" 4 | #include "Modules/ModuleManager.h" 5 | 6 | IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, UHMP, "UHMP" ); 7 | -------------------------------------------------------------------------------- /Source/UHMP/UHMP.h: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | -------------------------------------------------------------------------------- /Source/UHMPEditor.Target.cs: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class UHMPEditorTarget : TargetRules 7 | { 8 | public UHMPEditorTarget(TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Editor; 11 | DefaultBuildSettings = BuildSettingsVersion.V2; 12 | 13 | ExtraModuleNames.AddRange( new string[] { "UHMP" } ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Source/UHMPServer.Target.cs: -------------------------------------------------------------------------------- 1 | // Fill out your copyright notice in the Description page of Project Settings. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class UHMPServerTarget : TargetRules //Change this line according to the name of your project 7 | { 8 | public UHMPServerTarget(TargetInfo Target) : base(Target) //Change this line according to the name of your project 9 | { 10 | Type = TargetType.Server; 11 | DefaultBuildSettings = BuildSettingsVersion.V2; 12 | bUseChecksInShipping = true; 13 | ExtraModuleNames.Add("UHMP"); //Change this line according to the name of your project 14 | } 15 | } -------------------------------------------------------------------------------- /compress.txt: -------------------------------------------------------------------------------- 1 | ./7-Zip/7z.exe a -t7z -mx4 -v4g ./Build/UHMP_v1.0.7z ./ -xr!Binaries -xr!Intermediate -xr!Build -xr!BuildBB -xr!DerivedDataCache -xr!Saved -xr!".vs" -xr!".Build" 2 | 3 | 4 | ssh -p 3366 hmp@172.18.116.161 "mkdir -p /home/hmp/UnrealHmapBinary/Version3.132/" 5 | scp -P 3366 -r './Build/Linux*' hmp@172.18.116.161:/home/hmp/UnrealHmapBinary/Version3.132/ -------------------------------------------------------------------------------- /current_version: -------------------------------------------------------------------------------- 1 | 3.14 -------------------------------------------------------------------------------- /test_memory_leak.py: -------------------------------------------------------------------------------- 1 | import os, sys 2 | os.chdir('./Build') 3 | if not os.path.exists('./hmp2g'): 4 | os.system('git clone https://github.com/binary-husky/hmp2g.git -b uhmap-memleak-test') 5 | os.chdir('./hmp2g') 6 | os.system('python main.py -c ZHECKPOINT/uhmap_hete10vs10/render_result.jsonc') 7 | --------------------------------------------------------------------------------