Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Kazan on September 19, 2003, 12:00:30 pm

Title: FS2NetD 0.1 (DEMO!)
Post by: Kazan on September 19, 2003, 12:00:30 pm
i am starting to add the FS2NetD code into the client - i have it where it will hit the server with a server list request packet.. but it kinda freeze on return rightn ow - probably a time out thing ... i'm working on it

================= EDIT UPDATE ==============

a working demo is available here: http://deepbluebettas.com/Fs2Open/fs2netd_demo.zip

contains Special version of FS2 Open (CVS Build actually)

Full FS2NetD support
Also has my new D3D 8 screenshots fix.
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Starks on September 19, 2003, 11:53:05 pm
HOLY TARANIS BATMAN!
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: kasperl on September 20, 2003, 04:37:29 am
any ETC?

wasn't there the need for a IRC client first or something?

note: i have the flue right now, and i am not thinking clearly, ignore this if it doesn't make sense.
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 10:28:13 am
no ETC

IRC is seperate from my code
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 11:53:22 am
this mass of code gives me headaches - you cannot find where anything is - especially since [V] removed all evidence of the PXO code ever having existed - and since they code is so..... cornfusing..
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 01:58:37 pm
i have a server pinging the fs2open PXO server with heartbeat packets... now to get the damn client list request to succeed
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 03:45:54 pm
a couple of changed functions

Code: [Select]

void multi_join_load_tcp_addrs()
{
char line[MAX_IP_STRING];
net_addr addr;
server_item *item;
CFILE *file = NULL;
static char Server[32];
static int port = -1;

//if (On_FS2Open_PXO)
if (true) // THIS TO BE FIXED WHEN WE'RE FINISHED!
{
//FS2OpenPXO code

if (port == -1)
{
ml_printf("Network: Attempting to load config file\n");
// load the multi.cfg file
file = cfopen("fs2open_pxo.cfg","rt",CFILE_NORMAL,CF_TYPE_DATA);
if(file == NULL){
ml_printf("Network: Error loading fs2open_pxo.cfg file!\n");
return;
}

char Port[32];

if (cfgets(Server, 32, file) == NULL)
{
ml_printf("Network", "No Masterserver definition!\n");
return;
}

if (cfgets(Port, 32, file) != NULL)
port = atoi(Port);
else
port = 12000;

   cfclose(file);
}


// free up any existing server list
multi_free_server_list();


net_server *servers;
int numServersFound;

ml_printf("Network (FS2OpenPXO): Requesting server list\n");
servers = GetServerList(Server, numServersFound, port);


ml_printf("Network (FS2OpenPXO): Got %d servers.\n", numServersFound);

for (int i = 0; i < numServersFound; i++)
{
// copy the server ip address

memset(&addr,0,sizeof(net_addr));
addr.type = NET_TCP;

ml_printf("Network (FS2OpenPXO): Server %d ip is %s\n", i, servers[i].ip);
psnet_string_to_addr(&addr,servers[i].ip);

if ( addr.port == 0 ){
addr.port = DEFAULT_GAME_PORT;
}

// create a new server item on the list
item = multi_new_server_item();

if(item != NULL){

ml_printf("Network (FS2OpenPXO): Memcpy'ing Server %d into position\n", i);
memcpy(&item->server_addr,&addr,sizeof(net_addr));
}
}
delete servers;



ml_printf("Network (FS2OpenPXO): Finished adding servers - exiting multi_join_load_tcp_addrs()\n", i);
}
else
{
// --------------- Origional Code Provided by Volition -----------------
// attempt to open the ip list file
file = cfopen(IP_CONFIG_FNAME,"rt",CFILE_NORMAL,CF_TYPE_DATA);
if(file == NULL){
nprintf(("Network","Error loading tcp.cfg file!\n"));
return;
}

// free up any existing server list
multi_free_server_list();

// read in all the strings in the file
while(!cfeof(file)){
line[0] = '\0';
cfgets(line,MAX_IP_STRING,file);

// strip off any newline character
if(line[strlen(line) - 1] == '\n'){
line[strlen(line) - 1] = '\0';
}

// empty lines don't get processed
if( (line[0] == '\0') || (line[0] == '\n') ){
continue;
}

if ( !psnet_is_valid_ip_string(line) ) {
nprintf(("Network","Invalid ip string (%s)\n",line));
} else {
// copy the server ip address
memset(&addr,0,sizeof(net_addr));
addr.type = NET_TCP;
psnet_string_to_addr(&addr,line);
if ( addr.port == 0 ){
addr.port = DEFAULT_GAME_PORT;
}

// create a new server item on the list
item = multi_new_server_item();
if(item != NULL){
memcpy(&item->server_addr,&addr,sizeof(net_addr));
}
}
}

cfclose(file);
// --------------- end Origional Code Provided by Volition -----------------
}
}


and

Code: [Select]

void multi_create_do_netstuff()
{

// send Heartbeat to the FS2OpenPXO master server



static int LastSend = -1;
static char Server[32];

static int port;

if (LastSend == -1)
{
CFILE *file = cfopen("fs2open_pxo.cfg","rt",CFILE_NORMAL,CF_TYPE_DATA);
if(file == NULL){
ml_printf("Network","Error loading fs2open_pxo.cfg file!\n");
return;
}


char Port[32];
if (cfgets(Server, 32, file) == NULL)
{
ml_printf("Network", "No Masterserver definition!\n");
return;
}

if (cfgets(Port, 32, file) != NULL)
port = atoi(Port);
else
port = 12000;
}

if ((clock() - LastSend) >= 60000 || LastSend == -1)
{
LastSend = clock();

// finish implementation!
SendHeartBeat(Server, port, "Kazan's Alighty Test!", 10000, 0x1, 0x1, 4);
}
}
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 04:54:30 pm
YEAH MOTHER****ER! I GOT LISTING WORKING (95% working that is) - enough that you see other games!!!

