Serialized Form

Class Game extends java.lang.Object implements Serializable

Serialization Methods

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads an object from a stream.


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes the race data to an Object stream.

NOTE: We only write the necessary attributes and objects to keep the race and network load as load as possible.

Serialized Fields

id

int id
race id


name

java.lang.String name
race name


master_id

int master_id
id of the master player


server

Server server
Server object this race belongs to


race_result

java.lang.String[] race_result
list of results is a String array where the name of each player reaching the goal is stored


num_finished

int num_finished
number of players who have reached the goal


track

Track track
track used in this race


is_racing

boolean is_racing
is this race in a racing state or not


running

boolean running
Is the race being run? The race loop is executed as long as running == true.


start_time

int start_time
starting time of the race


end_time

int end_time
time when the current race state (racing/not racing) ends


game_status

java.lang.String game_status
A text that tells the race state. This is sent to the client programs.


players

java.util.ArrayList players
A list of all players in this race.


wind_direction

int wind_direction
direction of the wind in this race, given in degrees


wind_velocity

int wind_velocity
velocity of the wind in this race, given in m/s


change_wind_time

int change_wind_time
time when the direction and strength of the wind will next be changed


rand

java.util.Random rand
Random object to generate random numbers


Class GameInfo extends java.lang.Object implements Serializable

Serialization Methods

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads an Object from a stream.


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes the game information to an Object stream.

Serialized Fields

id

int id
unique id of this race


name

java.lang.String name
name of this race


master_id

int master_id
id of the player who owns this race


num_players

int num_players
number of players in this race


is_racing

boolean is_racing
is the race currently in racing state


Class Player extends java.lang.Object implements Serializable

Serialization Methods

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads an object form a stream.


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes an object to a stream.

Serialized Fields

pos

Vector2 pos
position of the player's boat


direction

int direction
direction of the player's boat in degrees


sail_value

int sail_value
openness of the sail, an integer in range 0..100


id

int id
player's unique id


name

java.lang.String name
player's name


game

Game game
player's current race


client

ClientInterface client
interface to the client object of this player


cur_lap

int cur_lap
Stores the lap the player is in.

Lap 1 is the first lap.
At start, before the player has crossed the starting line, lap == 0.


next_port

int next_port
the next gate to pass


dist_to_next_port

float dist_to_next_port
distance to the next gate to pass


finished

boolean finished
has the player reached the goal


Class Server extends java.rmi.server.UnicastRemoteObject implements Serializable

Serialized Fields

players

java.util.ArrayList players
A list of the players that are on the server


games

java.util.ArrayList games
List of the races on the server.


track_list

java.lang.String[] track_list
A list of the names of the tracks that can be used.


Class StartupDialog extends javax.swing.JDialog implements Serializable

Serialized Fields

button_cancel

javax.swing.JButton button_cancel
cancel button


button_start

javax.swing.JButton button_start
start button


text_name

javax.swing.JTextField text_name
text field for the player name


text_host

javax.swing.JTextField text_host
text field for the host name


ok

boolean ok
Stores the state of the dialog.

Ok = false if "Cancel" was pressed, true if "Start" was pressed


Class Track extends java.lang.Object implements Serializable

Serialization Methods

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads an object from the given stream.


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes an object in the given stream.

Serialized Fields

name

java.lang.String name
track name


laps

int laps
how many laps a race sailed on this track lasts


maxDuration

int maxDuration
maximum duration of a race sailed on this track in seconds


ports

Port[] ports
gates of this track in an array


windChangeInterval

int windChangeInterval
how often to change the wind direction and velocity in seconds


minWindDirection

int minWindDirection
minimum direction of the wind in degrees


maxWindDirection

int maxWindDirection
maximum direction of the wind in degrees


minWindVelocity

int minWindVelocity
minimum velocity of the wind in m/s


maxWindVelocity

int maxWindVelocity
maximum velocity of the wind in m/s


Class Tracksail extends java.rmi.server.UnicastRemoteObject implements Serializable

Serialized Fields

host_name

