Jump to content

Kyp

Lead Developers [LDEV]
  • Posts

    6497
  • Joined

  • Last visited

  • Donations

    0.00 USD 

Posts posted by Kyp

  1. 3 minutes ago, Doctor said:

    The other thread wasn't the right place to say it, but what I have is a C++ version of the server. I remember it being 2009 when I was playing and had the server source. But that was also long enough ago that who knows. Maybe I'm crazy. What I have is a full source code and DB copy. I could run an active multiplayer server (granted, nowhere near as complete as what yall have) right now. Well, if I felt like reinstalling visual studio. It's got tons of bugs, and doesn't stay up anywhere near as long as your current server.

     

    This is not me bragging or being abrasive. I am simply laying out facts. You're one guy. You have a life. I'd hate having to support this game 24x7 too; I've been on-call a lot, I hated it. What was being offered, fundamentally, was yet another door people could knock on when you were off doing life stuff. Maybe I would be in a place to fix it while you were away. I get it, you get abused constantly. I was not being mean.

     

    Here (was) net7.cpp

    // Net7.cpp
    
    #include "Net7.h"
    #include "ServerManager.h"
    #include "UDPConnection.h"
    
    //DIMA: I don't think these are needed
    #define MASTER_INSTANCE_MUTEX_NAME	"Net7 Master Server Instance Mutex"
    #define SECTOR_INSTANCE_MUTEX_NAME	"Net7 Sector Server port %d Instance Mutex"
    
    #pragma comment(lib, "wsock32.lib")
    #pragma comment(lib, "libmySQL.lib")
    #pragma comment(lib, "ssleay32.lib")
    #pragma comment(lib, "libeay32.lib")
    #pragma comment(lib, "lua.lib")
    #pragma comment(lib, "luabind.lib")
    
    char g_MySQL_User[MAX_PATH];
    char g_MySQL_Pass[MAX_PATH];
    char g_MySQL_Host[MAX_PATH];
    char g_Galaxy_Name[MAX_PATH];
    int g_DASE = 0;
    
    char g_LogFilename[MAX_PATH];
    char g_InternalIP[MAX_PATH];
    char g_DomainName[MAX_PATH];
    unsigned long g_StartTick;
    
    long g_Sector_Start = 973;
    long g_Max_Space_Sector = 9000; //2210;
    
    bool g_Debug = false;
    bool g_ServerShutdown = false; // Terminated the global Server
    
    ServerManager * g_ServerMgr = 0;
    GMemoryHandler * g_GlobMemMgr = 0;
    PlayerManager * g_PlayerMgr = 0;
    StringManager * g_StringMgr = 0;
    ItemBaseManager * g_ItemBaseMgr = 0;
    AccountManager * g_AccountMgr = 0;
    SaveManager	  * g_SaveMgr = 0;
    
    void Usage()
    {
    	printf("Net7 Usage:\n\n");
    	printf("to run the main server:\n");
    	printf("   Net7 /MASTER /ADDRESS:(ip address)\n\n");
    	printf("to run a sector server:\n");
    	printf("   Net7 /PORT:3500 /ADDRESS:(ip address) /MAX_SECTORS:(num sectors) /ALTSECTORS\n\n");
    }
    
    int main(int argc, char* argv[])
    {
        // Let the user know when this was compiled for reference purposes
        printf("Net7: Built on %s, at %s\n\n",__DATE__, __TIME__);
        g_StartTick = GetTickCount();
    
        bool standalone = false;
        bool master_server = false;
        bool sector_server = false;
    
        long port = SECTOR_SERVER_PORT;
        char address[32];
        char *domain = "";
        char *max_sectors_str = new char[4];
    	char *server_name;
    	char mutex_name[80];
    
    	//sprintf(max_sectors_str, "10");
    	//sprintf(max_sectors_str, "74");
    	sprintf(max_sectors_str,"300");
    
    	g_MySQL_User[0] = 0;
    	g_MySQL_Pass[0] = 0;
    	g_Galaxy_Name[0] = 0;
    	g_DASE = false;
    
    	srand((unsigned)GetNet7TickCount());
    
    	FILE *f = fopen(CONFIG_FILE, "r");
        if (f)
        {
            fseek(f, 0, SEEK_END);
            long file_size = ftell(f);
            fseek(f, 0, SEEK_SET);
            char *data = new char[file_size + 1];
            if (data)
            {
    			char *Info;
    			char *VarName;
                long size = fread(data, 1, file_size, f);
                data[size] = 0;
    			VarName = strtok(data, "=");
    			Info = strtok(NULL, "\n");
    			do
                {
    				if (!_strcmpi(VarName, "domain")) 
                    {
    					strcpy(g_DomainName, Info);
    				}
    				if (!_strcmpi(VarName, "internal_ip")) 
                    {
    					strcpy(g_InternalIP, Info);
    				}
    				if (!_strcmpi(VarName, "mysql_user")) 
                    {
    					strcpy(g_MySQL_User, Info);
                    }
    				if (!_strcmpi(VarName, "mysql_pass")) 
                    {
    					strcpy(g_MySQL_Pass, Info);
    				}
    				if (!_strcmpi(VarName, "mysql_host")) 
                    {
    					strcpy(g_MySQL_Host, Info);
    				}
    				if (!_strcmpi(VarName, "galaxy_name")) 
                    {
    					strcpy(g_Galaxy_Name, Info);
    				}
    				if (!_strcmpi(VarName, "use_dase"))
    				{
    					g_DASE = atoi(Info);
    				}
    				VarName = strtok(NULL, "=");
    				Info = strtok(NULL, "\n");
    			} 
                while(Info != NULL);
    
                delete [] data;
            }
            fclose(f);
        }
        else
        {
    		char filedata[128];
            printf("Error opening %s\n", CONFIG_FILE);
    		sprintf(g_DomainName, "local.net-7.org");
    		sprintf(filedata, "domain=local.net-7.org\nmysql_user=enb\nmysql_pass=enbserver\nmysql_host=localhost:3307\nmysql_db=net7\ngalaxy_name=Cassiopeia");
    		f = fopen(CONFIG_FILE, "w");
    		fwrite(filedata,1,strlen(filedata),f);
    		fclose(f);
        }
    
    	// if no galaxy name set one!
    	if (g_Galaxy_Name[0] == 0)
    		strcpy(g_Galaxy_Name, "Cassiopeia");
    
    #ifdef SQL_ENABLE
    	printf("MySQL: Host: %s, User: %s\n", g_MySQL_Host, g_MySQL_User);
    #endif
    
        // No arguments indicate a standalone server via localhost
        for (int i = 1; i < argc; i++)
        {
    	    if ((strncmp(argv[i], "/DOMAIN:", 8) == 0))
    	    {
                domain = argv[i] + 8;
            }
            else if ((strncmp(argv[i], "/MASTER", 7) == 0) && !master_server)
            {
                master_server = true;
        		server_name = "Master Server";
    		    strcpy(mutex_name, MASTER_INSTANCE_MUTEX_NAME);
    		    sprintf(g_LogFilename, "%sNet7_server", SERVER_LOGS_PATH);
    		    LogMessage("Net7 Master Server (Auth:%d, Global:%d, Master:%d)\n",
                    SSL_PORT, GLOBAL_SERVER_PORT, MASTER_SERVER_PORT);
            }
            else if ((strncmp(argv[i], "/PORT:", 6) == 0) && !sector_server)
            {
                sector_server = true;
    		    port = atoi(argv[i] + 6);
    		    sprintf(mutex_name, SECTOR_INSTANCE_MUTEX_NAME, port);
    		    server_name = "Sector Server";
    		    sprintf(g_LogFilename, "%ssector_server_port_%d", SERVER_LOGS_PATH, port);
    		    LogMessage("Net7 Sector Server (Port %d)\n", port);
            }
            else if ((strncmp(argv[i], "/MAX_SECTORS:", 13) == 0) && sector_server)
            {
    		    max_sectors_str = argv[i] + 13;
                g_Max_Space_Sector = 4595;
            }
            else if (strncmp(argv[i], "/ALTSECTORS",11) == 0)
            {
                g_Sector_Start = 1910;
                g_Max_Space_Sector = 4595;
            }
            else if (strncmp(argv[i], "/ALLSECTORS",11) == 0)
            {
                g_Sector_Start = 973;
                g_Max_Space_Sector = 4595;
    			sprintf(max_sectors_str, "300");
                printf("ALL SECTORS flag\n");
            }
            else if (strncmp(argv[i], "/STARTSECTOR:",13) == 0)
            {
                g_Sector_Start = atoi(argv[i]+13);
                printf("Starting at Sector %d\n", g_Sector_Start);
            }
    		else if (strncmp(argv[i], "/DEBUG", 6) == 0)
    		{
    			g_Debug = true;
                printf("DEBUG flag\n");
    		}
            else
            {
                printf("Unrecognized switch: '%s'\n", argv[i]);
                Usage();
                return(1);
            }
        }
    
    	printf("Domain set to: %s\n", g_DomainName);
    
    
    #ifdef WIN32
        // Winsock startup
        WSADATA	wsaData = {NULL};
    	WSAStartup(MAKEWORD(2, 2), &wsaData);
    #endif
    
    	if (strlen(domain)>0)
    		strcpy(g_DomainName, domain);
    
    	struct hostent * host = gethostbyname(g_DomainName);
    	if (!host)
    	{
            int err = WSAGetLastError();
            printf("Unable to resolve IP address for %s (error=%d)\n", g_DomainName, err);
            return(1);
        }
        unsigned char *ip = (unsigned char *) host->h_addr;
        sprintf(address, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
    
        if (!master_server && !sector_server)
        {
    		sprintf(g_LogFilename, "%sNet7_server", SERVER_LOGS_PATH);
    		LogMessage("Net7 Standalone Server (Auth:%d, Global:%d, Master:%d \n\tMaxSectors: %s Version: %d.%d-%s%s Build %d)\n",
                SSL_PORT, GLOBAL_SERVER_PORT, MASTER_SERVER_PORT, max_sectors_str, UPPER_VER, LOWER_VER, VER_TYPE, SQL_ACCOUNT_STRING,  BUILD_VER);
            standalone = true;
            LogMessage("Net7 IP addr = %s\n", address);
        }
    
        if (master_server && sector_server)
        {
            printf("Can't combine /MASTER and /PORT switches\n");
    		Usage();
    		return(1);
    	}
    
    	unsigned long ip_address_internal = inet_addr(g_InternalIP);
    	unsigned long ip_address = inet_addr(address);
    
        long max_sectors = atoi(max_sectors_str);
    
        if ((port < 3500) || (port > 32767))
        {
            printf("Invalid /PORT specified for Sector Server\n");
    		return(1);
        }
    
        if ((max_sectors < 1) || (max_sectors > 300))
        {
            printf("Invalid /MAX_SECTORS specified for Sector Server\n");
    		return(1);
        }
    
    #ifdef WIN32
        // First, make sure we only have one instance of the Global Server running
        HANDLE instance_mutex = ::CreateMutex(NULL, TRUE, mutex_name);
        if (instance_mutex == INVALID_HANDLE_VALUE)
    	{
    		::MessageBox(NULL, "Error creating instance mutex", "Net7", MB_ICONERROR);
    		return(1);
    	}
    
        // if we did not create this mutex then .. another instance
        // is already running
        if (::GetLastError() == ERROR_ALREADY_EXISTS)
        {
            // close the mutex
            ::CloseHandle(instance_mutex);
    		::MessageBox(NULL, "Another instance of the Net-7 Server is already running", "Net7", MB_ICONERROR);
    		return(1);
        }
    #endif
    
        // Delete the previous log file and start a new one
    	//DeleteFile(g_LogFilename);
        ServerManager server_mgr(master_server, ip_address, (short) port, (short) max_sectors, standalone, ip_address_internal);
        server_mgr.SetPlayerMgrGlobalMemoryHandler();
    
    	//MVAS Login UDP connection - needs to be done after global memory manager setup.
    	UDP_Connection MVASauth(MVAS_LOGIN_PORT, &server_mgr, CONNECTION_TYPE_MVAS_TO_PROXY);
        server_mgr.SetUDPConnection(&MVASauth);
        MVASauth.SetServerManager(&server_mgr);
    
    	server_mgr.RunServer();
    
    #ifdef WIN32
        // Winsock cleanup
        WSACleanup();
    #endif
    
    #ifdef WIN32
    	::CloseHandle(instance_mutex);
    #endif
    
        return 0;
    }
    
    unsigned long GetNet7TickCount()
    {
        return (GetTickCount() - g_StartTick);
    }
    
    // Functions added for Linux port
    #ifndef WIN32
    unsigned long GetCurrentDirectory(unsigned long size, char *path)
    {
        if (getcwd(path, size) < 0)
        {
            return 0;
        }
        return (strlen(path));
    }
    
    int SetCurrentDirectory(const char *path)
    {
        if (chdir(path) < 0)
        {
            return 0;
        }
        return 1;
    }
    
    void Sleep(unsigned long dwMilliseconds)
    {
        usleep((unsigned int) dwMilliseconds * 1000);
    }
    
    bool DeleteFile(const char *file)
    {
        return (!remove(file));
    }
    
    long GetTickCount()
    {
        timeval tv;
        gettimeofday(&tv, 0);
        return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
    }
    
    
    #endif

     


    Don't worry, my feelings don't hurt easily. It was the tone of your post that prompted my response in the same tone. Given that we give no representation or requirement that we're up 'most of the time' such as a profit business might, 9 hours is not all that long. Probably wouldn't have been that long even if I'd seen it last night before running out of steam, but I didn't.

  2. 2 hours ago, Doctor said:

    I'm retired, and if being a 'game dev' means I can whip the hamsters into working again in < 9 hours, so be it. I used to run my own local copy of the EMU back in 2009 when the source code wasn't closed. I doubt most of that code is still in use, but regardless...I know how it *used* to work. It's still down, btw.


    I am not, and also have a home, family, and other life to maintain. Sometimes that means it stays down for a while. The code base isn't even in the same programming language as it was back then. Incidentally, if memory serves we didn't even get the multiplayer working properly until like 2010/2011, seeing as we only had about a year of 'beta' prior to going to 'sunrise' in 2012. It sounds like you might have been referring to the single player client we had, or the earliest versions of multiplayer, either way most of that code was in Java and none of it is Java now.

    Anyway, while I can appreciate the point of view, there are certainly other things to do for a few hours now and again.

    It's back up, btw.

    • Like 1
    • Upvote 2
  3. Finally free from work hours. Proceeding to look into the issue a bit, please DO NOT attempt to login during this time, I will let you all know when it is safe to try again. I'm attempting to capture some data, so attempted logins right now could pollute and complicate the issue.

  4. It does not appear to be from the server side, I see people changing sectors which requires that functionality each time (part of the gating mechanism).

    I can dump it again but if this keeps up it may have to stay down a while for it to get investigated properly. I am working now so that won't be until later in the day.

  5. Server was up, login server/comm server had crashed. Restarted it all, should be accessible in a moment. FYI there is a known issue where the Christmas missions may not be working right, this will be rectified soon and I'll leave it in place for a while after Christmas so everyone gets a chance for it.

  6. I have a discord server already for the stuff, just haven't really sent it out because we had some developers who didn't want to use it at the time I set it up (it used to have some privacy/security related issues that have since been cleaned way up)

  7. On 11/24/2023 at 6:51 PM, J4V3N said:

    So, I'm a former Live Player and 10-year full stack web dev wanting to help with any free time I may have.  How best could I do that?  I have experience in Java, C++, most types of Databases, python, even most modern AI toolkits.  Can DM a resume if needed.  :)


    Do that, but I guess what i'd say is weakest point presently is probably more content developers to write things up and basically create the missions, NPCs, personalities, etc

    /edit ... to me that is.

  8. The server itself did not crash. only the logon processes. Not sure what triggered that, but at any rate, I have taken the game server down for now as there are pending updates for the server itself, Going to install those and bring things back up to minimize any downtime.

    Ok sorry, things are coming back online now. I was indisposed when I got the message that there was an issue.

    • Like 2
×
×
  • Create New...