[one place somewhere lurking that i have to add in another get list call]
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Inquisitor on September 20, 2003, 05:34:46 pm
good news.

this uses your sql based master server, right?
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 05:38:07 pm
Quote
Originally posted by Inquisitor
good news.

this uses your sql based master server, right?


yep - though ATM i still have to rebuild the database structure from my code... so right now im using the test server with NO_MYSQL defined so it automatically removes mysql references

tommorow im going to get the computer that had the database on it so hopefully i should be able to get a mysql dump of the structure


-------------------------

Server listing if fully functional... now i get to work on stats.. but not today - must work on some other things [non-fs2]
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Taristin on September 20, 2003, 05:48:15 pm
Quote
Originally posted by Kazan
Server listing is fully functional... now i get to work on stats.. but not today - must work on some other things [non-fs2]


Yep. I'm a witness. He tested it with me. :) Uber coolness™
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 07:27:00 pm
yep, he was ever so helpful - and KT tried to help .... someone else tried to help too... i think it was cptwhite
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Taristin on September 20, 2003, 07:31:47 pm
Kinda funny how you froze my PC like that... :p
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 20, 2003, 08:30:55 pm
Quote
Originally posted by Raa Tor'h
Kinda funny how you froze my PC like that... :p


yeah... trying to traverse a circularily linked linked as a normal linked list.. the termination condition kinda never happens (cur never = NULL) -- just continuously bombarded your system with server queries... hehehehe

locked both systems up infact... your system would have unfroze the moment i killed the process on mine if you would have let it sit
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Taristin on September 21, 2003, 10:30:24 am
Heh, I did, FS2 froze, so I hit the magical Ctrl-Alt-Del and switched out of it... :)
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 21, 2003, 10:46:47 pm
helps when i remember in the really old thread there is phpMyAdmin mysql dumb of the dbase structure...
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Knight Templar on September 21, 2003, 10:58:42 pm
You can't freeze my pc, it freezes you. :drevil:
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 21, 2003, 11:01:34 pm
Quote
Originally posted by Knight Templar
You can't freeze my pc, it freezes you. :drevil:


actually it doesn't freeze it - your pc sends a malformed UDP packet which causes the server to crashola
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Knight Templar on September 21, 2003, 11:48:12 pm
I couldn't have said it better myself. Beautiful, really. :devil:



;)
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 22, 2003, 10:29:26 am
the PXO part of the multiconfig screen is fully operational again - and now applies to FS2OpenPXO --- btw that screen crashing _should_ be fixed... the PXO password box config was fux0red - someone messed up the code for how long the textbox's capacity should be
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Carl on September 22, 2003, 01:28:17 pm
Quote
Originally posted by Kazan
cornfusing..
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 22, 2003, 03:28:09 pm
Quote
Originally posted by Carl
[image that won't link]


rotfl



Mission validation is mostly working now (it generate's a new mvalid.cfg file.... FS2 isn't using it though ---- and it's kinda slow but i cannot help that - it's the VCode that is holding **** up)
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 22, 2003, 09:47:55 pm
it fully uses the validation code now

for benchmark purposes is validates 54 missions in 1.6 seconds including drawing to screen and playing a sonud for each...
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 23, 2003, 02:17:46 am
btw that was commited


i think i have stand alone servers almost working again..
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Inquisitor on September 23, 2003, 12:19:53 pm
MANY thanks to Kazan for getting this working.

I would suggest that the lunx guys update and see how it works on their end, and the SCP people to update their CVS to make sure they have no problems compiling.

Good job, K!
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 23, 2003, 12:28:16 pm
Quote
Originally posted by Inquisitor
MANY thanks to Kazan for getting this working.

I would suggest that the lunx guys update and see how it works on their end, and the SCP people to update their CVS to make sure they have no problems compiling.

Good job, K!


the linux guys need to look in the UDP_Socket::GetPacket function and READ MY COMMENT

I haven't altered that part of the code to be nonblocking yet - and they socket must be nonblocking
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 23, 2003, 11:13:10 pm
STATS ARE STORING!
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 24, 2003, 12:58:33 am
demo version above updated - i will leave the masterserver online as much as possible - IF YOU WANT A TRACKER ACCOUNT FOR TESTING POST HERE!
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 24, 2003, 01:33:23 am
FYI: There is a tracker account setup for testing

user: pxotest
pass: pxotest


remember:

Enable PXO - enter above login for user/pass

then you're good to go [the released version WILL NOT tell you if your stats have stored - you'll be able to tell though because every time you hit the server list screen it'll fetch wat the server has for your stats]
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Starks on September 24, 2003, 05:35:10 am
Sounds good.
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on September 25, 2003, 05:03:48 pm
BUMP!

Support version 1.0 posted at url above
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Starks on October 12, 2003, 12:59:54 am
The latest version is FRED2...
Title: FS2NetD 0.1 (FS2Open PXO server) stuff
Post by: Kazan on October 12, 2003, 11:26:37 am
hehe... oopsie :D