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 
 
Clean solution for relocating NWN2 temp and log files
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Mon Nov 20, 2006 12:11    Post subject: Clean solution for relocating NWN2 temp and log files Reply with quote

It can be as simple as that:

Just create a batch (.cmd) file in your NWNX4 directory:

Code:
@ECHO OFF
SET TEMP=.
SET TMP=.
nwnx4_controller -interactive


And start it instead of the controller. The changed settings for TEMP and TMP are only valid during the command prompt session and won't affect the general computer or user settings.

As the result, NWN2 will create the 'CURRENTGAME', 'TEMP' and 'LOGS' directories in a folder 'NWN2' below your NWN2 installation path.

Example:
Code:
D:\Neverwinter Nights 2\NWN2\CURRENTCAMPAIGN
D:\Neverwinter Nights 2\NWN2\CURRENTCAMPAIGN.0
D:\Neverwinter Nights 2\NWN2\CURRENTGAME
D:\Neverwinter Nights 2\NWN2\CURRENTGAME.0
D:\Neverwinter Nights 2\NWN2\LOGS
D:\Neverwinter Nights 2\NWN2\LOGS.0
D:\Neverwinter Nights 2\NWN2\TEMP
D:\Neverwinter Nights 2\NWN2\TEMP.0
D:\Neverwinter Nights 2\NWN2\TEMPCLIENT


Edit: Of course it would be even nicer, if there was a "nwn2temp =" in the nwnx.ini, that if it exists and is set to a path would be applied as 'TEMP' and 'TMP' to the environment for starting nwn2server.exe. Razz
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Mon Nov 20, 2006 23:02    Post subject: Reply with quote

That would also solve the problem of running multiple instances under the same user. Since you will probably have multiple NWNX installations in this case, but only one NWN2 installation.

Good find!
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Tue Nov 21, 2006 0:14    Post subject: Re: Clean solution for relocating NWN2 temp and log files Reply with quote

Senalaya wrote:
Of course it would be even nicer, if there was a "nwn2temp =" in the nwnx.ini, that if it exists and is set to a path would be applied as 'TEMP' and 'TMP' to the environment for starting nwn2server.exe. Razz

Yes, and the same for the LOG path. "nwn2log ="

