毕业备份

我也不知道毕业的时候发生了些什么...好像改了side channel相关。
This commit is contained in:
Koha9 2023-07-14 01:29:43 +09:00
parent cbcecfa9e9
commit bee609d160
3 changed files with 434 additions and 28 deletions

View File

@ -26,8 +26,10 @@ from typing import List
bestReward = -1
SCrecieved = 0
DEFAULT_SEED = 9331
ENV_PATH = "../Build/3.0/Goto/Aimbot-ParallelEnv"
ENV_PATH = "../Build/2.9/Goto-NonNormalization/Aimbot-ParallelEnv"
SIDE_CHANNEL_UUID = uuid.UUID("8bbfb62a-99b4-457c-879d-b78b69066b5e")
WAND_ENTITY = "koha9"
WORKER_ID = 1
@ -35,7 +37,7 @@ BASE_PORT = 1000
# tensorboard names
game_name = "Aimbot_Target_Hybrid_PMNN_V3"
game_type = "PList_Go_LeakyReLU"
game_type = "Mix_Verification"
# max round steps per agent is 2500/Decision_period, 25 seconds
# !!!check every parameters before run!!!
@ -44,7 +46,7 @@ TOTAL_STEPS = 3150000
BATCH_SIZE = 512
MAX_TRAINNING_DATASETS = 6000
DECISION_PERIOD = 1
LEARNING_RATE = 1e-3
LEARNING_RATE = 6.5e-4
GAMMA = 0.99
GAE_LAMBDA = 0.95
EPOCHS = 3
@ -54,17 +56,17 @@ POLICY_COEF = [1.0, 1.0, 1.0, 1.0]
ENTROPY_COEF = [0.05, 0.05, 0.05, 0.05]
CRITIC_COEF = [0.5, 0.5, 0.5, 0.5]
TARGET_LEARNING_RATE = 1e-6
FREEZE_VIEW_NETWORK = False
FREEZE_VIEW_NETWORK = True
BROADCASTREWARD = False
ANNEAL_LEARNING_RATE = True
CLIP_VLOSS = True
NORM_ADV = False
TRAIN = True
SAVE_MODEL = True
TRAIN = False
SAVE_MODEL = False
WANDB_TACK = True
LOAD_DIR = None
#LOAD_DIR = "../PPO-Model/PList_Go_LeakyReLU_9331_1677696843_middle.pt"
LOAD_DIR = "../PPO-Model/PList_Go_LeakyReLU_9331_1677965178_bestGoto/PList_Go_LeakyReLU_9331_1677965178_10.709002.pt"
# public data
class Targets(Enum):
@ -314,12 +316,15 @@ class AimbotSideChannel(SideChannel):
def __init__(self, channel_id: uuid.UUID) -> None:
super().__init__(channel_id)
def on_message_received(self, msg: IncomingMessage) -> None:
global SCrecieved # make sure this variable is global
"""
Note: We must implement this method of the SideChannel interface to
receive messages from Unity
Message will be sent like this:
"Warning|Message1|Message2|Message3" or
"Error|Message1|Message2|Message3"
"""
thisMessage = msg.read_string()
# print(thisMessage)
thisResult = thisMessage.split("|")
if(thisResult[0] == "result"):
TotalRounds[thisResult[1]]+=1
@ -329,6 +334,22 @@ class AimbotSideChannel(SideChannel):
#print(WinRounds)
elif(thisResult[0] == "Error"):
print(thisMessage)
# # while Message type is Warning
# if(thisResult[0] == "Warning"):
# # while Message1 is result means one game is over
# if (thisResult[1] == "Result"):
# TotalRounds[thisResult[2]]+=1
# # while Message3 is Win means this agent win this game
# if(thisResult[3] == "Win"):
# WinRounds[thisResult[2]]+=1
# # while Message1 is GameState means this game is just start
# # and tell python which game mode is
# elif (thisResult[1] == "GameState"):
# SCrecieved = 1
# # while Message type is Error
# elif(thisResult[0] == "Error"):
# print(thisMessage)
# 发送函数
def send_string(self, data: str) -> None:
# send a string toC#

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long