Casino Interface and Module

This page is a discussion of the Starport Casino module.

The Casino module is designed to handle various interfaces and communications between the game and any number of mini-games that may be added at a later time. The basic architecture of the module is similar to other modules within the game that handle basic data types (such as integers and strings) and hash tables / dictionaries (this does not, however, necessarily apply to the casino games themselves). This module is required by the Starport Module only (unless a future decision is made that would allow the player to play casino games at planetbound trading centers, which would then require the module be accessible by the Planetary Exploration module). The games that will be available for play at the casino are intended to be yet another avenue for which the player to raise funding for their fleet. The module thus serves an important function for the player. All code for the Casino module is located in the sf3_starport_casino.py file.

Summary Description
Ofc_casino objects are created and stored during the initialization of a Starport office if a certain flag is set to True for that port. When created, the ofc_casino object will load in data on the specific interface to be used for the given casino, the list of "clickable" areas that will activate mini-games, and the list of the games that may be played at the given casino. When the player enters the casino, the indicated interface loads up, which gives the player opportunity to play the games. By scrolling over areas of the interface that access games, the player can see which games are available. Their account balance is also shown at all times while their avatar remains at the casino. Game control returns to the Starport concourse when the player clicks anywhere in the "Exit Casino" portion of the interface. The office object remains in memory until the player leaves the star system in which its containing Starport is located, at which point it is destroyed (along with the parent Starport object).

Data Structures
The following list is an indication of the various variables and methods that will be included in a ofc_casino object. This list contains suggested methods and variables; these will be updated as necessary to reflect final methods and variables as time progresses. Ofc_casino objects are meant to be used as child objects of Starport objects as a means of holding data on what mini-games are available at the port, and have no children of their own. Ofc_casino objects are created during runtime when a player enters a star system and are subsequently destroyed when they leave that system. Thus, while there may be multiple ofc_casino objects used in the game, only one will be in existence at a time (per Starport located in a system; the Flornea system has two Starports in it and thus may have two ofc_casino objects in it as well, one for each base). Their data structure is as follows:


 * Class: ofc_casino
 * Hash/Dictionary: Available_Games
 * ''Key: Game Name
 * Value-Tuple: Activation Area Coordinates
 * Integer: Upper Left X-Coordinate
 * Integer: Upper Left Y-Coordinate
 * Integer: Lower Right X-Coordinate
 * Integer: Lower Right Y-Coordinate''
 * String: szInterfaceTex (string, holds the name of the file with the casino interface graphic for the given Starport)

Interface
''This image contained in this picture is something I grabbed off the Internet, and may be copyrighted (so we need to draw up some kind of alternate image at some point, preferably sooner rather than later). It should be sufficient, however, to demonstrate the concept for the time being.''

The Casino Interface consists of only two areas, as demonstrated in the graphic:
 * Game Selection Area
 * Title Bar and Information Area

The Game Selection Area takes up all but a small bar along the bottom edge of the screen (which contains the Title Bar and Information Area ). As the name suggests, this area is used by the player to select the mini-game they would like to play. Game selection is done by scrolling over the interface so that various "activation areas" become highlighted. When this occurs, the mouse pointer changes to a "select" icon, with the name of the game presented in the activation area appearing immediately below the pointer. Clicking the mouse over an activation area will bring up a pop-up window, in which the player will be able to play the mini-game (note that for all mini-games, the player's current account balance must be passed as an argument and must be returned to the main game routine so that the player's balance may be updated with the new amount. It will also be necessary to include a method in the game that will allow control access to return to the main game routine). &lt;Tab&gt; and &lt;Shift&gt;-&lt;Tab&gt; may also be used to scroll through the various activation areas, with the &lt;Return&gt; key activating those areas. Scrolling over an activation area or using the &lt;Tab&gt; keys will sound the SCROLL SELECTION tone, and activation will sound the ACKNOWLEDGED tone. Game control will remain with the mini-game until control passes back to the interface, at which point the mouse will be placed over the same activation area. Casino interface graphics are set by XML files, as are the location of activation areas. All Casino interfaces must include at least one area that allows the player to leave the casino and return to the Starport Concourse. Along the bottom of edge of the screen is the Title Bar and Information Area. This area contains the name of the casino (in the lower left corner) as well as the player's current account balance. The player will not be able to interface directly with this area; its main purpose is to enable the player to check and see how much money they have available to them without having to activate a casino game. As with all Starport modules, no calls will be made to the gameClock object to advance the time while the interface is active. This may be subject to change for the Casino only; it doesn't seem likely a character would spend time in a casino without some time passing...

XML
The ofc_casino object, like most of the other objects in the game, is largely XML driven; this will help keep casinos and the number and types of games contained within them flexible up until SF3's design is finalized by allowing interfaces and specific games to be added and removed from the game freely, based upon what data is available in the XML files. The ofc_casino object requires two different XML files to function properly, with one of those used by the Starport Concourse Module itself to indicate the specific XML to use for a specific starport. The other type of XML file (the "(casino_came).xml" files) contains data on the interface image to utilize, activation points and specific games available at the casino. The following briefly goes over what data is located in these XML files.

(casino_type).xml
The file type "(casino_type).xml" is designed as an information file on a specific Starport casino interface. Entries are of one of two main types, "image" (used to hold the name of the interface graphic) and "game" (used for specific games), both of which are empty element types. Image elements contain one attribute, "name", which is used to hold the file name and path of the interface graphic. Game elements must contain exactly three attributes, named "name", "coords", and "sequence". The name attribute holds the name of the game (which will be what appears beneath the mouse cursor when the activation area is scrolled over). The coords attribute consists of four integers, which are seperated by commas and indicate, respectively, the upper-left x-coordinate, upper-left y-coordinate, lower-right x-coordinate, and lower-right y-coordinate of the activation area for the game (these are then used in game to define an on-screen quadrilateral, which acts as the game's activation area. Note that these coordinates must be set for the game's standard resolution, and are adjusted in game should the player choose to play the game with a different screen resolution). Finally, the sequence attribute is a string that contains the filename of the routine under which that particular game will run.

Sample structure of the (casino_type).xml file:

&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;root table-name="Starport Central Casino" version="0.1"&gt; &lt;image name="starport_central_casino.png" /&gt; &lt;game name="slots" coords="232,182,467,288" sequence="sf3_slots.py"/&gt; &lt;/root&gt;

Module Status
This is current as of April 7, 2011.

This module is currently in the final design phases; while specific descriptions of the intended functions of modules have yet to be written, the remainder of the module's basic description is complete at this point. Further design work on this module has been frozen for the time being, and will remain so until I'm ready to begin method descriptions for all remaining extant modules.

NEXT: Starship Module and Interface PREVIOUS: Lounge Interface and Module TOP