But lets step it up to the next level (do it early and it's painless)
Could each entry in the [Alias] group from NWN.INI (or is it NWNPLAYER.INI)
be re-assignable in NWNX4?
--This would allow for sharing common resources (eg ServerVault, Override) or splitting resources (eg LiveModule, TestModule)

Cheers
Gryphyn
Back to top
View user's profile Send private message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Tue Nov 21, 2006 11:41    Post subject: Reply with quote

@Gryphyn:
You can't set a seperate path for the logs, they are hardcoded to be at "%TEMP%\NWN2\LOGS(.n)".
As for the [Alias] group in the nwn.ini, why not just edit it there?

@Papillon:
The "." is relative to the NWN2 installation directory, not the NWNX one. So, if you want to have just one NWN2 installation and multiple NWNX instances, it should rather look like this:

Directories:
Code:
D:\Neverwinter Nights 2\
D:\Neverwinter Nights 2\nwnx4-1\
D:\Neverwinter Nights 2\nwnx4-2\


With the batch (.cmd) file in "nwnx4-1":
Code:
@ECHO OFF
SET TEMP=.\nwnx4-1
...

and in "nwnx4-2":
Code:
@ECHO OFF
SET TEMP=.\nwnx4-2
...


Resulting in the following directory structure:
Code:
D:\Neverwinter Nights 2\nwnx-1\NWN2\CURRENTCAMPAIGN
D:\Neverwinter Nights 2\nwnx-1\NWN2\CURRENTCAMPAIGN.0
D:\Neverwinter Nights 2\nwnx-1\NWN2\CURRENTGAME
D:\Neverwinter Nights 2\nwnx-1\NWN2\CURRENTGAME.0
D:\Neverwinter Nights 2\nwnx-1\NWN2\LOGS
D:\Neverwinter Nights 2\nwnx-1\NWN2\LOGS.0
D:\Neverwinter Nights 2\nwnx-1\NWN2\TEMP
D:\Neverwinter Nights 2\nwnx-1\NWN2\TEMP.0
D:\Neverwinter Nights 2\nwnx-1\NWN2\TEMPCLIENT

D:\Neverwinter Nights 2\nwnx-2\NWN2\CURRENTCAMPAIGN
D:\Neverwinter Nights 2\nwnx-2\NWN2\CURRENTCAMPAIGN.0
D:\Neverwinter Nights 2\nwnx-2\NWN2\CURRENTGAME
D:\Neverwinter Nights 2\nwnx-2\NWN2\CURRENTGAME.0
D:\Neverwinter Nights 2\nwnx-2\NWN2\LOGS
D:\Neverwinter Nights 2\nwnx-2\NWN2\LOGS.0
D:\Neverwinter Nights 2\nwnx-2\NWN2\TEMP
D:\Neverwinter Nights 2\nwnx-2\NWN2\TEMP.0
D:\Neverwinter Nights 2\nwnx-2\NWN2\TEMPCLIENT
Back to top
View user's profile Send private message
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Tue Nov 21, 2006 13:39    Post subject: Reply with quote

I am not getting any NWN2 Logs. Not sure what my problem is.
_________________
Jim (aka, Urlord)
Visit the Persistent World of Nymri
Back to top
View user's profile Send private message Send e-mail
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Tue Nov 21, 2006 14:40    Post subject: Reply with quote

Urlord wrote:
I am not getting any NWN2 Logs. Not sure what my problem is.


Per default, the logs are below the TEMP folder for your current user, which should be "C:\Documents and Settings\[your username]\Local Settings\temp\". There should be a folder "NWN2" with the substructure described above.
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Tue Nov 21, 2006 20:56    Post subject: Reply with quote

Hm - following the steps outlined here, (set TEMP, etc) I'm still getting the logs in the old temp directory. This makes me wonder if it's not using the current/owning process to locate that directory.
_________________
Khalidine, a NWN2 persistent world

Looking for volunteers.


Last edited by Grinning Fool on Wed Nov 22, 2006 7:17; edited 1 time in total
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Tue Nov 21, 2006 23:41    Post subject: Reply with quote

Senalaya wrote:
@Gryphyn:
You can't set a seperate path for the logs, they are hardcoded to be at "%TEMP%\NWN2\LOGS(.n)".
As for the [Alias] group in the nwn.ini, why not just edit it there?


Not true...

The [Alias] group in NWN.INI determine the locations of ALL game resources.
The two elements that are missing from the set are <ROOT> (or where NWN2 is installed) and <USER> (the MyDocuments location)

Each element in the [Alias] set, is a relative path to where the game resources are located. for example DATA=.\DATA means that you can find your DATA in the folder <ROOT>\DATA or <USER>\DATA

What the [Alias] group allows you to do is HARDCODE your path if you want to eg. DATA=c:\where\I\want\my\data. This then becomes the location where the game will look for its DATA.

What I am suggesting is that each instance of NWNX4 should have it's own set of these [Alias] parameters (even if most of them will always be the same) This way Server1 can put LOG files in a seperate folder to Server2 by having a different LOGS= entry. (by the way, LOGS=.\LOGS is the same as <ROOT>\LOGS not %TEMP%\NWN2)

Now on this point, I believe the original NWNX2 used this relative path as a base to locate it's logs. I'm not sure how NWNX4 does it (no source yet). But I am suggesting that a mechanism already exists for this functionality. It is just a matter of utilizing it.

--
aside

Only one copy of NWN.INI matters. I merged the <ROOT> & <USER> versions and now have a single file in my <USER> folder (I deleted the <ROOT> version). This actually solves some issues when you update your 'Options' screen. Having the two files confuses the game when saving the options, I was seeing options reset each time I start the game. This action solved that particular problem. (NWNPLAYER.INI got the same treatment)

--
further
Because this configuration data can be set exclusively in the <USER> context, one option that does open up (but is a admin nightmare) is that you could have different USERS each running a seperate NWNX4 server. Each USER would have their own <USER> folder, and thus their own configuration data. Neat, but as I said an admin nightmare. You NEED to be on top of database security, connection & transaction management.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Wed Nov 22, 2006 23:12    Post subject: Reply with quote

Are you suggesting that NWNX4 should modify the contents of the [Alias] section ?
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Wed Nov 22, 2006 23:45    Post subject: Reply with quote

Papillon wrote:
Are you suggesting that NWNX4 should modify the contents of the [Alias] section ?

No. I'm suggesting that it have it's own override (or mirror) for each of these elements. This would give the freedom that, if desired, NWNX4 could work off shared drives (even on a remote machine). Just opens up possibilities... (for a minimal initial effort) helpful in a Multi-mod/Multi-machine configuration.

Each NWN4 instance will have it's own copy. I'd imagine in most set-ups these would all be identical to the NWN.INI ones, however for the larger scale worlds being able to manage these, simply, would be a great asset.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Thu Nov 23, 2006 14:50    Post subject: Reply with quote

Gryphyn wrote:
No. I'm suggesting that it have it's own override (or mirror) for each of these elements.


I can not see the connection between NWNX and NWN in this case. If NWNX had a copy of those values, how would NWN be affected by them if it would not modify the contents of the [Alias] section ?

Am I missing something obvious here ?
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Thu Nov 23, 2006 23:41    Post subject: Reply with quote

Papillon wrote:
Gryphyn wrote:
No. I'm suggesting that it have it's own override (or mirror) for each of these elements.


I can not see the connection between NWNX and NWN in this case. If NWNX had a copy of those values, how would NWN be affected by them if it would not modify the contents of the [Alias] section ?

Am I missing something obvious here ?


That's the whole point. The game (or in this case 'server instance') will run using the supplied NWN.INI. But we are running the server instance within a shell (NWNXn). This provides a machanism where the resources on NWN2 and NWNX don't HAVE to be in the same location.

For example:
I'm running a PW and I want to use 2DA's for my own treasure tables.

NWN.INI
[Alias]
DATA=.\DATA

NWNX4.INI
[Alias]
DATA=\\MYHOST\NWNX4\DATA

What do I gain?

Well, for starters...when I upgrade my NWN2... I don't care if the games 2DA's have changed - they are kept seperately to my 2DA's. (especially now that 2DA's a rapped up in ZIP files)
And because NWN.INI points to the games resources I can ALSO access them.

