This section describes an example web interface to FantasyDemo. It shows how to implement a web auctioning system in order to illustrate functions accessible from the BigWorld web integration module, such as:
-
Authentication of player login details.
-
Retrieval of an entity mailbox.
-
Access to base methods that exist on a base entity through a mailbox.
-
Passing parameters to and receiving data from the BigWorld Python scripting layer using the web scripting layer.
The example platform used in this document is the PHP scripting language, combined with the Apache HTTP server. This guide uses a variety of well-documented techniques for web applications (such as handling session variables). Features and techniques used in the example code are common to other web scripting languages; thus the techniques presented can also be used in other web scripting environments.
We provide examples on querying the player for inventory and character statistics. The item and inventory system is based on the BigWorld FantasyDemo item and inventory system. Any item or inventory system with similar concepts of item serial numbers, item types and item locking can be adapted for the web scripts. Other extensions to this model are possible.
We provide a working example of an Auction House, which the player can interact with to:
-
Create auctions.
-
Search for auctions.
-
Bid on auctions.
Auctions have the following characteristics:
-
Refer to individual items in a player's inventory.
-
Have a starting bid, and may optionally have a buyout price.
-
Have adjustable expiry times specified when they are created.
-
Every player can bid on auctions made by other players.
-
Players can specify a maximum value for their bid which allows automated incremental bidding on behalf of the player, up to the specified maximum allowed value.
This is known as proxy bidding, and this Auction House model is common in other popular Internet-based auction houses. In the code, it is referred to as an
IncrementalAuction
. When entering a maximum bid, the entire amount is considered to be passed to the auction house; on auction resolution, the difference between the maximum bid amount and the actual bid amount is returned back to the player.
We will walk through the source and highlight the salient areas
relevant to building a trading system. This example consists of a
presentation layer written in PHP, and a logic layer that is implemented as
part of the base entity scripts for the appropriate entities, namely
Avatar
, TradingSupervisor
and
AuctionHouse
.

Block system diagram
The logic for the AuctionHouse
entity is
implemented in the game scripting layer in Python, alongside other entity
logic in a BigWorld game. With some alterations, the example code used in
this document can be adapted for use in a game that already has a currency
and inventory system.
This document assumes that the reader has read the Server Programming Guide, and is familiar with BigWorld Python scripting and has a basic operation of how return-value methods work.