Page 1 of 3

VegaStrike Online MMO Server

Posted: Sun Jan 19, 2014 5:54 am
by Eye~R
Hi.

Just a little post to mention I've setup a (mostly default, currently) VegaStrike server.

Account Creation: http://vegastrike.armed.me.uk:8080

Server: VegaStrike.Armed.Me.Uk
Port: 6777

Enjoy.

Re: VegaStrike Online MMO Server

Posted: Sun Jan 19, 2014 3:54 pm
by loki1950
Welcome aboard Eye~R not sure if I will be using your sever(connectivity issues) but have fun.

Enjoy the Choice :)

Re: VegaStrike Online MMO Server

Posted: Sun Jan 19, 2014 7:56 pm
by Eye~R
Connecticity issues? What "issues" does you face?

Re: VegaStrike Online MMO Server

Posted: Sun Jan 19, 2014 9:48 pm
by loki1950
I use a cellular dongle it just costs to much as it's from Bell.ca cell rates in Canada are through the roof :twisted: only 3 national providers so it's essentially a monopoly,the current gov is trying to change that but is inept at actually doing anything :shock:

Enjoy the Choice :)

Re: VegaStrike Online MMO Server

Posted: Sun Jan 19, 2014 10:47 pm
by Eye~R
Hmm, Not much I can do about that I phear. I'll stop looking for errors then. Might wanna look into if yur govmnt can dish out some grant or somthing so you can invest in some 2'nd hand 3G equipment, or some alternate source of funding - See if y'can do better yourself...

Re: VegaStrike Online MMO Server

Posted: Sat Jan 25, 2014 3:39 am
by gonzo
Briliant! I'll give it a go soon.

Re: VegaStrike Online MMO Server

Posted: Tue Feb 11, 2014 1:19 am
by ezee
Hi !
Thank you for the offer but ... could you explain please what to do and how it works ? ( in few lines :lol: )
I've been to the page of the server , and didn't knew what to choose in the dialog boxes .
Is it a persistent world for vegastrike ?
would be fantastic !
:wink:

Re: VegaStrike Online MMO Server

Posted: Wed Mar 05, 2014 6:14 am
by Eye~R
Heh, Yeah, it's a peristent(hopefully) world for vegastrike, It's still rather default unfortunately, I tried cloning up the sourceforge page to make the signup look pretty but I'm too 'tard to make it process the .css, but the form is funcitonal ...
There's no docs for the MySQL component, so it's file-based at the moment, when I'm less lazy I'm hoping to reverse engineer that from a few generated accounts. Only fields at the moment is handle/login and password to auth it. The ship drop-down selector should hopefully speak for itself...

VPS supplier seems to has some issues, unsure of if it's the node or the datacenter, but it's had a maximum uptime of ~14days so far =( For some retardedness both the vegastrike server, and the account server set for start on boot, but only one does... if the vegaserver does, the account server doesn't.... if the account server does, the vegaserver doesn't. Annoyance. Hopefully things in pipe to has this migrated to CentOS and maybe that'll improve. but other than, resonably decent machine and apparently overpowered for purpose.

But the "persistence" opens up to some "interesting" possiblities.... like Nido's "markets" ( http://forums.vega-strike.org/viewtopic ... es#p134003 ) Like the online component itself, needs some devel, But is effectively working, and when things like resource dependancy/production table fully populated and more sensibly adjusted to enable and reflect a galactic economy(I'm actually thinking of shrinking the size of the rendered universe, or seeing what can be done to split the load across servers, as with loads of users this would get mental) I'm more than happy to deploy this, as it'll add a much needed depth to teh server. Touch of devel, and the server could offer a touch of needed depth to the game, and hopefully attract more players...

Re: VegaStrike Online MMO Server

Posted: Sat Apr 12, 2014 12:39 pm
by ezee
A very good project here .
I will try to help you as far that i can .
:wink:

edit : your server is actually down ?

Re: VegaStrike Online MMO Server

Posted: Mon Apr 14, 2014 12:05 am
by Eye~R
Well, it was up, just non-responsive on the accountserver.py component.

Retard spam bots see a form and try to spam, result: crash - Solution: parse user input/Sanity check.

I'm aware needs "better"frontpage - I did attempt to steal the sourceforge one but it appears python needs some additional to understand .css , So the signup page just looks really ugly. Was supposed to look more akin to the mock admin panel

Re: VegaStrike Online MMO Server

Posted: Mon Apr 14, 2014 12:31 am
by ezee
I did attempt to steal the sourceforge one but it appears python needs some additional to understand .css , So the signup page just looks really ugly.
Hey , it's a good idea ...
the "ugly" is that page ? : http://vegastrike.armed.me.uk/test/Login.html

That's much better than what you had a month ago !
Good job !
:wink:

Re: VegaStrike Online MMO Server

Posted: Mon Apr 14, 2014 1:02 am
by Eye~R
Heh, No. That's the sort of thing I was aiming for though. As previously mentioned, Python doesn't eat .css "off the bat" -=- Once I solve that the .py served signup form will conform(I hope).

