前往
大廳
主題

狗頭人哨兵 攻擊 4

夏洛爾 | 2023-02-04 15:52:31 | 巴幣 2 | 人氣 162


Kobold Sentinel Attack V4

實驗目標:
1.設法用武器用力的打擊目標

實驗設計:
1.任何弱點觸地皆失敗 (尾巴、武器和Calf並非弱點)
2.當武器OnCollisionEnter Player
//enterCoef = 0.05f
agent.AddReward( Mathf.Clamp01(collision.impulse.magnitude * enterCoef) );
3.
//Set: judge.endEpisode = true//Set: judge.episodeLength = 3.3f//Set: weapon, tail not weakness//Set: useClampReward = trueif(weaknessOnGround){if(inferenceMode){brainMode = BrainMode.GetUp;SetModel("KoboldGetUp", getUpBrain);behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}else{// ===Train Attack===if(!hitTarget){float survivedTime = Time.fixedTime - arrivedMoment;if(survivedTime < judge.episodeLength ){AddReward( (survivedTime - judge.episodeLength) * 0.1f );}}judge.outLife++;judge.Reset();return;//===Train Other===// brainMode = BrainMode.GetUp;// SetModel("KoboldGetUp", getUpBrain);// behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}}else if(koboldRoot.localPosition.y < -1f){if(inferenceMode){brainMode = BrainMode.GetUp;SetModel("KoboldGetUp", getUpBrain);behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}else{// ===Train Attack===if(!hitTarget){float survivedTime = Time.fixedTime - arrivedMoment;if(survivedTime < judge.episodeLength ){AddReward( (survivedTime - judge.episodeLength) * 0.3f );}}judge.outY++;judge.Reset();return;// ===Train Other===// brainMode = BrainMode.GetUp;// SetModel("KoboldGetUp", getUpBrain);// behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}}else if( IsCollideWithBody() ){if(inferenceMode){brainMode = BrainMode.GetUp;SetModel("KoboldGetUp", getUpBrain);behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}else{// ===Train Attack===if(!hitTarget){float survivedTime = Time.fixedTime - arrivedMoment;if(survivedTime < judge.episodeLength ){AddReward( (survivedTime - judge.episodeLength) * 0.1f );}}judge.outLife++;judge.Reset();return;//===Train Other===// brainMode = BrainMode.GetUp;// SetModel("KoboldGetUp", getUpBrain);// behaviorParameters.BehaviorType = BehaviorType.InferenceOnly;}}else{if(hitTarget){// float myVelocity = velocityBuffer.GetSmoothVal().magnitude;// float myAngularVelocity = Vector3.Project(angularVelocityBuffer.GetSmoothVal(), Vector3.up).magnitude;targetSmoothPosition = targetPositionBuffer.GetSmoothVal();targetSmoothVelocity = targetVelocityBuffer.GetSmoothVal();if(targetSmoothVelocity.y > 0f || targetSmoothPosition.y > 1.5f){float targetVelocity = targetSmoothVelocity.magnitude;float targetAngularVelocity = targetAngularVelocityBuffer.GetSmoothVal().magnitude;// velocityCoef = Mathf.InverseLerp(15f, 0f, myVelocity );// float angularVelocityCoef = Mathf.InverseLerp(0f, 30f, myAngularVelocity );velocityCoef = Mathf.InverseLerp(0f, 20f, targetVelocity );float angularVelocityCoef = Mathf.InverseLerp(0f, 30f, targetAngularVelocity );lastReward = velocityCoef * 0.05f + angularVelocityCoef * 0.05f;totalReward += lastReward;AddReward(lastReward);}else{lastReward = 0f;}}}

//大致來說
1.打擊得分變成僅限初擊
2.在打擊後,得分加上目標速度和角速度
3.身體不能碰觸敵人
4.只有當紅蓮往上飛(速度向上) 或是 y座標大於 1.5 (正在飛) 才會計算擊飛得分

實驗時間:
Step: 5e7
Time Elapsed: 358744s (99.65hr)

實驗結果:
實驗結果為失敗

本意是想鼓勵狗頭人向上打擊,但狗頭人使用了類似自殺突刺的行為

仔細想想之後,發現我動漫看太多了
雖然狗頭人應該也是體能怪物,但是物理原理上,想把人打飛或擊退
比起靠手臂或揮舞武器,用助跑後的身體衝撞才是最實際的

所以尤其又是銜接在奔跑之後,狗頭人會一直採取類衝撞行為,是完全合理的策略
然後加上"身體不得碰觸敵方"之後,沒有視力的狗頭人就更容易只能遠遠突刺

可以"轟!"的一記正拳或武技,把人轟到10公尺外是純粹的動畫效果
體重對等的對手,用武器光是能把對方打到跌倒就很猛烈了

因此想讓狗頭人揮舞武器,而不是使用衝撞,需要更有區別性的引導方式

0則留言

更多創作