Virtual Casino
The casino application is an example using the behavior server, the
NetIv viewer and parts of the 'Studierstube' project. It consists of some
java classes which must be uploaded to the behavior server and some inventor
files defining a roulette, a roulette table and other things.
The virtual casino is:
-
a VR application using tracked HMDs, Pens, PIPs
-
a distributed application using TCP, UDP and IP multicast
-
a multi-user environment
-
a system which provides online authoring
How to start the Virtual Casino
-
Turn on the tracker server
-
Login on knieriem and marille. Start the following script file either on
knieriem or marille. Type in ~sainitz/joint/casino/start
[options]. If no options are specified, NetIv starts in normal
window mode. If the option '-0', '-1', '-2', '-3' or a combination is specified
NetIv starts in HMD mode using the HMDs with the specified numbers.
-
To create an other player, perform to following steps:
-
Select the BShell window and double click on 'Player'. A dialog for typing
in the parameters of the new instance will appear.
-
Type in e.g. "Batman 0 0 1 1 3" and click on "OK". This will create a player
with name Batman, color blue, pen station 1 and PIP station 3".
-
Start the instance by double clicking on it.
How to start the Virtual Casino (Java running on NT)
-
Turn on the tracker server
-
Start the NetIv viewer (on SGI)
-
The viewer can load scenes locally from the actual directory on request.
So type in cd ~sainitz/joint/classmodels.
-
Start the viewer by typing ~sainitz/joint/netiv/netiv
[options]. If no options are specified NetIv starts in normal
window mode. If the option '-0', '-1', '-2', '-3' or a combination is specified
NetIv starts in HMD mode using the HMDs with the specified numbers.
-
The viewer is now listening for incoming UDP packets on port 3000 (can
be changed with a command line option).
-
Start the Behavior Server (on NT)
-
Open a new shell.
-
Map a network drive to the SGIs via 'Samba' e.g. type in net
use s: \\knieriem\people.
-
Make sure that the java CLASSPATH environment variable includes the behavior
server packages. Type set CLASSPATH=s:\sainitz\joint;.
where s is your mapped network drive connected to the SGIs.
The dot at the end is important. Now the java packages 'behavior', 'iv',
'bshell' and 'common' are accessible.
-
Start the behavior server by typing java behavior.Server
2000. The server is now listening for TCP connections on port
2000 .
-
Upload and start the casino application (on NT)
-
Open a new shell adn set the CLASSPATH as above.
-
The easiest way to upload and start the application is to use the BShell.
The BShell is a graphical client for the behavior server and it supports
script files.
-
The clients of the behavior server are using the directories defined in
the CLASSPATH environment variable for searching for class files to upload.
The dot in the CLASSPATH definition above indicates the current directory.
So type in s: and cd
\sainitz\joint\casino
-
Edit the 'casino.bss' script file Make sure that the 'Server' node contains
the host and port where the behavior server is listening. Make sure that
the static class parameters of the iv.IvBehavior class contain the host
and port where the NetIv viewer is listening.
-
Start the BShell by typing java bshell.BShell
casino.bss. Now the complete casino application will be uploaded,
initialized and started. The script file creates one instance of the Player
class with the following parameters: 'Bond 1 1 0 0 2'. This means the name
of the player is Bond, the color of his jetons is yellow (rgb 1 1 0), the
players pen uses tracker station 0 the players PIP uses tracker station
2. The PIP is used to show the jetons of the player.
Playing the Game
Use your PIP to check your financial situation.
Use the pen to make your bets.
Use your pen to run the roulette.
Watch your bets, your PIP and the bank.
Try to blow up the bank. The bank is unfair because there is no house
limit even when the bank has not enough money.
Overview
The 'Virtual Casino' is a example application for the behavior server.
Beside the behavior server the example uses the 'NetIv' application and
parts of the 'Studierstube' project. 'NetIv' is an inventor viewer which
is able to receive commands via UDP for modifying its inventor tree. Also
the viewer is able to handle up to four HMDs. The tracker server of the
'Studierstube' project sends packets with positions and orientations via
IP multicast. These packets are received by the 'TrakEngine' inventor object
and a 'MulticastTracker' java class which must be uploaded to the behavior
server.
The 'TrakEngine' inventor object of the 'Studierstube' project is used
to track the HMDs, Pens and PIPs (PIP means Personal Interaction Panel
and is simply a board).
The positions and button states of the pens are needed by java classes
at the behavior server. Therefore a java class called 'MulticastTracker'
receives the multicast packets and provides the information to the other
classes.
The virtual casino is implemented as a set of java classes:
Behavior Classes
RouletteTable
This class maintains the stakes, the bank and the profits. It can be
treated as a server.
Roulette
Handles the roulette, simulates the ball, controls the table.
MulticastTracker
Receives IP multicast packets from the tracker server and provides the
information to other classes.
Player
The Player handles the pen and the PIP, it can make bets, run the roulette
and get profits. The class maintains references to the instances of RouletteTable,
Roulette and MulticastTracker
iv.IvBehavior
The classes RouletteTable, Roulette and Player are derived from this
class. It provides functionality for communicating with the NetIv viewer,
it implements the necessary protocol and provides a high level interface
for manipulation the inventor tree in NetIv.
Assistant Classes
Coord
Used to store a 3D position.
Stake
Represents a stake on the table. This includes the type e.g. rouge,
the position, the owner and other things.
JetonStack
Represent a stack of jetons, used for the stacks on the table, the bank
and the stacks on the PIP of the player.
Related Topics