Re: VegaStrike Online MMO Server

Posted: Sun Apr 20, 2014 2:57 am
by ezee
Tonight i successfully run the httpserver.py and the accountserver.py on my lan .

Then tested the vegaserver with vegastrike using account server .
That worked fine !

Well , until i try to make a jump and that vs crash .
Duno if my llama had some jump drive installed ...

Anyway , i can better understand the problems you are facing now as i can test and debug
myself the c++ and py codes .

For those interested , in order to make VS recognize your account server , remember
to change the setting in vegastrike.cfg : ( red were changed )
<!-- # Networking config -->
<section name="network">
<var name="force_client_connect" value="false"/>
<var name="account_server_url" value="http://127.0.0.1:8080/cgi-bin/accountserver.py"/>
<var name="server_ip" value="localhost"/>
<var name="server_port" value="6777"/>
<!-- Tells if the *CLIENT* uses an account server to find the server IP -->
<var name="use_account_server" value="true"/>
<var name="udp_listen_port" value="6777"/>
<var name="udp_listen_port_max" value="6777"/>
<var name="transport" value="udp"/>
<var name="use_webcam" value="false"/>
<var name="use_portaudio" value="false"/>
<var name="packettimeout" value="1000"/>
<var name="encryption_method" value="rsa"/>
<var name="encryption_keylength" value="128"/>
<var name="encryption_seed" value="Blah blah blah"/>

<!-- Update period for units snapshots -->
<var name="network_atom" value="0.2"/>
<!-- Update period for planets and nebulas position -->
<var name="planet_atom" value="1130"/>
<!-- Update period for damages data -->
<var name="damage_atom" value="5"/>

</section>
<!-- # End Networking -->
There's no docs for the MySQL component, so it's file-based at the moment, when I'm less lazy I'm hoping to reverse engineer that from a few generated accounts. Only fields at the moment is handle/login and password to auth it. The ship drop-down selector should hopefully speak for itself...
Man , i think i can help here .
I will try to use in data\cgi-accountserver\settings.py :

//THE CONFIG YOU USE , RIGHT ?
file_dbconfig = {
'type': 'file',
'storage': 'D:/program/experimental/data',
}

//THE CONFIG YOU WANT TO USE , RIGHT ?
mysql_dbconfig = {
'type': 'mysql',
'host': '127.0.0.1', #'mysql4-v.sourceforge.net'
'port': '3306',
'passwd': '',
'user': 'user_admin',
'db': 'vegastrike',
'user_table': 'phpbb_users',
'account_table': 'accounts',
'create_user':False,
}

//THE ACTUAL SWITCH , RIGHT ?
dbconfig = file_dbconfig
so if you want to use Mysql , just do :
dbconfig =mysql_dbconfig
instead of actual
dbconfig = file_dbconfig

I think we must create a base and the tebles manually .
[/quote]

'will try that now and report ...
come back man !
:wink:

Re: VegaStrike Online MMO Server

Posted: Sun Apr 20, 2014 3:18 am
by ezee
you were in need of more info about VS and mysql .
Details of implementation are located in data\cgi-accountserver\db.py :
class MysqlDB(DBBase):
def __init__(self, config, mod):
DBBase.__init__(self, mod)
if 1: #try:
import MySQLdb <<< doc -> http://mysql-python.sourceforge.net/MySQLdb.html
self.conn = MySQLdb.connect(
host = config['host'],
port = int(config.get('port','3306')),
passwd = config['passwd'],
user = config['user'],
db = config['db'])
self.dict_cursor = MySQLdb.cursors.DictCursor
else: #except:
self.conn = None
self.dict_cursor = None
self.user_table = config.get('user_table', 'accounts')
self.account_table = config.get('account_table', 'accounts')

if config.get('create_user',True):
self.create_user = True
else:
self.create_user = False
With the doc , you should be able to understand what this code is actually doing .
Let me get in this doc too , and see what i can do .
:wink:

