Game Development Reference
In-Depth Information
Defining Artificial Players
If you are looking for a challenge yourself, try to beat our artificial player called
random turtle in a simulated game of SimWar. You can find it on the companion
website (see the “Playing SimWar on the Companion Website” sidebar). This player
follows a turtling strategy: It builds up its defense and factories before building offen-
sive units and launching attacks. Its behavior is determined by the following script:
if(Defense <= 3 + pregen0 * 3) do(BuyD)
if(Factories <= 2 + pregen1 * 3) do(BuyF)
if(Defense > 6 + pregen2 * 3 && random < 0.2) do(Attack)
if(Resources > pregen3 * 4) do(BuyO)
Note that this script uses the pregenerated random values ( pregen0—pregen3 ) in order
to alter its strategies a little every time the simulation runs. It will build between
four and six defensive units first, then build between three and five factories, before
focusing on the attack.
playinG simWar on the companion Website
Go to the companion website at www.peachpit.com/gamemechanics and find the section
on simWar. The complete version looks like Figure 8.22 but includes artificial players and
a chart to allow you to see the progress of the game. You can easily modify the artificial
players and the balance tweaks described in the section “Tweaking the Balance.” To
have the diagram play itself automatically, make sure one of each color of artificial player
is activated while playing. To play against an artificial player yourself, simply deactivate
all the artificial players for the color you want to control and click the interactive diagram
nodes yourself. note that the black artificial player is not a competitor. its only function
is to stop the game from running too long in the event of a stalemate.
Fun as it may be to play against the “random turtle” strategy or investigate the data
from having two of those artificial players face each other, it reveals little of the bal-
ance of the game. Most strategy games allow for rushing and turtling strategies. The
following script defines our turtling strategy:
if(Defense < 4) ire(BuyD)
if(Factories < 4) ire(BuyF)
if(Defense > 9 && random < 0.2) ire(Attack)
if(Resources > 3) ire(BuyO)
Our turtle strategy gives priority to building four defensive units and four factories
first. After that, it starts building offensive units and starts attacking if it has a total
of ten or more units.
 
Search WWH ::




Custom Search