I work in a team, another member is ready to DEMO an upgrade. I simply change my NWNX4.INI DATA=\\HOSTIP\NWNX4\DATA. Now my NWNX4 is using a remote machine, No HAK's, no copying files.

But the main reason (as what started this thread) is the LOGS location.
In particular when running several instances of NWNX4 - Which log belongs to which instance? LOGS=.\PW1\LOGS

My point of discussion is that this would be better handled in the NWNX4 host application, rather than in each plugin that would use it. You already deal with the .INI format, it should be easy enough to create two KeyValuePair lists. NWN2_AliasList, and one for NWNX4_AliasList. Easy access for any plugin development.

Scope-creep I know...

Cheers
Gryphyn
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Fri Nov 24, 2006 7:30    Post subject: Reply with quote

Unless I'm misunderstanding, the values under Alias in NWN.INI are not controlled or overrideable by anything in NWNX.INI, nor would it be [easily] possible to make it so.
_________________
Khalidine, a NWN2 persistent world

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



Joined: 20 Jan 2005
Posts: 431

PostPosted: Fri Nov 24, 2006 8:45    Post subject: Reply with quote

Grinning Fool wrote:
Unless I'm misunderstanding, the values under Alias in NWN.INI are not controlled or overrideable by anything in NWNX.INI, nor would it be [easily] possible to make it so.

No, the game continues to use NWN.INI (no change there)
However when you make a call from in-game (ie in a script) NWNX knows nothing of the game settings. If given this bit of intelligence opportunities are opened that don't currently exist...
A little like the LETO plugin knowing where the BIC files are...

Cheers
Gryphyn
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Nov 24, 2006 18:02    Post subject: Reply with quote

Ok, now I understand what you mean.

This is a functionality that would be perfect in a new plugin! It would have a simple ini file with those values, and just return them upon request.

It should be very easy to write something like this.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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