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 
 
instanced dungeons in NWN2

 
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
sunspot



Joined: 20 Feb 2007
Posts: 4

PostPosted: Tue Feb 20, 2007 15:30    Post subject: instanced dungeons in NWN2 Reply with quote

hey,

well I've been playing Dungeons & Dragons online trial the last few days and must say I do enjoy the system of instanced dungeons they use. So that got me thinking would I be able to emulate this in NWN2. It is most probably not possible due to NWN2's design but lets think out of the box here for a second. The thing I'm gonna lay out here might be very strainfull on the server and there are a lot of traps that could happen but bare with me here.

first think pattern
====================

NWN2 is built out of modules just like NWN1, each module is in principle a file that is sitting in a modules directory on the server. Now files can be copied, moved, deleted and even manipulated by the Operating System thats not new to anyone. So lets take a hypothetical situation sunspot and sunaria are playing on the server they recieve a quest and have to go in dungeon A. Meanwhile celludriel and amakir get the same quest. They both go to the dungeon and enter it, BUT instead of the normal procedure where an area transition takes place we gonna use a module transition. Each dungeon is his own module. On the SERVER side however a directory is made for instance /party/sunspotsunaria/ and a clean copy from /modvault/dungeonA.mod is copied to /party/sunspotsunaria and the module transition will transport sunspot and sunaria to that module. They finish the dungeon or fail it and the directory /party/sunspotsunaria gets deleted. Same thing occures in the meanwhile for celludriel and amakir.

second think pattern
====================

We use a database. Database have the ability to store blobs who are in general large binary datafields, big enough to even store movies ! All the dungeons are entered in that database in those blob fields. Now sunaria & sunspot enter a transition and the DBase shoots into action. It creates a table or a record lets not get to technical here and puts a copy of the blobfield from the dungeon in that place and loads it for sun and sunaria. When the dungeon is completed it deletes set record or table from the database.

So these are possible scenario's I can think of at this time. I however do not have enough knowledge on NWN2 scripting or it's abbilities to call outside operating system scripts. Nor do I have any experience in using a database with NWN. I however am interested to work together with someone who has the knowledge to get it done.

It's gonna be a lot of work tough so be dedicated to getting something done then

greets

sunspot
Back to top
View user's profile Send private message
sunspot



Joined: 20 Feb 2007
Posts: 4

PostPosted: Tue Feb 20, 2007 18:23    Post subject: Reply with quote

hey,

I thought about it some more and I think I've got a more plausible and possible sollution. After some more research I figured "hey, what nwn servers can only run one module". So scratch the idea of loading more modules in one server. So closest next option is multiple servers, but they can't ofcourse be static servers that would defeat the entire purpose. So dynamicly run servers who also shut down seems to be the answer. The downside is we'll have to use a database for this to work since NWNscript can't write to external files it seems.

So a possible scenario would be, and I'm just trying to design a protocol here, no idea it will work. We are on our 64 player server we call the main hub. Here we take on quests and enter dungeons. Party A goes into their giving quest dungeon and then a workaround process shoots into action.

First of all NWNscript can't start a server so we need a intermediate to do that for us. I'm most proficient in JAVA so I'm gonna take a JAVA example. Together with our main hub another program is running that will read from the database if it should startup a server or close a server. It's a small polling client to the DB. When party A clicked on enter dungeon a record was added in a DBase table called "serverstack" or whatever ... That record has some data in it like, time of entry, the module that has to load, it's status and very importantly what PORT to use to startup the server.

So the record is added and my java polling client , reads the record. It then triggers it startup server script that will startup a server on the same machine ofcourse BUT with the port indicated on the record. Then the script on the main hub transfers the party from the main hub with ActivePortal to the server just created. Party completes the dungeon and then the opposite will happen.

The exit script of the dungeon will put the status variable of the server record in the DB to 'please close this server'. The party gets send back to the main hub and the JAVA polling client reads "hey look I have to close a server" so it's script to close the server shoots into action and server is properly closed.

Thus we made an instance of a module sort a speak by using a new server instance. It will probably have 100 of other factors to consider to make a stable platform. Like serverMACHINE load, memory issues, what if players crash issues, and many other issues...

But a team of smart people might pull this off. Unfourtunatly the ActivePortal() of NWN2 is broken atm so the prototype should be build on NWN1.

So any feedback from people with knowledge about these things ?? I would appreciate it before I'm gonna dedicate precious time to it. Also are there people who actually want this ???

greets

sunspot
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Tue Feb 20, 2007 22:14    Post subject: Reply with quote

Do a little searching of the forums, virusman did a fair bit of work on this, iirc, with the ResMan plugin.
Funky
Back to top
View user's profile Send private message
sunspot



Joined: 20 Feb 2007
Posts: 4

PostPosted: Wed Feb 21, 2007 2:19    Post subject: Reply with quote

well I searched on instancing and dungeon instance and got so many posts I wouldn't know where to look first, can you give a little pointer ?
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Wed Feb 21, 2007 10:09    Post subject: Reply with quote

I experimented a bit with instancing on NWN1 Linux server in the past, but it's not finished and I'm not going to port it to NWN2.
I decided that instancing feature is not worth the work required to implement it.
Starting another server is possible, but it would consume too much resources (both RAM and CPU, especially on loading).
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
sunspot



Joined: 20 Feb 2007
Posts: 4

PostPosted: Wed Feb 21, 2007 13:16    Post subject: Reply with quote

hey virusman,

thnx for the response. Well maybe it's unfaisable but I still like to try just for the fun of it. Maybe in a year or two cpu's and mem are up to the task. It's gonna be hard for NWN2 though since that monster eats resources but who knows maybe I can get it to work on NWN1

However I'm going to need some more info on the NWNX engine and it's capabilities. The most important one how to shutdown a server. I know you can send an NWNscript command to let it restart but I don't want it to restart I want it to shut down completly. There is a way to do it in my java application by calling a kill process command , but I'm afraid that would generate memory leaks since it doesn't shut down the process properly it just kills it.

Another problem I have to tackle is the amount of players in the main hub module. Suppose the server is by some reason full 64/64 and 4 of those go on an instance , so they move to another server. Then their slots in the main hub have to be reserved. Cause what if others join when they are on adventure. If they complete it they can't get back in the main hub cause it is totally full.

I hope you can shed some light on these two issues

thnx in advance

sunspot
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Wed Feb 21, 2007 16:27    Post subject: Reply with quote

sunspot wrote:
However I'm going to need some more info on the NWNX engine and it's capabilities. The most important one how to shutdown a server. I know you can send an NWNscript command to let it restart but I don't want it to restart I want it to shut down completly. There is a way to do it in my java application by calling a kill process command , but I'm afraid that would generate memory leaks since it doesn't shut down the process properly it just kills it.
Use NWNX Reset Plugin.

sunspot wrote:
Another problem I have to tackle is the amount of players in the main hub module. Suppose the server is by some reason full 64/64 and 4 of those go on an instance , so they move to another server. Then their slots in the main hub have to be reserved. Cause what if others join when they are on adventure. If they complete it they can't get back in the main hub cause it is totally full.
A workaround is possible via hooking, as always. Smile Or you can raise the server limit and make a script to control amount of players online.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion All times are GMT + 2 Hours
Page 1 of 1

 
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