logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Vaultster for NWNX4
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
Hialmar



Joined: 15 Jun 2005
Posts: 32

PostPosted: Sun Jun 08, 2008 16:26    Post subject: Vaultster for NWNX4 Reply with quote

Hello,

I'm currently porting Vaultster to NWNX4 for the ALFA PW project.

I'll also slightly modify it in order to allow the bic files to be backed up on a linux server (just in case a server isn't available and you want to play on another).

Here are the details about all that:

First a few words about vaultster as it worked with NWN1:

When a PC wants to portal, vaultster sends the bic file to the destination server using specific client and server (both are included in the NWNX2 plugin). When the bic file is completely on the distant computer the portalling starts.

Advantages:
- bic files are stored on the server computers (no more corruption due to network or caching problems) ;
- you don't need to mount a drive using netrive or webdrive ;
- the server doesn't need to wait for the content of the GSID folder to be downloaded (if it isn't cached) before it can present the character selection screen ;
- the server doesn't need to wait for the bic file to be downloaded each time a player connects.

Disadvantages:
- vaultster only works with NWNX2 and therefore only with NWN1 ;
- we have no central location where the bic files are stored ;
- when a server is down you can't easily log on another server ;
- when you do that, either you end up with an old version of your PC (if you went through that server) or with no PC at all (if you never went through it).

