Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Kazan on February 13, 2003, 11:45:22 am

Title: PXO Replacement - Need FS2Open Team coordination
Post by: Kazan on February 13, 2003, 11:45:22 am
if someone can help me figure out what signals freespace 2 send to the PXO servers over TCP and UDP i should be able to write a linux-based replacement that using an SQL server


[update]

Protocol Finished, i need you guys to start writing a browser in the game and i'll start coding the server
Title: PXO Replacement
Post by: Stealth on February 13, 2003, 12:07:50 pm
damn, i have no clue, but i'm interested to seewhat it really does send
Title: PXO Replacement
Post by: penguin on February 13, 2003, 12:26:18 pm
Once upon a time (about 8 months ago) I did a tcpdump of the interaction between an FS2 client and the PXO servers.

IIRC, there are 3 servers you are connected to at PXO:Then of course there are the game servers themselves, but they're outside the realm of PXO (and we have source for this).

This is all from my vague memory, but I think I still have the tcpdump logs on my box at home.

Since you're running Linux, you should have no problem reading them.  Ethereal ("http://www.ethereal.com/") is a great tool for looking at the dumps.
Title: PXO Replacement
Post by: Stealth on February 13, 2003, 12:36:15 pm
yeah that sounds about right.  glad you hardcore programmers are doing this and not me :p
Title: PXO Replacement
Post by: Inquisitor on February 13, 2003, 01:06:47 pm
I thought you were giving up on helping us, K?
Title: PXO Replacement
Post by: Kazan on February 13, 2003, 01:24:25 pm
nah, i was just getting bored
Title: PXO Replacement
Post by: Kazan on February 13, 2003, 02:00:36 pm
looks like they completely ripped every trace of PXO out of the released code

so it looks like we have to design the new protocol


hmm

ok.. let's figure out what the server has to store


1) Active Server List
2) User Accounts
3) Permanant User Stats (pilots)
4) validated missions

now time to figure out what storing this data entails

well

Active Server List contains the following data
[list=1]
[see trailing posts for #3]


Validated missions is just the file name and it's crc
Title: PXO Replacement
Post by: Kazan on February 13, 2003, 02:19:41 pm
ok storing player stats entails storing
[list=1]
Title: ignore this if it doesn't makes sence, i'm a n00b in prgramming
Post by: kasperl on February 13, 2003, 02:33:19 pm
what about this:

you simply transfer tables and models the way missions are transfered now. you use a temporary folder, so that yu wn't do anything to backwards compatibility. u use a flag or something in the mission to define wich table it uses, and if no flag is found, the basic table will be used. off course, this will take a long time on slow conections,so i guess hosts should include something of a sign that a player sees before joining on how big the data transfer is. once again, i don't know if this is possible, i'm just trying to help
Title: PXO Replacement
Post by: Kazan on February 13, 2003, 02:34:52 pm
because you may not need to transfer just tables - you may have to trasnfer hundreds of megabytes of mod files.. so no
Title: PXO Replacement
Post by: Kazan on February 13, 2003, 03:00:10 pm
Quote
Originally posted by Kazan

Active Server List contains the following data
[list=1]
  • Status
  • Type (game type, and dedicated/not dedicated)
  • Server Netspeed
  • Server Name
  • Players
  • Ping (handled by client not server)
  • [/list=1]
     [/B]



these are both UDP packets


this one is sent Client->Server and when the Server receives it sends back the server list to the sender of this packet
Code: [Select]

struct serverlist_request_packet
{
     int pid; //  0x1 : serverlist request
     int type; // so you can request only servers of a certain time
     int status; // so you can request only servers of a certain status
}



the server list will be sent one server at a time - each server being on UDP packet containing this
Code: [Select]

struct serverlist_reply_packet
{
      int pid; // 0x2 : serverlist reply
      char servername[65];
      int netspeed;
      int status;
      short players;
      int type; // binary bitmask for type and dedicated server
}


a server sends this UDP packet to the server every 60 seconds has a "Heartbeat" telling the server it's here - if one isn't received for 120 seconds  the server is dropped from the list
Code: [Select]

struct serverlist_hb_packet
{
      int pid; // 0x3 : serverlist register
      char servername[65];
      int netspeed;
      int status;
      short players;
      int type; // binary bitmask for type and dedicated server
}
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 10:52:23 am
Quote
Originally posted by Kazan

2) User Accounts


login UDP datagrams

login request
Code: [Select]

struct fs2open_pxo_login
{
         int pid; // 0x4 : fs2open_pxo_login
         char username[65];
         char password[65];        
}

and the reply

Code: [Select]

struct fs2open_pxo_lreply
{
         int pid; // 0x5
         bool login_status; // true if successful, false if failed
         int sid; // if (login_status) sid = session id, ip associated and expires after 1 hour
         int pilots; // if (login_status) pilots = number of pilots for this account
}
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 11:02:17 am
Quote
Originally posted by Kazan

4) validated missions



request
Code: [Select]

struct fs2open_file_check
{
          int pid; // 0x5 for missions 0x7 for tables
}


reply
Code: [Select]

struct file_record
{
         char name[60];
         int crc32;
}

struct fs2open_pxo_missreply
{
         int pid; // 0x6 for missions 0x8 for tables
         int num_files;
         file_record files[num_files];
}
Title: PXO Replacement
Post by: IceFire on February 14, 2003, 11:12:06 am
In terms of interface...some kind of external software (like Gamespy for instance) or would we be able to use the art provided in the game?
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 11:14:46 am
Quote
Originally posted by IceFire
In terms of interface...some kind of external software (like Gamespy for instance) or would we be able to use the art provided in the game?


