Custom Mission System

The Custom Mission System allows users to create their own Missions for use with Counter-Strike: Condition Zero. These Mission Packs may include new maps, new challenges, new bot personalities, new bot skins, and so on.
Оцените эту статью, выбрав соответствующую медальку:
  • Текущая оценка 3.61 из 5
  • 1
  • 2
  • 3
  • 4
  • 5

Data Inheritance in the Bot Database File

Defining a bot personality involves specifying a dozen or more parameters. If you want to create several bots, this means defining quite a lot of data. To help organize and modularize this bot personality data, the Bot Database makes use of a very simple data «inheritance» mechanism.

Here is an example of how the inheritance mechanism works:

Default
Color = Grey
Shape = Circle
Size = Medium
Weight = Average
Material = Wood
End

Template RedSquare
Color = Red
Shape = Square
End

RedSquare MyRedSquare
Size = Small
End

The «Default» entry defines initial values of all attributes, in this case «Color», «Shape», «Size», «Weight», and «Material». The next entry is a «Template», which defines a data type named «RedSquare» that sets the attributes «Color» and «Shape» to «Red» and «Square», respectively. Finally, the last entry actually instantiates an object of type «RedSquare» called «MyRedSquare» which sets «Size» to «Small». The resulting values for «MyRedSquare» are:

Color = Red
Shape = Square
Size = Small
Weight = Average
Material = Wood

«Weight» and «Material» remain at their default of «Average» and «Wood», since neither «RedSquare» or «MyRedSquare» changed them.

The bot database allows for a crude form of «multiple inheritance» as well:

Default
Color = Grey
Shape = Circle
Size = Medium
Weight = Average
Material = Wood
End

Template RedSquare
Color = Red
Shape = Square
End

Template BigAndHeavy
Size = Large
Weight = Heavy
End

RedSquare+BigAndHeavy MyBigRedSquare
Material = Iron
End

In this example, a new entry has been added called «BigAndHeavy» which sets the attributes «Size» and «Weight» to «Large» and «Heavy». Notice that the instance of «MyBigRedSquare» now lists both «RedSquare» and «BigAndHeavy» as its type, combined with the addition symbol «+». The final values of «MyBigRedSquare» are:

Color = Red
Shape = Square
Size = Large
Weight = Heavy
Material = Iron

«Color» and «Shape» were inherited from «RedSquare», «Size» and «Weight» from «BigAndHeavy», and «Material» was set directly by the definition of «MyBigRedSquare». Any number of basic types can be «added» together in this way.

With multiple inheritance, data is copied to the object in a left to right order. If both «RedSquare» and «BigAndHeavy» had values for the same attribute, the final value would match the one in «BigAndHeavy» since it came after «RedSquare».

How is this actually used with bot data? It is very useful to break bot attributes into «weapon preferences» and «difficulty levels». For example, here are some example templates for difficulty levels:

Template Expert
Skill = 90
Aggression = 90
ReactionTime = 0.2
Difficulty = EXPERT
End

Template Hard
Skill = 75
Aggression = 75
ReactionTime = 0.25
Difficulty = HARD
End

Template Normal
Skill = 50
Aggression = 50
ReactionTime = 0.4
AttackDelay = 0.7
Difficulty = NORMAL
End

Template Easy
Skill = 0
Aggression = 20
ReactionTime = 0.5
AttackDelay = 1.5
Difficulty = EASY
End

… and here are some templates defining weapon preferences:

Template Rifle
WeaponPreference = m4a1
WeaponPreference = ak47
WeaponPreference = famas
WeaponPreference = galil
WeaponPreference = mp5
End

Template Sniper
WeaponPreference = awp
WeaponPreference = sg550
WeaponPreference = g3sg1
WeaponPreference = scout
WeaponPreference = famas
WeaponPreference = galil
WeaponPreference = mp5
End

Template Shotgun
WeaponPreference = xm1014
WeaponPreference = m3
WeaponPreference = famas
WeaponPreference = galil
WeaponPreference = mp5
End

Template Shield
WeaponPreference = shield
WeaponPreference = m4a1 // in case shield is disallowed
WeaponPreference = ak47
WeaponPreference = famas
WeaponPreference = galil
WeaponPreference = mp5
End

Template Spray
WeaponPreference = p90
WeaponPreference = tmp
WeaponPreference = mac10
WeaponPreference = mp5
End

These templates allow the easy creation of a bot named «John» who likes to use rifles and is a pretty hard opponent:

Hard+Rifle John
Skin = 3
VoicePitch = 97
End

Creating a bot named «Fred» who also likes rifles, but is a complete newbie, is just as simple:

Easy+Rifle Fred
Skin = 2
VoicePitch = 110
End

By mixing and matching templates, a large number of bots can be created quickly. This arrangement also facilitates «tuning» bot behaviors — if «hard» bots are too hard, the values can be changed in just one place (the «Hard» template), and all hard bots will be updated as a result.

Modularizing bot personality data in this way keeps a large amount of data organized and manageable.

Страницы: 1 — 2 — 3 — 4 — 5 — 6 — [7] — 8
Купи CS:CZ