A kid lives in my heart

關於部落格
......
  • 46832

    累積人氣

  • 0

    今日人氣

    0

    訂閱人氣

The Secrets Of Enemy AI In Uncharted 2 by gamasutra

自己的筆記整理:

基本的AI原型:

a light pistol soldier

(define-ai-archetype light-pistol
:skills (ai-archetype-skill-mask
script
hunting
cover
open-combat
alert
patrol
idle
turret
cap
grenade-avoidance
dodge
startle
player-melee-new
)
:health 100
:character-class 'light
:damage-receiver-class 'light-class
:weapon-skill-id (id 'pistol-basic-light)
:targeting-params-id (id 'default)
)

Skill相關的部份:

Script, 用來把brain關掉, 聽從script command, 用在讓AI播放特定animataion , 移動到特定點.

Cover:  AI了解, 使用cover.

Open-combat: AI知道在沒有cover的地方戰鬥

Turret: AI使用架好的炮塔

Idle:  發呆, 沒有敵人時的狀態.

Patrol: AI了解如何使用拉好的巡邏路徑.

CAP (cinematic action pack): 用來讓AI在特定環境下,  執行某些動作(像是跳過牆) ,  可以讓AI執行想要的演出, 然後保持ai brain打開, 對刺激做出反應.  CAP會定義所有需要的動作, 包含動作間的轉換.

 

還有其它的技能模組, 而且在遊戲中間也有可動態新增或減少技能模組.

Health相關部份:

本來是用float來記, 後來改為inter, 怕有確度的精確的問題(檢查數值要1.0, 可是確是0.9999), 會製成有時玩家需要多一發子彈才打的死敵人. 

為了簡單平衡, 會給基本的血量100.

AI with class : 定義角色的外觀和使用的動作組.

character-class: 分為light , medium, heavy, armored(裝甲的), shield,  villager, SLA(shangriLa Army)

Damage:

使用damage receiver class system, 使用一張spread sheet, 欄是武器名字, 列是不同的receiver damage class . 這樣的設計比較方便調整, 不會整了一個武器的damage後又需要去重調所以敵人的血量,  只要把damage receiver class分派給AI即給.

 
 

Weapon Skill ID

(new ai-weapon-skill
:weapon 'assault-rifle-b
:type (ai-weapon-anim-type machine-gun)

;; damage parms
:character-shot-damage 5
:object-shot-damage 120

;; rate of fire parms
:initial-sequence-delay (rangeval 0.0 0.0)
:num-bursts-per-sequence (rangeval-int 10000 10000)

:auto-burst-delay (rangeval 0.4 0.8)
:auto-burst-shot-count (rangeval-int 3 5)

:single-burst-chance 0.33
:single-burst-delay (rangeval 0.4 0.8)
:single-burst-shot-count (rangeval-int 1 3)
:single-burst-fire-rate (rangeval 0.16 0.20)

;; accuracy parms
:accuracy-curve *accuracy-assault-rifle-upgrade*

:time-to-accurate-cover 3.5
:accuracy-cover-best 1.0
:accuracy-cover-worst 0.0

:accuracy-running 0.9
:accuracy-rolling 0.5
:accuracy-standing 1.0

:master-accuracy-multiplier 1.0
:master-accuracy-additive 0.1
)

定義武器的準備度, 傷害值, 射擊的模式. 設計上玩家和AI使用的數值不同.

Type: 指定那一種animation set (pistol, machine gun, shotgun其中一種)

Rate Of Fire parameters

相關的key issues

1.       實際的體積, 影響玩家如何受到損傷.

2.       武器的行為: ex 全自動或半自動

3.       在戰鬥中, 會聲音如何被聽到.

firing sequence with an optional delay between each sequence ( 開槍之間的delay)

number of bursts (每個burst  fire rate不是當成自動的, 就是當成single shot的集合, 使用填入fire rate)

所以上面的例子, 每個burst33%的機會會被當single shot set , fire rate0.16-0.2秒 在每個shot之間, 0.4-0.8delay到一下個burst.

 

不然就是一個automatic burst 包含3-5個子彈.  0.4-0.8delay到一下個burst

 (:auto-burst-delay (rangeval 0.4 0.8)
  :auto-burst-shot-count (rangeval-int 3 5))

命中率的定義.

(define *accuracy-assault-rifle-upgrade*

( make-ai-accuracy-curve
([meters 60.0] [chance-to-hit 0.0])
([meters 30.0] [chance-to-hit 0.3])
([meters 20.0] [chance-to-hit 0.4])
([meters 12.0] [chance-to-hit 0.4])
([meters 8.0] [chance-to-hit 0.5])
([meters 4.0] [chance-to-hit 0.9])
)

)

0 -4 尺的時候, 命中率是0.9.  

Time To Accurate Cover section : 當玩家從cover中出來射擊時, ai的命中率會3.5秒內, accuracy-cover-worst accuracy-cover-best

:time-to-accurate-cover 3.5
:accuracy-cover-best 1.0
:accuracy-cover-worst 0.0

 

Targeting (AI如何選擇目標來攻擊, 使用weighting的方式 )

(new ai-targeting-params
:min-distance 0.0 ;; minimum distance to look for a target
:max-distance 200.0 ;; maximum distance to look for a target
:distance-weight 50.0 ;; weight to apply, scaled according to distance away

:target-eval-rate 1.0 ;; how often to evaluate targets, in seconds

:visibility-weight 10.0 ;; weight applied if the target is visible

:sticky-factor 10.0 ;; weight applied to the existing target
:player-weight 10.0 ;; weight applied if the target is the player
:last-shot-me-weight 20.0 ;; weight applied if the target shot me
:targeting-me-weight 0.0 ;; weight applied if the target is targeting me

:close-range-distance 11.0 ;; weight applied if target is within the specified distance
:close-range-bonus 0.0

:relative-distance-weight 10.0 ;; explained later
:relative-search-radius 100.0

:relative-dog-pile-weight -1.0 ;; explained later

;; weights for specific vulnerability states, explained later
:vuln-weight-cover 0.0
:vuln-weight-peek 0.0
:vuln-weight-blind-fire-cover 0.0
:vuln-weight-roll 0.0
:vuln-weight-run 10.0
:vuln-weight-aim-move 20.0
:vuln-weight-standing 20.0

:in-melee-bonus 0.0 ;; weight applied if target is in melee
:preferred-target-weight 100.0 ;; explained later
)

以這個例子來看,這個AI  最遠會找到200 meters.

 偏愛可以可看到的目標(visibility-weight),

 對自己射擊的(last-shot-me-weight), 是玩家(:player-weight) 的目標.

也偏愛己經描準的目標(sticky-factor),  會每秒重新評估是否選擇一個新目標. (:target-eval-rate )

:relative-dog-pile-weight -1.0 : 讓同隊的AI不去選擇其它AI己經選擇的目標.

有多少個AI選這個目標, 就乘上這個數值.  所以是負值.  

vulnerability weights:  用來在特定情況下, 幫助目標的選取過程, 像是目標站著,  拿著武器移到等等.  

preferred-target-weight: 可以在任何時間, 指定preferred target, 然後在評估時, 會加上這個額外的weight.

 

AI 尋路方面:

使用navigation mesh , 來定義出AI可以探索的區域.

 

Sensory Vision: (AI的看和聽): 

conestimes所組成.  包含外圍和內部的cone.

每個cone包含了水平角度,  重直角度,  範圍, 和查覺時間( 隨著range而改變).

 當在外圍cone, 倒數完了時,  Ai會認

相簿設定
標籤設定
相簿狀態