PIGS


Introduction

Pigs are computer controlled players (AI). Their main purpose is to provide a way to simulate many allegiance clients by using automated 'bots' that behave according to various scripts. This allows a single developer to simulate a game with many players during testing.
To do so, the Pigs use the same Clintlib library than the game client in order to fully behave like real clients (at least as seen from the server). This is handy to stress test the server, IGC, and networking APIs.
WIP: change the intro to something more sexy

Pigs components

*'''PigSvr''' : the main component where Pigs actually live. It's the Pigs server. It's an executable (PigSvr.exe) that is controlled with external scripting. A single Pig server can spawn an unlimited number of Pigs. There can be many computers running PigSrv to provide very large scale testing. PigSvr can be configured with registry or scripting or the PigConfig utility.
*'''PigAccts''' : the Pig names (account) dispenser. It's an executable (PicAccts.exe) that is invoked with COM (locally or remotely). It roles is to provide unique names to Pigs whatever the number of Pigs servers. PicAccts fetches the account values (name + password) from the PicAccts.ini file.
*'''PigConfig''' : a UI tool to configure PigSrv.
*'''PigLib''' : a middleware library used by other components and scripts. It's a DLL file that must be registered.
*'''The Piglets directory''' : the place where Pig scripts, called Piglets, are stored. It's a parameter of PigSrv and the place where it fetches the pigs (duh!).
===some picture here===
===more blablabla there===

Downloading and Installing Pigs

Latest Pigs build (R6) can be found <TODO>.

You can install Pigs on any machine including a game client or a lobby or a game server. Actually for test purpose you can install every Allegiance components on a single machine (Game client and its artwork, Lobby, game server, Pig Accounts server and Pig Server)

Unzip the archive to any folder. Open a command prompt in that folder then do:

*Setting up a '''Pig Server''' machine

  • regsvr32 PigLib.dll
  • regsvr32 AGC.dll (not needed if the machine is already a game server)
  • PigSvr -regserver


*Setting up a '''Pig Accounts server''' machine:

  • edit pigaccts.ini to fit your naming needs
  • PigAccts -regserver


*'''External Scripting'''
The 'Scripts' directory contains http://en.wikipedia.org/wiki/Windows_Script_Host WSH scripts to control the Pigs components. WSH scripts are similar to batch scripts (.bat) but more handy and powerful since they can use any installed scripting language (default with all Windows versions are JavaScript (.js) and VisualBasic (.vbs)). You can also write your own scripts or use any programming language or platform to control pigs (.Net, php, python, etc). Anything that can invoke and manipulate COM objects. Developing a web front-end to control and configure a Pig server would be a nice thing to have (WIP: not really the place).

*'''Internal Scripting'''
The 'Piglets' directory contains the scripts which define the Pigs AI (behaviors). a Piglet (.pig file) can be written in any scripting language supported by http://en.wikipedia.org/wiki/ActiveScript Active Scripting on the Pig Server machine. Most provided piglets use either JS or VBS. If you're not familiar with these scripting languages, you can install new ones like: http://www.activestate.com/activeperl ActivePerl, http://www.activestate.com/activepython ActivePython, ActivePHP or PHPScript (todo links).

==Configuring Pigs==

*Configuring the pig server: launch PigConfig.exe or use the various related scripts (located in the 'Scripts' directory)
'''artwork''': path to Allegiance artwork (scripts\ArtPath.js)
'''Piglets''': path to the Piglet directory (scripts\ScriptDir.js)
'''Limit number of pigs''': unchecked for unlimited or check and set the number (scripts\MaxPigs.js)
'''Lobby server''': ip or dns name of the lobby server (scripts\LobbyServer.js)
'''Pig Accounts server''': choose and set the ip or dns name (scripts\AccountServer.js)
'''Events''': you can set here which events to log or trace (various scripts). See [Debugging Pigs].

==Using Pigs==

WIP

a Pig is like an Allegiance human player. Actually the lobby or the game server cannot distinguish a pig from a real human player.
Each pig is controlled by a script called a piglet. Each piglet define a behavior.
Each pig as a defaut starting behavior but can dynamically change behavior with scripting. For instance the stem.pig behavior will change to behavior X is another player (or pig!) send him the chat 'become X'.

WIP

Basic way to create a pig: Scipts\CreatePig.js <behavior>
if no argument is passed, the 'Default' behavior will be used.

Scripts\CreatePigs.js <behavior> <count> will create <count> pigs with same <behavior>.

'''The Default behavior''':

the default behavior been a piglet it can be edited and changed to fit your needs. By default, it will try to join 'Pig mission' game or any other game if not found or will create a game if no game is present. Once in a game, it will join a team (evenly). If the game is not started and a pig is game owner, it will start the game once enough players (pigs or humans) have joined teams.

The file Progress.xls in the Piglets directory contains a list of all current piglets and their purpose.

==The Pigs scripting system==
some intro blabla here
=== external scripting reference===

here goes the COM objects/interfaces exposed by PigSvr, PigLib, PigAccts and eventually AGC too.
So people can write external scripts such as the ones found the in Scripts directory.

todo: small intro here than fork a page or link to an autodoc system

=== internal scripting reference===

here goes the internal Pig objects/interfaces available in piglets.

todo: small intro here than fork a page or link to an autodoc system

Last edited Aug 19, 2011 at 11:59 PM by kgersen, version 2