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
-
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
-
damn, i have no clue, but i'm interested to seewhat it really does send
-
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:- a game/channel server (pretty much vanilla IRC); this one is the chat server and it keeps track of the state of all currently running games in each channel
- a user server, which does the user/password login and validation, and keeps track of stats. I think this was a binary protocol.
- a web server (plain old straight HTTP), that I think only serves banner ads
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.
-
yeah that sounds about right. glad you hardcore programmers are doing this and not me :p
-
I thought you were giving up on helping us, K?
-
nah, i was just getting bored
-
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]
- Status
- Type (game type, and dedicated/not dedicated)
- Server Netspeed
- Server Name
- Players
- Ping (handled by client not server)
[/list=1]
permanant users is just username/password/email
[see trailing posts for #3]
Validated missions is just the file name and it's crc
-
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]
and I just remembered that the server also has to know what the valid tables are - names and crcs -- we could also runs seperate ports on the stats server for seperate mods *raises eyebrow*
-
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
-
because you may not need to transfer just tables - you may have to trasnfer hundreds of megabytes of mod files.. so no
-
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
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
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
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
}
-
Originally posted by Kazan
2) User Accounts
login UDP datagrams
login request
struct fs2open_pxo_login
{
int pid; // 0x4 : fs2open_pxo_login
char username[65];
char password[65];
}
and the reply
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
}
-
Originally posted by Kazan
4) validated missions
request
struct fs2open_file_check
{
int pid; // 0x5 for missions 0x7 for tables
}
reply
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];
}
-
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?
-
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
-
doh
-
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;
-
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]
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
}
-
I'm working on the server software right now
-
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
-
that wouldn't be part of what im writing - that would be part of the game executeable.. im writing the PXO server
-
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.
-
you can use the same internal trasnfer file used on missions theorectially
but this is just the stats server, etc that im working on