⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paramloader.vb

📁 一个.Net下用VB编写的用于游戏的人工智能引擎
💻 VB
字号:
Public Class ParamLoader
    Inherits iniFileLoaderBase

    Private Shared m_Prm As ParamLoader

    Public Shared ReadOnly Property Prm() As ParamLoader
        Get
            If m_Prm Is Nothing Then m_Prm = New ParamLoader("")
            Return m_Prm
        End Get
    End Property



    Public NumAgents As Integer
    Public NumObstacles As Integer
    Public MinObstacleRadius As Double
    Public MaxObstacleRadius As Double

    '//number of horizontal cells used for spatial partitioning
    Public NumCellsX As Integer
    '//number of vertical cells used for spatial partitioning
    Public NumCellsY As Integer

    '//how many samples the smoother will use to average a value
    Public NumSamplesForSmoothing As Integer

    '//used to tweak the combined steering force (simply altering the MaxSteeringForce
    '//will NOT work!This tweaker affects all the steering force multipliers
    '//too).
    Public SteeringForceTweaker As Double

    Public MaxSteeringForce As Double
    Public MaxSpeed As Double
    Public VehicleMass As Double

    Public VehicleScale As Double
    Public MaxTurnRatePerSecond As Double

    Public SeparationWeight As Double
    Public AlignmentWeight As Double
    Public CohesionWeight As Double
    Public ObstacleAvoidanceWeight As Double
    Public WallAvoidanceWeight As Double
    Public WanderWeight As Double
    Public SeekWeight As Double
    Public FleeWeight As Double
    Public ArriveWeight As Double
    Public PursuitWeight As Double
    Public OffsetPursuitWeight As Double
    Public InterposeWeight As Double
    Public HideWeight As Double
    Public EvadeWeight As Double
    Public FollowPathWeight As Double

    '//how close a neighbour must be before an agent perceives it (considers it
    '//to be within its neighborhood)
    Public ViewDistance As Double

    '//used in obstacle avoidance
    Public MinDetectionBoxLength As Double

    '//used in wall avoidance
    Public WallDetectionFeelerLength As Double

    '//these are the probabilities that a steering behavior will be used
    '//when the prioritized dither calculate method is used
    Public prWallAvoidance As Double
    Public prObstacleAvoidance As Double
    Public prSeparation As Double
    Public prAlignment As Double
    Public prCohesion As Double
    Public prWander As Double
    Public prSeek As Double
    Public prFlee As Double
    Public prEvade As Double
    Public prHide As Double
    Public prArrive As Double

    Public Sub New(ByVal filename As String)
        MyBase.New(Application.StartupPath & "\params.ini")

        NumAgents = GetNextParameterInt()
        NumObstacles = GetNextParameterInt()
        MinObstacleRadius = GetNextParameterFloat()
        MaxObstacleRadius = GetNextParameterFloat()

        NumCellsX = GetNextParameterInt()
        NumCellsY = GetNextParameterInt()

        NumSamplesForSmoothing = GetNextParameterInt()

        SteeringForceTweaker = GetNextParameterFloat()
        MaxSteeringForce = GetNextParameterFloat() * SteeringForceTweaker
        MaxSpeed = GetNextParameterFloat()
        VehicleMass = GetNextParameterFloat()
        VehicleScale = GetNextParameterFloat()

        SeparationWeight = GetNextParameterFloat() * SteeringForceTweaker
        AlignmentWeight = GetNextParameterFloat() * SteeringForceTweaker
        CohesionWeight = GetNextParameterFloat() * SteeringForceTweaker
        ObstacleAvoidanceWeight = GetNextParameterFloat() * SteeringForceTweaker
        WallAvoidanceWeight = GetNextParameterFloat() * SteeringForceTweaker
        WanderWeight = GetNextParameterFloat() * SteeringForceTweaker
        SeekWeight = GetNextParameterFloat() * SteeringForceTweaker
        FleeWeight = GetNextParameterFloat() * SteeringForceTweaker
        ArriveWeight = GetNextParameterFloat() * SteeringForceTweaker
        PursuitWeight = GetNextParameterFloat() * SteeringForceTweaker
        OffsetPursuitWeight = GetNextParameterFloat() * SteeringForceTweaker
        InterposeWeight = GetNextParameterFloat() * SteeringForceTweaker
        HideWeight = GetNextParameterFloat() * SteeringForceTweaker
        EvadeWeight = GetNextParameterFloat() * SteeringForceTweaker
        FollowPathWeight = GetNextParameterFloat() * SteeringForceTweaker

        ViewDistance = GetNextParameterFloat()
        MinDetectionBoxLength = GetNextParameterFloat()
        WallDetectionFeelerLength = GetNextParameterFloat()

        prWallAvoidance = GetNextParameterFloat()
        prObstacleAvoidance = GetNextParameterFloat()
        prSeparation = GetNextParameterFloat()
        prAlignment = GetNextParameterFloat()
        prCohesion = GetNextParameterFloat()
        prWander = GetNextParameterFloat()
        prSeek = GetNextParameterFloat()
        prFlee = GetNextParameterFloat()
        prEvade = GetNextParameterFloat()
        prHide = GetNextParameterFloat()
        prArrive = GetNextParameterFloat()

        MaxTurnRatePerSecond = Utils.Pi
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -