Implementation of mulitplayer aspects of Pioneer (a working example)
Posted: Fri Dec 28, 2012 8:33 pm
Some initial stuff i kept in mind as the basis of the example/attempt: The goal is to incorporate as many as possible multiplayer aspects in Pioneer game using the same application and keeping current Physics and functionality.The multiplayer aspects should not make the game deviate from the standalone execution either at all, or very slightly in order for the player to have (almost) the same gameplay experience.The multiplayer aspects would be implemented in non-default and in optional basis, letting the player choose, but the execution models will not mix, ie the multiplayer "save" cannot be used as a standalone "save" and vice versa (store/load functionality).The multiplayer aspects will be built around a Central database Server (PostgreSQL 9.2+), which will hold data and needed functionality.In order to test the example, you need (not all):1. to have access or install a PostgreSQL Database Server. The Server is open source, free and you can find install packages at this address: [url]http://www.enterprisedb.com/products-services-training/pgdownload#windows [/url] (download Installer Version 9.2.2).2. download scripts to make the necessary infrastructure from the address: [url]https://github.com/dkontominas/pioneer-db/tree/master/dbackup[/url] a.) Create the users ([url]https://github.com/dkontominas/pioneer-db/blob/master/dbackup/create_users.sql[/url] In PostgreSQL terms users are roles. You may need to manually add the role Dionisis as a member of the role player for the example only. Keep in mind that the idea is all the roles are members of the role player which actually has the right to call the necessary functionality - the other roles are used for authentication reasons only. The implemented functionality and infrastructure is under the user pioneerbase, who exposes it via store procedure (API) calls to user player, which incorporates all other roles as member acting as a placeholder for them and providing them by propagation the rights to call the API. b.) Create the tablespace ([url]https://github.com/dkontominas/pioneer-db/blob/master/dbackup/create_tablespace.sql[/url] In the tablespace creation, actually you define where the data files for the database will be placed (system path) and please modify the path as appropriate to your system. c.) Run the restore_psqldb.bat. This executable is a windows batch file and should be modified to correspond to the paths of the installation of the PostgreSQL database bin directory. It uses the pioneer-db.sql file as an input which includes all data and commands needed to setup the infrastructure. d.) The backupdb.bat is a windows batch file that should be modified to correspond to the paths of the installation of the database bin directory, to run correctly and actually backups your database in an .sql script for saving database purposes if you fell you need to.3. If you want to build the branch the address to download the source is: [url]https://github.com/dkontominas/pioneer/tree/pioneerbase.[/url] The branch is based on alpha 29 master sources (Pioneer executable shows alpha 30 when running). Also for this reason.. (4.)4. you need to download the libpqxx-4.0 C++ PostgreSQL database access framework. The sources reside in the address: [url]https://github.com/dkontominas/libpqxx-4.0.[/url] Amongst the directories, there exist a directory lib where you can find the compiled binaries for the WIN32 platform. So if you are WIN32 you don't need to make the binaries because they are already made (both static/dynamic + debug versions). If you are in other environment you need to build the corresponding binaries from the provided sources.5. The sources have been tested with Microsoft's Visual Studio 2010, in debug mode and the corresponding solution file is updated. I don't have any other environment to test the branch, so i can't speak of any adjustments on the build process needed on that.Also in pioneer-db repository there exists a directory docs, where you can find 2 documents. The big one is the manual of PostgreSQL and the small oneis a document for naming conventions that have been followed in the database development that has been done (well they come from Oracle PL/SQL, but theygently apply to PostgreSQL PLgSQL which is very similar language).As a general feeling the store/load process in the Database is a bit slower from the conventional file mechanism and that is also increased by the fact that the run/compilei did was under full debug. Possibly using release settings things would go much faster.Finally, you need in order the executable to run to copy in the Pioneer's executable directory some .DLLs that already exist in your PostgreSQL directories. Theseare the: SSLEAY32.dll, LIBEAY32.dll, LIBINTL.dll. In Unix/Mac they will probably have different extensions but the name possibly remains the same.Of course you need to place there also the libpqxxD.dll (for the debug version) and the libpq.dll which are the main access library for the Database.Best regards