you will like that in the doc ( yeah same http://mysql-python.sourceforge.net/MySQLdb.html ) :
Generally speaking, putting passwords in your code is not such a good idea:

db=_mysql.connect(host="outhouse",db="thangs",read_default_file="~/.my.cnf")
This does what the previous example does, but gets the username and password and other parameters from ~/.my.cnf (UNIX-like systems). Read about option files for more details.
and about SSL :
Only a few top-level functions and attributes are defined within MySQLdb.

connect(parameters...)
Constructor for creating a connection to the database. Returns a Connection Object. Parameters are the same as for the MySQL C API. In addition, there are a few additional keywords that correspond to what you would pass mysql_options() before connecting. Note that some parameters must be specified as keyword arguments! The default value for each parameter is NULL or zero, as appropriate. Consult the MySQL documentation for more details. The important parameters are:

host
name of host to connect to. Default: use the local host via a UNIX socket (where applicable)
user
user to authenticate as. Default: current effective user.
passwd
password to authenticate with. Default: no password.
db
database to use. Default: no default database.
port
TCP port of MySQL server. Default: standard port (3306).
unix_socket
location of UNIX socket. Default: use default location or TCP for remote hosts.
conv
type conversion dictionary. Default: a copy of MySQLdb.converters.conversions
compress
Enable protocol compression. Default: no compression.
connect_timeout
Abort if connect is not completed within given number of seconds. Default: no timeout (?)
named_pipe
Use a named pipe (Windows). Default: don't.
init_command
Initial command to issue to server upon connection. Default: Nothing.
read_default_file
MySQL configuration file to read; see the MySQL documentation for mysql_options().
read_default_group
Default group to read; see the MySQL documentation for mysql_options().
cursorclass
cursor class that cursor() uses, unless overridden. Default: MySQLdb.cursors.Cursor. This must be a keyword parameter.
use_unicode
If True, CHAR and VARCHAR and TEXT columns are returned as Unicode strings, using the configured character set. It is best to set the default encoding in the server configuration, or client configuration (read with read_default_file). If you change the character set after connecting (MySQL-4.1 and later), you'll need to put the correct character set name in connection.charset.

If False, text-like columns are returned as normal strings, but you can always write Unicode strings.

This must be a keyword parameter.
charset
If present, the connection character set will be changed to this character set, if they are not equal. Support for changing the character set requires MySQL-4.1 and later server; if the server is too old, UnsupportedError will be raised. This option implies use_unicode=True, but you can override this with use_unicode=False, though you probably shouldn't.

If not present, the default character set is used.

This must be a keyword parameter.
sql_mode
If present, the session SQL mode will be set to the given string. For more information on sql_mode, see the MySQL documentation. Only available for 4.1 and newer servers.

If not present, the session SQL mode will be unchanged.

This must be a keyword parameter.
ssl
This parameter takes a dictionary or mapping, where the keys are parameter names used by the mysql_ssl_set MySQL C API call. If this is set, it initiates an SSL connection to the server; if there is no SSL support in the client, an exception is raised. This must be a keyword parameter.
...
...

Re: VegaStrike Online MMO Server

Posted: Mon Apr 21, 2014 1:42 am
by Eye~R
ezee wrote:so if you want to use Mysql , just do :
dbconfig =mysql_dbconfig
instead of actual
dbconfig = file_dbconfig

I think we must create a base and the tebles manually .


'will try that now and report ...
come back man !
Heh, I know that much. What I don't know is if it'll make the table if it doesn't exist, or if I need to. If it'll populate the table with applicable fields, or if I need to - And If I do need to then I'm unsure of what fields are actually required by the software... I've a feeling I've need for additional fields, like the IP used for signup and when, and preferable one that can contain the last 5x used IP's... I also don't know where to begin populating a database with the existing user payload(currently stored in files) I see it mention of SSL, but not as to it's implimentation state - I can run the (MySQL)server on that machine and access localhost only or I've another machine that can handle SQL quite nicely...

The other thing I'm unsure of is how to talk to the game. Preferably from something like PHP, Ideally this would need to be two-way interaction then users can interface with various facets from outside the game, without being logged in(for example, tweaking values in the resource mangmnt screen w/o the need to load vegastrike) as well as the more obvious functionality like displaying number of logged in users.

Re: VegaStrike Online MMO Server

Posted: Mon Apr 21, 2014 10:19 am
by ezee
We must create the database and the two tables .
I don't know yet how the program fill them , nor what does the " createuser " option .
I go check that now !
I also don't know where to begin populating a database with the existing user payload(currently stored in files)
i'll look to that too ...
:wink:

Edit : As you've talked about php , i think that at least one file in the " /cgi-accountserver "
folder could be translated in php , where you could use .css :
It is the :register_submit.py file .

Well , i think the same apply with register.py that could be translated to register.php .
If you think that could be useful ?

REEDIT : Perhaps i'm wrong , but it seem to me that for your MMO project , we could use
the native http server of your server , instead of this set of .py files ?
From what i understand , the client vegaserver uses only the
<var name="account_server_url" value="http://127.0.0.1:8080/cgi-bin/accountserver.py"/>
parameter in vegastrike.config to access the server .
edit : verified in the c++ code , in netserver.cpp , line 266 :
std::string acctsrv = vs_config->getVariable( "network", "account_server_url", "" );
full implementation in the start() of the server :
http://spacetechs.free.fr/VEGASTRIKEDEV ... tml#l00167



This parameter could be in the future :
<var name="account_server_url" value="http://127.0.0.1:8080/cgi-bin/accountserver.php"/>
:?:

example of php pure web server :
http://yoan.dosimple.ch/blog/2011/04/30/

Ratchet :
WebSockets for PHP
Ratchet is a loosely coupled PHP library providing developers with tools to create real time, bi-directional applications between clients and servers over WebSockets.
This is not your Grandfather's Internet.
http://socketo.me/ and demo : http://socketo.me/demo

Re: VegaStrike Online MMO Server

Posted: Mon Apr 21, 2014 12:54 pm
by ezee
About how the server actually do the saves :
( src doc : http://spacetechs.free.fr/VEGASTRIKEDEV ... tml#l00132 )

_ Saving server state :
//For now it only save units and player saves
void NetServer::save()
{
using namespace VSFileSystem;

Packet pckt;
string xmlstr, savestr;
//unsigned int xmllen, savelen, nxmllen, nsavelen;
NetBuffer netbuf;

//Save the Dynamic Universe in the data dir for now
string dynuniv_path = "dynaverse.dat";
VSFile f;
VSError err = f.OpenCreateWrite( dynuniv_path, ::VSFileSystem::UnknownFile );
if (err > Ok) {
cerr<<"FATAL ERROR: Error opening dynamic universe file"<<endl;
} else {
string dyn_univ = globalsave->WriteDynamicUniverse();
f.Write( dyn_univ );
f.Close();
}
zonemgr->displayNPCs();
}
_ Saving player state z:
bool NetServer::saveAccount( int i )
{
string xmlstr, savestr;
//unsigned int xmllen, savelen, nxmllen, nsavelen;
Cockpit *cp = _Universe->AccessCockpit( i );
//Write the save and xml unit
//FileUtil::WriteSaveFiles( savestr, xmlstr, VSFileSystem::datadir+"/serversaves", cp->savegame->GetCallsign());
//SEND THE BUFFERS TO ACCOUNT SERVER
if (cp && acctserver && acct_con) {
Unit *un = cp->GetParent();
ClientPtr clt;
if (un)
clt = getClientFromSerial( un->GetSerial() );
if (!clt || !un) {
cerr<<"Error client/unit for "<<(clt ? clt->callsign : "")<<", serial "<<(un ? un->GetSerial() : 0)
<<" not found in save process !!!!"<<endl;
return false;
}
if (clt->loginstate < Client::INGAME)
return false; //Cannot save at this point.

SaveNetUtil::GetSaveStrings( i, savestr, xmlstr, true );
if ( savestr.empty() || xmlstr.empty() )
//cerr<<"Unable to generate CSV and Save data for player."<<endl;
return false;
std::string snetbuf;
//Loop through clients to find the one corresponding to the unit (we need its serial)
//Fix CMD_RESPAWN. I expect the client to do the same thing here.
clt->savegame.clear();
clt->savegame.push_back( savestr );
clt->savegame.push_back( xmlstr );

addSimpleChar( snetbuf, ACCT_SAVE );
addSimpleString( snetbuf, clt->callsign );
addSimpleString( snetbuf, clt->passwd );
addSimpleString( snetbuf, savestr );
addSimpleString( snetbuf, xmlstr );
if ( !acct_sock->sendstr( snetbuf ) ) {
COUT<<"ERROR sending SAVE to account server for "<<clt->callsign<<" ("<<un->GetSerial()<<")"<<endl;
return false;
}
{
//Tell client that we saved the game.
Packet p1;
NetBuffer netbuf;
p1.send( CMD_SAVEACCOUNTS, un->GetSerial(), netbuf.getData(), netbuf.getDataLength(),
SENDRELIABLE, NULL, clt->tcp_sock, __FILE__, __LINE__ );
}
return true;
}
return false;
}
So you want to store the content of dynaverse.dat in a database ?
That is possible , to redirect the output to a table (via a new c++ function ).

I could code for example :
NetServer::saveSrvUniverseToDB( int i ){//MySql stuff instead of file}
and
bool NetServer::saveAccountToDB( int i ){//MySql stuff instead of file}
I think we should try now to set up the original database needed by the cgi_accntserver , make it work , then add our new tables or even databases .

I can later modify the c++ source code to add parameters for users,admin,kind of stuff saved etc ...

For your hierarchical login features , this is how things are designed today :
namespace accountXML
{
/*
*************************************************************
**** XML Things ***
*************************************************************
*/

enum Names
{
UNKNOWN,
PLAYER,
ADMIN,
ACCOUNTS,
//attributes
NAME,
PASSWORD,
SERIAL,
SERVERIP,
SERVERPORT
};

const EnumMap::Pair element_names[] = {
EnumMap::Pair( "UNKNOWN", UNKNOWN ), //don't add anything until below Admin so it maps to enum ACCOUNT_TYPE
EnumMap::Pair( "PLAYER", PLAYER ),
EnumMap::Pair( "ADMIN", ADMIN ),
EnumMap::Pair( "ACCOUNTS", ACCOUNTS )
};

const EnumMap::Pair attribute_names[] = {
EnumMap::Pair( "UNKNOWN", UNKNOWN ),
EnumMap::Pair( "NAME", NAME ),
EnumMap::Pair( "PASSWORD", PASSWORD ),
EnumMap::Pair( "SERVERIP", SERVERIP ),
EnumMap::Pair( "SERVERPORT", SERVERPORT ),
};
I think every detail about user privilege etc ... should be described in these
structures first .
Try to imagine in the 'NAMES' enum a category name you would implement .
And i'll code it .
:wink:

Re: VegaStrike Online MMO Server

Posted: Tue Apr 22, 2014 4:28 am
by Eye~R
Nice.

Clears up a lot of questions regarding the database, I'll get that rolling up to spec shortly... I just thought "file based" would be easier for getting it(vegaserver) off teh ground and functional. Once I've got the DB functional, Can expand the table later...

I'd not considered dynaverse.dat in (a seperate)DB, I'm still a little hazy as to it's purpose but from what I can make out, it'd make sense to be in one? I'm shoeless as to how this may effect nido's "markets" but would imagine long term it'd make a lot of things easier, and not just for that.

As for the heiarchial structure, I'm thinking complex, heh. Ideally, for a basic tree you'd need a "super admin" at top of the pile, The lesser number of these the better, but should require at least one... This would hold ultimate control over all functionality, including the ability to start/stop/restart the server (Ideally with some sort of timer, and broadcast message for logged in users for "fair warning"), This sort of administration could potentially take place via cli, in game via the "chat" or on web via some php admin panel. Under that, a collection of "admin" - can be delegated unto the account maintainence(needs a way for users to autonomously reset they pass, too, with human attention and recording previously used IP's and some other data may be possible to deduce genuine reset request, or if otherwise known to operator), and general responsabilities akin to a mod on a forum, including errant user eviction and banlist maintainence. Under them should exist the Faction Leaders, Responsible for the manipulation of and interaction between the opposing factions... defining and enforcing rates of bonus, tax and possibly even trade sanctions upon inter-faction trading. When Nido's markets apply, they should have control over the initial resource distrobution within their sectors, and the ability to(should they chose) delegate manage responsiblity to other faction members... with some sort of "tax" on resources pooled up to fabricate more resources(ie: mining stations, factories, shipyards etc) They should also be delegated control over their faction membership, Pilots should request to join, and be autherised (Pirates and Unadorned aside, They should have no faction leaders. Default un-factioned state, unadorned)- individuals refusing to conform to policies(Ie: refuses to cease hostile acts upon friendly factions) exiled from faction. Lastly, individual pilots... I would say "squadron leaders" but as owning more than one ship is currently certain death I think it's a bit much(But one day, one may control fleets).

If it wasn't clear from the above, each faction should have it's own internal hiearchy.. To illustrate crudely in ASCII...

Code: Select all

                                                       |¬General
                   |¬Admin                             |-----¬Major
                   |--------------¬Faction Leader------|------------¬  Lieutenant
SuperUser----------|¬Admin
                   |--------------¬ Faction Leader-----|¬Admiral
                   |¬Admin                             |-----¬Commodore
                                                       |------------¬Commander
Ranking within the faction should ideally be dealt with by the faction leader, definitions of how to attain what rank I'm unsure, but I'm thinking kill count so far.

As for fields within the database, For the basic layer of the tree above, will reqiure:
UNKNOWN, // --> ??
PLAYER, // Username
ADMIN, // Password(?)
ACCOUNTS, // Server-Assigned Serial No(?)
SHIP, // Current in fleet in use, will need later when have more than one ship... or could possibly use to change ship start with instead of making a new account.
ACCIP , // IP used to fabricate user account
LASTIP, // IP last used for successful login, ideally would need to hold last 10 unique, possibly elsewhere.
EMAIL, // Basic contact details, somewhere to send autonomous password reset. Possibly may be good to provide for other optional contact details.
ISSUPER, // A simple yes/no flag could enable for easy deployment of assigned superusers
ISADMIN, // A simple yes/no flag could enable for easy deployment of assigned admin
FACTION, // Faction to which user belongs
ISFACTION, // A simple yes/no flag could enable for easy deployment of assigned faction leaders
RANK, // Can store the attained rank in here, editable by faction leaders, in their user panel. May be good to allow for a few values, Rank as pirate and for last two factions
ezee wrote:REEDIT : Perhaps i'm wrong , but it seem to me that for your MMO project , we could use
the native http server of your server , instead of this set of .py files
lol - exactly what I was trying to do. If I could understand how it(vegaserver) talks to teh accountserver, I was hoping to make apache fulfill the same role... I'm currently shoeless as to how to feed it from forms. I was thinking once SQL, it'll talk to the database direct... Armed with .php complient user fabrication I could slide the test signup out of /test along with the other contents, and sat on the root of the served space it should function as per the SF page(I'll maybe even make teh effort to link it) aside from my modifications ofc. And should be a nice a pro-looking interface to present to the public (The abortion I made of the .py is embarressing, I'm sure I overwrote it with the original, too, clearly the wrong one. It's in too many parts! blah!)

Currently, in single player, ships take denotion: [Faction].{Squadron}.(squdNo) - as in Morrowind.mule.2 - indicating the second Ship, which is a mule in the Morrowind squadron... In the multiplayer, user should allow for rename they fightergroup - as long as unique - It currently spawns off(at least, on my end) as per single player.

Re: VegaStrike Online MMO Server

Posted: Tue Apr 22, 2014 2:14 pm
by ezee
Ok , i like your ideas .
I think you can start to make your web site , with a sql table for users .
We will then use this table with the accounterver .
( i am not very aware of sql tricks , but we can make pointers to other bases/tables if i remember well ) .
I'm sure that with a forum users login filled , the accountserver database will work .
If you want to play with files , that's ok , but a database would be better .
To crate new users with the file system :
SET create_user to True ! ( in settings.py )
mysql_dbconfig = {
'type': 'mysql',
'host': '127.0.0.1', #'mysql4-v.sourceforge.net'
'port': '3306',
'passwd': '',
'user': 'localhost',
'db': 'vegastrike',
'user_table': 'phpbb_users',--> phpbb_users is the name of the table you will create
'account_table': 'accounts',--> accounts is etc ... :wink:
'create_user':True,


Your idea of RPG in the forum/game is cool also .
I will try to make something with the hierarchy struct you just described .
Some php forums are designed with sort of ranks for users ( or it was in drupal ? ) ,
you could search for one that fit with your plan ?

Just a word with the php accountserver :
Python nor Php are multithread , but python can simulate threading , while i'm not
sure the account server uses that functionality .But for a MMO , i guess we should
prepare to have massive connections in http server .

The server uses a wait list for connections, so i guess it's enough for prevent bottleneck effects . ( when users are accepted , they leave the login loop and enter the game )

Edit : i finally understand that your idea is coupled with nido's market . :mrgreen:
I'm gonna test it so .
Okay , i got it ( http://forums.vega-strike.org/viewtopic ... 03#p134003 ), but i will have to make a visualstudio9 solution before start the test.

I was reading the doc , and found an other entry for our MMO database from that :
Further suggestions are giving the player the ability to own a base, in this case one may want to have the ability to control how and what is produced. If bases get the ability to send ships with cargo around, the player could also make use of this ability to get their own base supplied. This interface may also be useful for sending player fleets around regardless of owning a base. The principal implementation will be more restricted, but the suggestions mentioned above should be taken into account.
Yeah , i'm talking about the bases/stations .
As the number of bases/stations is fixed ( extensible , but like a database ) , i think we could create a table Bases , which could have fields like :
_ Sector // for location
_ System // for location
_ Owner // with AI as default ? (http://wardenscat.foxserver.be/nido/mar ... ernor.html)
_ A var from the market api ?
:wink:

Re: VegaStrike Online MMO Server

Posted: Wed Apr 23, 2014 2:57 am
by Eye~R
Yeah, a "bases" table would make sense...

I phear it'd be a little better:

_Sectoor // For location
_System // For location
_Owner // Faction that owns resource
_Manager // Player managing resource
_Governer // yes/no flag to apply "AI" governer
_ A var from the market api ?

The faction ownership could provide for sale of resources(?) and potentially provide for future hostile takeover...

_A ? I'm not intimately familiar with the "markets" thing towards the back end... Would ideally like Nido's input on this as that's his brainchild, but he's vanished. From what I'm to understand tho the code is functional with the largest "incorrect" piece being for testing purposes, anything manufactured requires two of whatever exists above it in the list of total trade cargo. Good for testing, but needs serious tweak for economy - and it needs thinking about really... like takes four tonnes of iron and one tonne of carbon to make 3.5tonnes of steel (the rest producing waste... would ideally require some algo on production simulating inefficencies, so of that 3.5tonne, an further "X"% is randomly destroyed for manf accidents, creating further waste - Would ideally also require to be chemically balanced... as in the amnts req'd in game matches or accurately imitates that of r/l) need to consider carfully the entire production chain(s) ... Various factions should also ideally be able to make use of various bonus, ie; in the Rlaan's writeup it mentions they natural skill with genetics, and medical manf for these factions should be easier than, say, confed isosteel.

A Serious upgrade this is, and done right can apply a layer of depth into VS that really could give it a blast from teh spice weasle. Another advantage of moving this towards DB-based is it also holds potential for distributing the server... as userbase expands the rendered universe will become more and more difficult for one machine, and it'd make sense to physically split the load of rendering the universe - all parts of the split pulling from the same data source will help keep the various sectors synced.

Re: VegaStrike Online MMO Server

Posted: Wed Apr 23, 2014 4:51 am
by ezee
Good ideas again .
Nido's come back is possible .
But his work is well organized , there is a useful doc online , and i started to play with
the code .

I even have some real ideas about how to implement it in vegastrike :
http://forums.vega-strike.org/viewtopic ... 29#p137129
as userbase expands the rendered universe will become more and more difficult for one machine, and it'd make sense to physically split the load of rendering the universe - all parts of the split pulling from the same data source will help keep the various sectors synced.
There is a class in the server code that is called " ZoneManager " .
I feel that the servers broadcast would use that to divide the virtual universe in zones.
Doc : http://spacetechs.free.fr/VEGASTRIKEDEV ... e_mgr.html

definition of a zone :
class ZoneInfo
45 {
46 friend class ZoneMgr;
47 ClientList zone_list;
48 int zone_clients;
49
50 int zonenum;
51 static unsigned short next_zonenum;
52 StarSystem *star_system;
53
54 ZoneInfo( StarSystem *parent )
55 {
56 this->zonenum = next_zonenum;
57 this->zone_clients = 0;
58 this->star_system = parent;
59 next_zonenum++;
60 }
cool no ?

The big deal is then here :
class ZoneMgr
76 {
77 public:
78 /* SnapshotSubCommand removes a double interpretation from
79 * CMD_POSUPDATE and replaces CMD_FULLUPDATE.
80 */
81 enum SnapshotSubCommand
82 {
83 End=0, //On client side (recv) : tells the buffer ends
84 PosUpdate=1, //On client side (send): containing a ship's
85 //data sent to server for position update
86 //On client side (recv) : receive minimal update
87 //data for a ship
88 FullUpdate =2, //On client side (recv) : receive full update
89 //info for a ship
90 DamageUpdate=8, //On client side (recv) : update changed damages.
91 SPECUpdate =16, //On client side (recv) : send SPEC mult and ramp.
92 };
93 enum AddClientId
94 {
95 //End=0, // Already defined... // Tells client that the buffer ends.
96 AddClient =1,
97 AddUnit =2,
98 AddNebula =3,
99 AddPlanet =4, //Not implented
100 AddAsteroid=5,
101 AddMissile =6
102 };
103
104 private:
105 //vector<StarSystem *> starsystems;
106 //List of clients in zones
107 //vector<ClientList*> zone_list;
108 //vector<int> zone_clients;
109 //List of units in zones (but not Clients)
110 //vector<list<Unit *> > zone_unitlist;
111 //vector<int> zone_units;
112
113 class Systems
114 {
115 SystemMap _map;
116
117 public:
118 std::string insert( std::string sysname, std::string systemxml );
119 std::string get( std::string sysname );
120 bool remove( std::string sysname );
121 };
122 Systems Systems;
123
124 public:
125 ZoneMap zones;
126
127 ZoneMgr();
128 //ZoneMgr( int nbzones);
129 //~ZoneMgr();
130 //Serial is the zone id
131 void addSystem( string &sysname, string &system );
132 string getSystem( string &name );
133 StarSystem * addZone( string starsys );
134 ZoneInfo * GetZoneInfo( int serial );
135
136 ClientList * GetZone( int serial );
137 //void addUnit( Unit * un, int zone);
138 //void removeUnit( Unit *un, int zone);
139 Unit * getUnit( ObjSerial unserial, unsigned short zone );
140
141 void getZoneBuffer( unsigned short zoneid, NetBuffer &netbuf );
142
143 StarSystem * addClient( ClientPtr clt, string starsys, unsigned short &num_zone );
144 void removeClient( ClientPtr clt );
145 void broadcast( ClientPtr clt, Packet *pckt, bool isTcp, unsigned short minVer = 0, unsigned short maxVer = 65535 );
146 void broadcast( int zone,
147 ObjSerial serial,
148 Packet *pckt,
149 bool isTcp,
150 unsigned short minVer = 0,
151 unsigned short maxVer = 65535 );
152 void broadcastNoSelf( int zone, ObjSerial serial, Packet *pckt, bool isTcp );
153 void broadcastSample( int zone, ObjSerial serial, Packet *pckt, float frequency );
154 void broadcastText( int zone, ObjSerial serial, Packet *pckt, float frequency );
155 void broadcastSnapshots( bool update_planets = false );
156 void addDamage( NetBuffer &netbuf, Unit *un );
157 bool addPosition( ClientPtr k, NetBuffer &netbuf, Unit *un, ClientState &un_cs );
158 void broadcastDamage();
159 double isVisible( Quaternion orient, QVector src_pos, QVector tar_pos );
160
161 void displayNPCs();
162 void displayStats();
163 int displayMemory();
164 };
165
166 #endif
My intuition say that each server could manage a zone , or more if the net traffic is low .
The more traffic , the less zones to manage by server ?

Re: VegaStrike Online MMO Server

Posted: Wed Apr 23, 2014 6:58 am
by Eye~R
Yeah @ "zone per server" When a single beast isn't enough, would ideally need one per sector, handling several systems - Ultimately, it's use will dictate what's required.

Re: VegaStrike Online MMO Server

Posted: Thu Apr 24, 2014 11:12 pm
by ezee
Ok , thank you for all this details .
Your ideas about the Market system are good also , don't hesitate to visit that thread
and share them :
http://forums.vega-strike.org/viewtopic ... 61#p137161

Back to the MMO server , i just tested again the python account server , and the client
fail to join the server because of the MD5 hash of the password .
If i edit the password manually , to change the hashed pass into a human-readable version
( that i will enter in the VS client login panel , that works .

I have then looked inside of the c++ code , and it seem to me that the conversion from
hash was not implemented . ( while that seem to work in the file version of the account server ) :

In accountsxml.h , look to the comparison/test :
int comparePass( char *str )
{
return passwd != string( str );
}
It's just a string comparison , so probably the actual problem is that the client compares
a hashed string of the password from the database with the password we enter .
I'm not 100% sure it is the case , but that could be an answer .

To be sure , i will try to output the "str" var , to see if it is hashed or not .
More to come .
:wink:

:idea: So i used the debugger to find where the error was launched , and it pointed :
in xml_support.h
double parse_float( const string &str )
{
double ret = 0.0f;
std::stringstream ss( str );
ss>>ret;
return ret;
}
The fact is that xml_support.h is one of the includes used by accountsxml.h ,
so there is effectively a problem in that region .
That sounds like if the client was not designed to use a database but a xml file ...

I will try to trace that .

reedit : I'm in the good direction .
What do you think there is as include file in the xml_support.h ?
Just what fails and need to be fixed :
#include "hashtable.h"
I have found there ( xml_support.h ) the code used to translate to String
( perhaps that generates the error ):

Code: Select all

inline std::string tostring5( unsigned short num )
{
    char tmp[256];
    sprintf( tmp, "%.5d", num );
    return std::string( tmp );
}
inline std::string tostring( int num )
{
    char tmp[256];
    sprintf( tmp, "%d", num );
    return std::string( tmp );
}
inline std::string tostring( unsigned int num )
{
    char tmp[256];
    sprintf( tmp, "%u", num );
    return std::string( tmp );
}
inline std::string tostring( long num )
{
    char tmp[256];
    sprintf( tmp, "%ld", num );
    return std::string( tmp );
}
inline std::string tostring( float num )
{
    char tmp[256];
    sprintf( tmp, "%g", num );
    return std::string( tmp );
}
inline std::string floattostringh( float f )
{
    char c[128];
    sprintf( c, "%2.2f", f );
    return std::string( c );
}
inline std::string VectorToString( const Vector &v )
{
    std::string ret( floattostringh( v.i ) );
    if (v.i != v.j || v.j != v.k)
        ret += std::string( "," )+floattostringh( v.j )+std::string( "," )+floattostringh( v.k );
    return ret;
}
One of these fonctions is probably bugged , at least under windows .

I go deeper in my inspection , and at the root of hashtable.h , there is
#include "gnuhash.h"
A lot of preprocessor defines here , and some seem to be inconsistent :
#ifndef _GNUHASH_H_
#define _GNUHASH_H_
#include "config.h"
//The following block is to only use tr1 from at least 4.3 since 4.2 apparently bugs out.
//Windows is untested at the moment.
#ifndef WIN32
#ifdef _WIN32
Whats the difference between the WIN32 and _WIN32 defines in c++
What is inconsistent is that two formats for windows are used , and so , one is ignored .
I will try to tweak that first .

So could you confirm that you can't login from the database without changing the password generated ? That will give me extra information to deal with ( to be sure that this is not a windows system failure only ) :?:

Re: VegaStrike Online MMO Server

Posted: Fri Apr 25, 2014 2:43 am
by ezee
:idea: About the idea of replace a python account server with a php accnt server :

I have found useful comments in the source code ( netserveraccnt.cpp line 32 ) :
void NetServer::checkAcctMsg( SocketSet &sets )
{
AddressIP ipadr;
ClientPtr clt;
unsigned char cmd = 0;
//Watch account server socket
//Get the number of active clients
...
...
//Here we get the latest client which asked for a login
//Since coms between game servers and account server are TCP
//the order of request/answers
//should be ok and we can use a "queue" for waiting clients
So yeah , the protocol to use is TCP .
More about TCP PHP SERVER : http://www.php.net/manual/en/sockets.examples.php

Things are getting mucho technical , but that's the way ... we must be sure of how
the coms between accntserver and server(s) is done .

If you look closer to the python side , you will find what is the httpserver :
class HTTPServer(SocketServer.TCPServer):

allow_reuse_address = 1 # Seems to make sense in testing environment

def server_bind(self):
"""Override server_bind to store the server name."""
SocketServer.TCPServer.server_bind(self)
host, port = self.socket.getsockname()[:2]
self.server_name = socket.getfqdn(host)
self.server_port = port
Look how it is used in httpserver.py :
def httpServer(port=8080, host=''):
print "Starting HTTP server on port %d..." % (port,)
server_address = (host, port)
httpd = HTTPServer(server_address, VSHTTPHandler)
httpd.serve_forever()
You remember my consideration for multi threading in python and php ?
Look :
def serve_forever(self, poll_interval=0.5):
"""Handle one request at a time until shutdown.

Polls for shutdown every poll_interval seconds. Ignores
self.timeout. If you need to do periodic tasks, do them in
another thread.
"""

self.__is_shut_down.clear()
try:
while not self.__shutdown_request:
# XXX: Consider using another file descriptor or
# connecting to the socket to wake this up instead of
# polling. Polling reduces our responsiveness to a
# shutdown request and wastes cpu at all other times.
r, w, e = _eintr_retry(select.select, [self], [], [],
poll_interval)
if self in r:
self._handle_request_noblock()
finally:
self.__shutdown_request = False
self.__is_shut_down.set()
The right sequence for running the server is ( at the end of httpserver.py) :
connect_db()
httpServer(port=settings.http_port)

This is how i would begin to do the php translation.
:wink:

Re: VegaStrike Online MMO Server

Posted: Fri Apr 25, 2014 7:55 am
by Eye~R
From what I can make out, It would appear users generated via the .py served signup form have the passwords entered into the DB MD5'd ... Login works from VS client with plaintext password...