My solutions to those disadvantages:
1- I'll port vaultster to NWNX4 and therefore NWN2 ;
2- There will be a vaultster server running on a backup computer (I'll call it the backup vaultster server) ;
3- There will also be a vaultster client running on a backup computer (I'll call it the backup vaultster client) ;
4- Each time a PC is saved locally on the server, vaultster will try to upload the bic file to the vault computer using the local client and the backup vaultster server. If the upload fails it will retry in the background until it manages to upload it ;
5- When a server is down, the player will be able to connect to a web page, identify himself and request for his backed up bic file to be sent to another server. This will use the backup vaultster client (tied to some php code) and the vaultster server on the destination server.

What I have so far:

Normal vaultster transfer + the backing up on the backup computer (with a standalone backup vaultster server on linux).

I still need to fix a few little problems but it's functional.

The backup uses an AT for now (like vaultster standard operation).
I.e. you must click on an AT to backup your character.

I'll modify this to use the PC Tools "save character" button.

Now what I need to figure is how I can automatically backup files when a player logs out.
Anyone as an idea about that ?

I suppose it should go in the module "On Client Leave" event but I have never touched at that I think.

Here is the current script I use on the backup AT:
Code:

#include "vaultster_inc"

void main()
{
   // check if we are using an AT
    object oMyPC = GetClickingObject();
   // or if we are trying again to backup
   if(!GetIsPC(oMyPC)) oMyPC = OBJECT_SELF;
   if(!GetIsPC(oMyPC)) return;
   
   SendMessageToPC(oMyPC, "Vaultster Test.");
   
    //Your code goes here
    int status = PortalPC(oMyPC, "vault.alandfaraway.org");
   // returns: VAULTSTER_OK portal was successfully initiated
   //          VAULTSTER_FAILED internal failure
   //          VAULTSTER_SERVERBUSY too much players portalling already
   //          VAULTSTER_NOPLAYER object was no player
   
   if(status == VAULTSTER_FAILED) {
      SendMessageToPC(oMyPC, "Internal failure. Please contact the Infra Admin or the HDM.");
   } else if(status == VAULTSTER_SERVERBUSY) {
      SendMessageToPC(oMyPC, "Too many players are being backed up already, will try again in 30 seconds.");
      DelayCommand (30.0f, ExecuteScript("vaultster_backup_pc", oMyPC));
   } else if(status == VAULTSTER_NOPLAYER) {
      SendMessageToPC(oMyPC, "Object was not a player.");
   } else {
      SendMessageToPC(oMyPC, "Backup was successfully initiated.");
          DelayCommand (1.0f, ExecuteScript ("vaultster_backup_check_status", oMyPC));
   }
}


And the script which is called regularly to check backup completion:
Code:

#include "vaultster_inc"

void main ()
{
   object oPC = OBJECT_SELF;
   
   int status = PortalStatus(oPC);
   
   if (status == VAULTSTER_STATUS_OK)
      // file was transferred successfully, so now portal the player
      // ActivatePortal (oPC, "nwn.someserver.com", "", "", TRUE);
     SendMessageToPC (oPC, "Backup Complete.");
   else if (status == VAULTSTER_STATUS_BUSY) {
      // vaultster is still busy with the transmission
      SendMessageToPC (oPC, "Hold on..");
      DelayCommand (1.0f, ExecuteScript ("vaultster_backup_check_status", oPC));
   }
   else {
      // failure during transmission or not able to connect (see log file)
      SendMessageToPC(oPC, "Failed to backup the character file. Trying again in 30 seconds.");
      DelayCommand (30.0f, ExecuteScript("vaultster_backup_pc", oPC));
   }
}


If someone is interested to look at the code it is here:
http://torguet.net/Hialmar/
vaultster.rar: the plugin source for windows (you need the source of NWNX4 to compile it).
vaultster_linux.tgz: the standalone server source for linux.
vaultster_test.rar: a test mod.
xp_vaultster.ini: ini file for the plugin.
xp_vaultster.dll: the plugin for NWNX4.

Kudos go to Jeroen Broekhuizen (nwnx@jengine.nl) for NWN1's Vaultster.
_________________
Hialmar, A Land Far Away Infrastructure Administrator


Last edited by Hialmar on Wed Mar 11, 2009 22:36; edited 1 time in total
Back to top
View user's profile Send private message
Hialmar



Joined: 15 Jun 2005
Posts: 32

PostPosted: Sun Jun 08, 2008 16:45    Post subject: Reply with quote

Okay I checked the ACR (that's ALFA Core Rules) and it should be easy to do the following:
Code:

#include "vaultster_inc"

void main()
{
  object oMyPC = GetExitingObject();
   if(!GetIsPC(oMyPC)) return;
   
   SendMessageToPC(oMyPC, "Vaultster Test.");
   
    //Your code goes here
    int status = PortalPC(oMyPC, "vault.alandfaraway.org");
   // returns: VAULTSTER_OK portal was successfully initiated
   //          VAULTSTER_FAILED internal failure
   //          VAULTSTER_SERVERBUSY too much players portalling already
   //          VAULTSTER_NOPLAYER object was no player
   
   if(status == VAULTSTER_FAILED) {
      SendMessageToPC(oMyPC, "Internal failure. Please contact the Infra Admin or the HDM.");
   } else if(status == VAULTSTER_SERVERBUSY) {
      SendMessageToPC(oMyPC, "Too many players are being backed up already, will try again in 30 seconds.");
      DelayCommand (30.0f, ExecuteScript("vaultster_backup_pc", oMyPC));
   } else if(status == VAULTSTER_NOPLAYER) {
      SendMessageToPC(oMyPC, "Object was not a player.");
   } else {
      SendMessageToPC(oMyPC, "Backup was successfully initiated.");
      DelayCommand (1.0f, ExecuteScript ("vaultster_backup_check_status", oMyPC));
   }
}


However, all the delay commands won't work I'm afraid because oMyPC won't be around.
So maybe I should attach them to the module Confused
_________________
Hialmar, A Land Far Away Infrastructure Administrator
Back to top
View user's profile Send private message
Kieron



Joined: 10 Jun 2008
Posts: 1
Location: Castle Rock, CO

PostPosted: Tue Jun 10, 2008 22:46    Post subject: Reply with quote

This is a great system. We use it to this day in CoPaP.

I eagerly await this to be released.
_________________
Wardens of the Realm - NWN2
A Baldur's Gate FR World
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Hialmar



Joined: 15 Jun 2005
Posts: 32

PostPosted: Sat Jun 14, 2008 17:55    Post subject: Reply with quote

I have uploaded a first version of Vaultster for NWNX4 on Virusman's SVN:
http://nwn.virusman.ru/svn/nwnx4/trunk/

In it I have corrected the bug mentioned in the following thread:
http://www.nwnx.org/phpBB2/viewtopic.php?p=8335#8335
As well as switched to secure versions of the string manipulation functions (ie sprintf_s, strcpy_s...).

It works as for NWN2.

If you just want the dll without compiling it you will find it here:
http://torguet.net/Hialmar/Vaultster/
You need the dll, the ini file, the nss script that you should import in your module and then read the documentation to build your portalling functions.

Again thanks to Jeroen Broekhuizen for the original version of Vaultster.

Please post here or PM me if you find any bugs.

I'll post here once I have my automatic backup version in case someone is interested.
_________________
Hialmar, A Land Far Away Infrastructure Administrator


Last edited by Hialmar on Wed Mar 11, 2009 22:35; edited 1 time in total
Back to top
View user's profile Send private message
Skywing



Joined: 03 Jan 2008
Posts: 321

PostPosted: Sat Jun 14, 2008 18:14    Post subject: Reply with quote

Have you successfully gotten server transfer portals working on NWN2 then? Rumor has been that such doesn't operate properly. Have been attempting to get some actual information on what the deal is there, but so far haven't really had a whole lot of luck getting any hard information on what does and doesn't work.
Back to top
View user's profile Send private message
Hialmar



Joined: 15 Jun 2005
Posts: 32

PostPosted: Sat Jun 14, 2008 21:40    Post subject: Reply with quote

I didn't try those so far.

Basically when the character clicks on the portal, the bic file is transfered with vaultster and then the player has to logout and login on the destination server.

I'll try them asap and tell you if they work.
_________________
Hialmar, A Land Far Away Infrastructure Administrator
Back to top
View user's profile Send private message
Skywing



Joined: 03 Jan 2008
Posts: 321

PostPosted: Tue Jul 15, 2008 16:49    Post subject: Reply with quote

Any further information on the current status of portal transitions and the clientside UI to make them work?
Back to top
View user's profile Send private message
Asmodae



Joined: 07 Jan 2005
Posts: 55

PostPosted: Tue Aug 05, 2008 19:17    Post subject: Reply with quote

I'm curious too, this function is going to be even more necessary as NWN2 PW's grow beyond the bounds a single server can reasonably deal with.

- Asmodae
_________________
Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Hialmar



Joined: 15 Jun 2005
Posts: 32

PostPosted: Wed Aug 06, 2008 15:51    Post subject: Reply with quote

I haven't managed to find the time to test this yet.

I hope I'll do it soon.

I first need to finish a few specific features needed for ALFA and then we'll test with 2 beta servers.
I'll post here when this is done.
_________________
Hialmar, A Land Far Away Infrastructure Administrator
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Sat Oct 18, 2008 0:24    Post subject: Reply with quote

Testing I've done has shown that portals aren't working - the game just 'hangs' for the player. I have not had time lately to dig into it and find out how badly/where it's broken.
_________________
Khalidine, a NWN2 persistent world

Looking for volunteers.
Back to top
View user's profile Send private message
AcadiusLost



Joined: 15 Dec 2007
Posts: 26
Location: Charlottesville, VA

PostPosted: Tue Dec 30, 2008 22:40    Post subject: Reply with quote

No new progress on this, but I'll be looking into testing with it since we've got a second server nearing Live now. An updated link for the code is here:

http://www.alandfaraway.org/zicada/Vaultster/

The prior link was broken by our website rebuild.
_________________
Technical Administrator
A Land Far Away, a Persistent World Project
Back to top
View user's profile Send private message Visit poster's website
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Wed Dec 31, 2008 19:20    Post subject: Reply with quote

By the way, I recommend merging in the changes between revisions 22 and 23 of the Win32 NWNX2 repository. After I made those modifications, it became significantly more reliable for CoPaP (better at finding bics and handling errors reported by the receiving side). It's also easier to use, as it adds the capability to run Vaultster on configurable ports (in case you need multiple vaults on the same machine, or multiple vaults behind the same router). I see you've made some changes too; I'll backport those at some point.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
AcadiusLost



Joined: 15 Dec 2007
Posts: 26
Location: Charlottesville, VA

PostPosted: Fri Jan 02, 2009 18:57    Post subject: Reply with quote

If there are any volunteers to merge more recent code in, it would be much appreciated. In trying to test this the other day, I kept coming up with that 140001 error in initializing the plugin, and no combination of file updates from microsoft (visual runtime libraries, etc) seemed to resolve the issue.

I don't have the tools to recompile it myself at the moment, but it'd be very useful if someone else could take a few minutes to try turning out a new .dll that we can put into testing.

The LETO functionality merge we'd planned on isn't really necessary, and not worth holding up getting a working vaultster plugin for.

Any volunteers out there?
_________________
Technical Administrator
A Land Far Away, a Persistent World Project
Back to top
View user's profile Send private message Visit poster's website
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Fri Mar 06, 2009 21:30    Post subject: Reply with quote

I'm not sure if the news has found it's way here yet - 1.23 patch will also bring with it working server-to-server portals.
_________________
Khalidine, a NWN2 persistent world

Looking for volunteers.
Back to top
View user's profile Send private message
Hialmar



Joined: 15 Jun 2005
Posts: 32

PostPosted: Tue Mar 10, 2009 23:08    Post subject: Reply with quote

I'm resuming working on this.

However, I don't have my Linux code on my home PC and Acadius's link doesn't seem to work.

I should have the last version of the code on my office computer.

I'll definitely merge the changes from revs 22 to 23. Thanks for this info Zebransky.
I'll keep you all posted.

Edit:
Everything is now here:
http://torguet.net/Hialmar/Vaultster/
_________________
Hialmar, A Land Far Away Infrastructure Administrator
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Development All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group