since the protocol is published you could have an internal browser and an external browser
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 11:15:45 am
doh
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 11:37:42 am
here's a dump of the mysql database

# phpMyAdmin MySQL-Dump
# version 2.3.2
# http://www.phpmyadmin.net/ (download page)
#
# Host: localhost
# Generation Time: Feb 14, 2003 at 11:36 AM
# Server version: 3.23.54
# PHP Version: 4.3.0
# Database : `FS2Open`
# --------------------------------------------------------

#
# Table structure for table `Missions`
#

CREATE TABLE Missions (
  FileName text,
  CRC32 int(11) default NULL,
  Type tinytext,
  Players tinyint(4) default NULL,
  Description text,
  Mod tinytext NOT NULL
) TYPE=MyISAM;
# --------------------------------------------------------

#
# Table structure for table `Pilot`
#

CREATE TABLE Pilot (
  UserName tinytext,
  PilotName tinytext,
  Points bigint(20) unsigned NOT NULL default '0',
  Missions int(10) unsigned NOT NULL default '0',
  Time bigint(20) unsigned NOT NULL default '0',
  LastFlight timestamp(14) NOT NULL,
  Kills int(10) unsigned NOT NULL default '0',
  Assists int(10) unsigned NOT NULL default '0',
  FriendlyKills int(10) unsigned NOT NULL default '0',
  PriShots int(10) unsigned NOT NULL default '0',
  PriHits int(10) unsigned NOT NULL default '0',
  PriFHits int(10) unsigned NOT NULL default '0',
  SecShots int(10) unsigned NOT NULL default '0',
  SecHits int(10) unsigned NOT NULL default '0',
  SecFHist int(10) unsigned NOT NULL default '0',
  KillsType blob
) TYPE=MyISAM;
# --------------------------------------------------------

#
# Table structure for table `Tables`
#

CREATE TABLE Tables (
  FileName tinytext NOT NULL,
  CRC32 int(11) NOT NULL default '0',
  Mod tinytext NOT NULL
) TYPE=MyISAM;
# --------------------------------------------------------

#
# Table structure for table `UserAccounts`
#

CREATE TABLE UserAccounts (
  UserName tinytext,
  PassWord tinytext,
  Email tinytext,
  Squadron tinytext
) TYPE=MyISAM;
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 11:40:37 am
Quote
Originally posted by Kazan
ok storing player stats entails storing
[list=1]
  • Name
  • Points
  • Enemy Kills/Friend Kills/Assists
  • Missions Flown
  • Flight Time
  • Last Flown Time
  • Kills by Ship Type
  • Primary Shots/Hits/Friendly Hits
  • Secondary Shots/Hits/Friendly Hits
  • [/list=1]

     [/B]


Code: [Select]

struct fs2open_get_pilot
{
          int pid; // 0x9
          int sid; // session id returned upon login
          char pilotname[65];
          bool create; // create pilot
}

struct fs2open_ship_typekill
{
          char name[65];
          unsigned int kills;
}

struct fs2open_pilot_reply
{
         int pid; // 0x0A
         int replytype; // 0 = pilot retrieved, 1 = pilot created, 2 = invalid pilot, 3 = invalid (expired?) sid, 4 = pilot already exists

         // if and only if (replytype == 0) then the rest of this data
         unsigned double points; // need large values, closest we can internally get to mySQL's bigint
         unsigned int missions;
         unsigned double flighttime;
         int LastFlight;
         int Kills;
         int Assists;
         int FriendlyKills;
         int PriShots;
         int PriHits;
         int PriFHits;
         int SecShots;
         int SecHits;
         int SecFHist;
         
         int ship_types;
         fs2open_ship_typekill type_kills[ship_types];
}



struct fs2open_pilot_update
{
         int pid; // 0x0B
         int sid; // session ud
         unsigned double points; // need large values, closest we can internally get to mySQL's bigint
         unsigned int missions;
         unsigned double flighttime;
         int LastFlight;
         int Kills;
         int Assists;
         int FriendlyKills;
         int PriShots;
         int PriHits;
         int PriFHits;
         int SecShots;
         int SecHits;
         int SecFHist;
         
         int ship_types;
         fs2open_ship_typekill type_kills[ship_types];          

         
}

struct fs2open_pilot_updatereply
{
         int pid; // 0x0C
         int replytype; // 0 = pilot updated, 1  = invalid pilot, 2 = invalid (expired?) sid
         
}
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 03:34:36 pm
I'm working on the server software right now
Title: PXO Replacement
Post by: Bobboau on February 14, 2003, 04:32:30 pm
getting back to the transfer of mods, though it is not feasable to transfer hundreds of megabytes of mod data, could it be posable to set up a system were smaller mods could be transfered, maybe have a list of files in the current data directory that are vital to the current mod so normaly that would just be the tables a few models and a few PCXs, all we would realy need then is a way to update the ship statistics and models and all that other good stuff wich should be in it's own topic
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 04:46:52 pm
that wouldn't be part of what im writing - that would be part of the game executeable.. im writing the PXO server
Title: PXO Replacement
Post by: Bobboau on February 14, 2003, 05:07:32 pm
I havn't looked at the mutiplayer section, so parden my ignorance, but is there just a "transfer file" function that would just have to be called with a pof or table file?

if so then talking about this sort of system in this topic is no longer needed.
Title: PXO Replacement
Post by: Kazan on February 14, 2003, 05:20:06 pm
you can use the same internal trasnfer file used on missions theorectially


but this is just the stats server, etc that im working on