forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
mygame.Main Class Reference

Forest. More...

Inheritance diagram for mygame.Main:
Collaboration diagram for mygame.Main:

Public Member Functions

void simpleInitApp ()
 
void onAction (String binding, boolean value, float tpf)
 These are our custom actions triggered by key presses. More...
 
void simpleUpdate (float tpf)
 This is the main loop; Moving happens here, as does packet sending/receiving The second half is logic from the while(true) loop of ShowWorld.
 
void sendStatus (int now)
 send the current status of this avatar to the Forest network More...
 
Forest.PktBuffer receive ()
 receive packet from Forest network More...
 
void connect ()
 send connect packet to Forest network
 
void disconnect ()
 send disconnect packet to Forest router
 
void send (Forest.PktBuffer b, int length)
 Send packet to proxy or Forest network. More...
 
void sendCtlPkt2CC (boolean join, int comt)
 Send packet to the comtree controller to leave/join a comtree. More...
 
boolean isVis (int g1, int g2)
 
boolean linesIntersect (double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy)
 
void readWalls ()
 read into the walls array from the mapfile
 
void setupVisibility ()
 read the map file and create visibility sets as necessary
 
int groupNum (int x1, int y1)
 
void unsubscribe (ArrayList< Integer > glist)
 Send unsubscribe packet for all group numbers in glist.
 
void subscribe (ArrayList< Integer > glist)
 
void updateSubs ()
 
void draw (Forest.PktBuffer b)
 
void updateNearby (Forest.PktBuffer b)
 
int getX ()
 
int getY ()
 
int getDirection ()
 Computes direction based on physics directions. More...
 

Static Public Member Functions

static void main (String[] args)
 

Private Member Functions

void login ()
 
void setUpWalls ()
 
void setUpLight ()
 
void setUpKeys ()
 We over-write some navigational key mappings here, so we can add physics-controlled flying:
 

Private Attributes

final boolean LET_ME_FLY = false
 
Spatial sceneModel
 
BulletAppState bulletAppState
 
RigidBodyControl landscape
 
CharacterControl player
 
Vector3f walkDirection = new Vector3f()
 
boolean left = false
 
int comtree = 1001
 
HashMap< Integer, AvatarGraphicstatus
 
HashSet< Integer > recentIds
 
int idCounter
 
SocketChannel chan
 
DatagramSocket udpSock
 
final int CM_PORT = 30140
 
final int CP_PORT = 30182
 
ByteBuffer buf
 
String uname = "user"
 
String pword = "pass"
 
int rtrAdr
 
int myAdr
 
int rtrIpAdr
 
int ccAdr
 
long seqNum
 
int[] walls
 
final int GRID = 10000
 
final int MAXNEAR = 1000
 
final int STATUS_REPORT = 1
 
final int UPDATE_PERIOD = 50
 
HashSet< Integer >[] visSet
 
HashSet< Integer > mySubs
 
HashMap< Integer, Integer > nearAvatars
 
HashMap< Integer, Integer > visibleAvatars
 
int numNear
 
int numVisible
 
boolean waiting4comtCtl
 
int newcomt
 
int now
 
int nextTime
 
int cpIpAdr
 
int cpPort
 
int cpForestPort
 

Static Private Attributes

static int worldSize
 
static String hostname
 
static String mapfile
 
static int myIpAdr
 
static boolean needCliProxy
 

Detailed Description

Forest.

Author
Logan Stafman

Definition at line 48 of file Main.java.

Member Function Documentation

int mygame.Main.getDirection ( )
inline

Computes direction based on physics directions.

Returns
direction in degrees, 0 pointing upwards

Definition at line 1118 of file Main.java.

Here is the caller graph for this function:

int mygame.Main.groupNum ( int  x1,
int  y1 
)
inline
Parameters
x1current x in forest context
y1current y in forest context
Returns
multicast group number

Definition at line 930 of file Main.java.

Here is the caller graph for this function:

boolean mygame.Main.isVis ( int  g1,
int  g2 
)
inline
Parameters
g1is groupNum of one group
g2is groupNum of the other group
Returns
true if g1 can be seen from g2, false otherwise

Definition at line 672 of file Main.java.

Here is the call graph for this function:

Here is the caller graph for this function:

boolean mygame.Main.linesIntersect ( double  ax,
double  ay,
double  bx,
double  by,
double  cx,
double  cy,
double  dx,
double  dy 
)
inline
Parameters
axx of point a on line 1
ayy of point a on line 1
bxx of point b on line 1
byy of point b on line 1
cxx of point c on line 2
cyy of point c on line 2
dxx of point d on line 2
dyy of point d on line 2
Returns
true if the lines intersect, false otherwise

Definition at line 761 of file Main.java.

Here is the caller graph for this function:

void mygame.Main.onAction ( String  binding,
boolean  value,
float  tpf 
)
inline

These are our custom actions triggered by key presses.

We do not walk yet, we just keep track of the direction the user pressed.

Definition at line 416 of file Main.java.

Forest.PktBuffer mygame.Main.receive ( )
inline

receive packet from Forest network

Returns
the buffer of the new packet, or null if none is available

Definition at line 536 of file Main.java.

Here is the caller graph for this function:

void mygame.Main.send ( Forest.PktBuffer  b,
int  length 
)
inline

Send packet to proxy or Forest network.

Parameters
bbuffer to be sent
lengthlength of packet to be sent

Definition at line 616 of file Main.java.

Here is the caller graph for this function:

void mygame.Main.sendCtlPkt2CC ( boolean  join,
int  comt 
)
inline

Send packet to the comtree controller to leave/join a comtree.

Parameters
joinwhether to join or leave comtree
comtthe comtree to join or leave

Definition at line 645 of file Main.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void mygame.Main.sendStatus ( int  now)
inline

send the current status of this avatar to the Forest network

Parameters
nowis the current time

Definition at line 511 of file Main.java.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: