public DpsOptimizationDeepQLearn(Client client) : base(client) { ci = client.ControlInterface; me.LuaEventListener.Bind("SWING_DAMAGE", DamageEvent); me.LuaEventListener.Bind("RANGE_DAMAGE", DamageEvent); me.LuaEventListener.Bind("SPELL_DAMAGE", DamageEvent); me.LuaEventListener.Bind("SPELL_PERIODIC_DAMAGE", DamageEvent); me.LuaEventListener.Bind("DAMAGE_SHIELD", DamageEvent); me.LuaEventListener.Bind("DAMAGE_SPLIT", DamageEvent); me.LuaEventListener.Bind("do", ControlEvent); /* * turn on no-cost spells * assume training agent has GM powers(training on own server emulator) */ ci.remoteControl.FrameScript__Execute("SendChatMessage('.cheat power on')", 0, 0); actionPool = new ActionPool(me, new[] { typeof(WrathAction), typeof(StarfireAction), }); SetupConnection(new IPEndPoint(IPAddress.Parse(ip), port)); SendObject(new { StateCount = EnvironmentState.GetTotalStateCount(), ActionCount = actionPool.ActionCount() }); ResetSession(); Console.WriteLine("Running."); this.Active = true; if (!me.GetObjectMgrAndPlayer()) { return; } GameObject target = SelectTrainingTarget(); if (target == null) { return; } currentState = EnvironmentState.GetState(me); SendObject(new { State = currentState.ToInt(), Reward = 0 }); }
public DpsOptimization(Client client) : base(client) { ci = client.ControlInterface; me.LuaEventListener.Bind("SWING_DAMAGE", DamageEvent); me.LuaEventListener.Bind("RANGE_DAMAGE", DamageEvent); me.LuaEventListener.Bind("SPELL_DAMAGE", DamageEvent); me.LuaEventListener.Bind("SPELL_PERIODIC_DAMAGE", DamageEvent); me.LuaEventListener.Bind("DAMAGE_SHIELD", DamageEvent); me.LuaEventListener.Bind("DAMAGE_SPLIT", DamageEvent); me.LuaEventListener.Bind("do", ControlEvent); /* * turn on no-cost spells * assume training agent has GM powers(training on own server emulator) */ ci.remoteControl.FrameScript__Execute("SendChatMessage('.cheat power on')", 0, 0); actionPool = new ActionPool(me); QMatrix = new float[ EnvironmentState.GetTotalStateCount(), actionPool.ActionCount() ]; ResetSession(); Console.WriteLine("Running."); this.Active = true; /* * perform initial random action * initial state is needed to not perform actions prohibited by state */ if (!me.GetObjectMgrAndPlayer()) { return; } GameObject target = SelectTrainingTarget(); if (target == null) { return; } /* initialize learning */ currentState = GetState(target); }