java.lang.String host_name
Name of the host


player_name

java.lang.String player_name
Player name


player_id

int player_id
Player's unique id


game_id

int game_id
Unique id of the race the player is in (if we are in one)


game

Game game
Current state of the race (if we are in one)


is_master

boolean is_master
Is this player the master of the current race?


frame

javax.swing.JFrame frame
Main window


is_lobby

boolean is_lobby
Are we in a lobby room or in a race room? True means we're in a lobby, false means we're in a race


active

boolean active
Tells if we're still executing the program. We exit the game loop when this variable is set to false.


chat_text

java.util.ArrayList chat_text
The latest chat messages. These are for the race room, only the latest messages are shown.


ts_server

ServerInterface ts_server
An interface used to call the remote methods of the server


lobby_panel

javax.swing.JPanel lobby_panel
Panel that's visible when in lobby room


info_text

javax.swing.JTextField info_text
Uneditable text field for the program to write information to


chat_messages

javax.swing.JTextArea chat_messages
Multiline text area where chat messages are output to


say_text

javax.swing.JTextField say_text
Text field for the player to write chat messages to


say_it

javax.swing.JButton say_it
Button that sends a chat message from this player


game_list

javax.swing.JList game_list
List of the races available


join_button

javax.swing.JButton join_button
Button to join a race


create_game_button

javax.swing.JButton create_game_button
Button to create a new race


game_name_text

javax.swing.JTextField game_name_text
Text field for the name of a new race


game_list_model

GameListModel game_list_model
Model for the race list


exit_button

javax.swing.JButton exit_button
Button to leave the program if we're at the lobby room. If we're racing, this button exits to the lobby room.


chat_scroll

javax.swing.JScrollPane chat_scroll
This makes the text area to scroll up so only the latest messages are seen at the bottom


race_panel

javax.swing.JPanel race_panel
This is the panel that's visible when we're racing


render_view

Tracksail.JRenderView render_view
Racing view. This is where we draw the race graphics.


start_button

javax.swing.JButton start_button
Button to start the race


track_list

javax.swing.JComboBox track_list
List to change the track


track_list_model

TrackListModel track_list_model
Model for the track list


turn_left_button

javax.swing.JButton turn_left_button
Button to turn the boat portboard


turn_right_button

javax.swing.JButton turn_right_button
Button to turn the boat starboard


sail_slider

javax.swing.JSlider sail_slider
Slider to set the sail control rope tightness


main_panel

javax.swing.JPanel main_panel
Main panel where all other content is placed


Class Tracksail.JRenderView extends javax.swing.JComponent implements Serializable

Serialized Fields

size

java.awt.Dimension size
size of the window in pixels


ship_images

java.awt.image.BufferedImage[] ship_images
image series for the boat


sail_images

java.awt.image.BufferedImage[] sail_images
image series for the sail


wind_images

java.awt.image.BufferedImage[] wind_images
image series for the wind sock


direction_images

java.awt.image.BufferedImage[] direction_images
image series for the guiding arrow


seatile_image

java.awt.image.BufferedImage seatile_image
image of sea waves


red_image

java.awt.image.BufferedImage red_image
image of red buoy


green_image

java.awt.image.BufferedImage green_image
image of green buoy


pix_per_m

float pix_per_m
Tells how many pixels on the screen represent one metre.

If e.g. the boat is 5m long and it's length in the image is 64 pixels, we get a multiplier of about 64 px / 5 m = 12.8 px/m.


look_at

Vector2 look_at
The point in the world where we direct our view to.

This is the point in the world that we see in the center of the screen. The idea is to stay centered on one's own boat.


Class Tracksail.TurnLeftAction extends javax.swing.AbstractAction implements Serializable


Class Tracksail.TurnRightAction extends javax.swing.AbstractAction implements Serializable


Class Vector2 extends java.lang.Object implements Serializable

Serialization Methods

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads an object from the given stream.


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Writes an object to the given stream.

Serialized Fields

x

float x
the value of the vector's x coordinate


y

float y
the value of the vector's y coordinate