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 
 
NWNX Areas
Goto page 1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development
View previous topic :: View next topic  
Author Message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Wed Nov 12, 2008 15:24    Post subject: NWNX Areas Reply with quote

I've uploaded NWNX Areas to the repository today.
NWNX Areas is a plugin for area instancing in NWN. Currently it only can create (duplicate) an area from ResRef (it may be possible to load external area files with ResMan plugin).

Precompiled:
http://data.virusman.ru/nwn/experimental/nwnx_areas-0.2.4-linux-exp.rar (Linux)
http://data.virusman.ru/nwn/experimental/nwnx_areas-0.2.2-win32-exp.rar (Windows, unstable)

Sources:
http://nwn.virusman.ru/trac/nwnx2-linux/browser/trunk/plugins/areas
http://nwn.virusman.ru/svn/nwnx2-linux/trunk/plugins/areas


Last edited by virusman on Sat Jan 16, 2010 14:02; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Wed Nov 12, 2008 23:33    Post subject: Reply with quote

Windows version is now available.
DestroyArea has been added in 0.2.2
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Thu Nov 13, 2008 7:49    Post subject: Reply with quote

Real area instancing? Amazing! I'll have to check this out.
Back to top
View user's profile Send private message
metamud



Joined: 30 Sep 2008
Posts: 16

PostPosted: Thu Nov 13, 2008 20:11    Post subject: Re: Experimental plugins Reply with quote

virusman wrote:
I've uploaded NWNX Areas to the repository today.
NWNX Areas is a plugin for area instancing in NWN.


*bows in awe*

*straightens back*

virusman: I salute you.

Thanks!
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Sat Nov 15, 2008 2:46    Post subject: Reply with quote

Just tossing this out there:

OS: Windows Vista 32bit

Instancing works great up to a certain point. I was on as a DM and created 2-3 areas. I relogged so they would show in the chooser. I then created another instance and jumped to one of the areas I created before the relog.

At that point I received this error:

The instruction at 0x00442ab4 referenced memory at 0x88000000. The memory could not be read.

It might be a Vista problem but I sure hope not. This plug in is amazing!
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Sat Nov 15, 2008 2:57    Post subject: Reply with quote

I just tested it on my server that uses windows XP and it works fine, so my only guess is that Vista isn't compatible. It works great so I'll deal with it. Smile

Thanks again
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Nov 24, 2008 22:22    Post subject: Reply with quote

Hi, I tried windows version and there is what I found out:

First at all, it works. But object returned by LoadArea function is OBJECT_INVALID. I workarounded it by GetObjectByTag, first object returned was the newest one. But then when I entered to area, I saw nothing, screen was black even after relog.

I played with it a while and I found out that if PC was in game when area was copied, than he will see black screen. If he log after area is copied, then its fine.

Specifics:
Win XP Professional, SP2
copied area was done in Castle Interior 2 tileset.
Almost all other win plugins.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Tue Nov 25, 2008 18:15    Post subject: Reply with quote

I'm getting the same results as ShaDoOoW with pretty much the same setup.

It seems that the new area doesn't get lit. You can move around in the area and the arches near the walls even obscure your character

edit:
Interesting enough it works fine with the Microset tileset

edit2:
It seems as long as the area is Terrain Type: Exterior it works
Back to top
View user's profile Send private message Send e-mail MSN Messenger
SartriX



Joined: 13 Jul 2008
Posts: 16

PostPosted: Fri Nov 28, 2008 11:43    Post subject: Reply with quote

Can't get it running on linux.

The pre-compiled version moans about some linked versions (the pre-compiles always do, nothing new really), so as usual I just compile:

When I try to compile originally (SVN rev 196), my gcc complains about CNWSArea__Destructor having an optional parameter.
Code:
HookFunc.cpp:42: error: default arguments are only permitted for function parameters
HookFunc.cpp: In function 'void NWNXDestroyArea(void*, dword)':
HookFunc.cpp:84: error: too few arguments to function


I tried changing it to a full parameter, as well as tried removing it (adjusting the calls to it as well) to make it compile, but then the OnCreate fails once it loads. So apparently gcc doesn't like the optional parameter, yet the hooks can't find it with the mandatory or ommitted paramater alternatives.


[edit]
On further experimentation, it seems rev 194, which doesn't even include any of the DestroyArea code, generates the same OnCreate failure. So that means it's not failing to load on the changed optional parameter, but even fails to load on the CreateArea hooks.

Specifics:
Linux version 2.6.25-gentoo-r7
gcc version 4.1.2
glibc 2.6.1
Back to top
View user's profile Send private message
metamud



Joined: 30 Sep 2008
Posts: 16

PostPosted: Tue Dec 02, 2008 21:24    Post subject: Reply with quote

I made a few minor adjustments to get the code to work on my Ubuntu Hardy 8.04.1 server. I got the same warning SartriX has about declaring the default value of a parameter in the prototype of the function.

Apparently gcc only likes default parameter values in the actual function implementation, not in the prototype.
For the record:
Code:
nwn@mail:~$ g++ --version
g++ (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)


The best solution I could come up with was to migrate the "=3" in the prototype declaration to a ", 3" where the actual function call is made. Please have copious fits of laughter at my expense if this is silly Smile

Also, some include directives in "NWNXAreas.h" were slightly skewed (compared to the other plugins), and I got matching compilation warnings/errors until I fixed this header file.

Below, inline, the relevant output of 'svn diff' against r195.

Code:
Index: plugins/areas/NWNXAreas.h
===================================================================
--- plugins/areas/NWNXAreas.h   (revision 195)
+++ plugins/areas/NWNXAreas.h   (working copy)
@@ -20,8 +20,8 @@
 #ifndef _NWNX_AREAS_H_
 #define _NWNX_AREAS_H_

-#include "../NWNXBase.h"
-#include "../gline.h"
+#include "NWNXBase.h"
+#include "gline.h"
 #include "HookFunc.h"

 class CNWNXAreas : public CNWNXBase
Index: plugins/areas/HookFunc.cpp
===================================================================
--- plugins/areas/HookFunc.cpp  (revision 195)
+++ plugins/areas/HookFunc.cpp  (working copy)
@@ -39,7 +39,7 @@
 void (*CNWSArea__LoadArea)(void *pArea, int flag);
 void (*CExoArrayList__Add)(void *pArray, dword nObjID);
 void (*CExoArrayList__Remove)(void *pArray, dword nObjID);
-void (*CNWSArea__Destructor)(void *pArea, int flag = 3);
+void (*CNWSArea__Destructor)(void *pArea, int flag);
 void *(*GetAreaByGameObjectID)(void *pServerExoAppInternal, dword nObjID);


@@ -81,7 +81,7 @@
        CExoArrayList__Remove(pArray, nAreaID);
        areas.Log(0, "Destroying area %08lX\n", nAreaID);
        void *pArea = GetAreaByGameObjectID((void *)pServInternal, nAreaID);
-       CNWSArea__Destructor(pArea);
+       CNWSArea__Destructor(pArea, 3);
 }

 int HookFunctions()


After these modifications, the plugin compiles and runs just fine. I do get an illegal object from the LoadArea() function though, in the sense that I cannot use the result to destroy the freshly cloned area. I'm still chewing on that one. But the area *is* cloned and *is* available in the DM's chooser list.

Thanks && Keep up the great work!!!
Back to top
View user's profile Send private message
SartriX



Joined: 13 Jul 2008
Posts: 16

PostPosted: Wed Dec 03, 2008 2:03    Post subject: Reply with quote

Hmmn. Those exact same changes are the changes I made innitially, but for me the result was that it still refused to run. When starting NWN, I'ld get the aforementioned 'OnCreate() failed' error from the plugin itself.

I finally found what caused the OnCreate() error as well: There seems to be a conflict with the events plugin, which causes it to fail. Since: without nwnx_events it works fine, with events I get the OnCreate() failure.

[edit]
After some debugging, it seems that the line
Code:
dword org_SaveChar = asmhelp.FindFunctionBySignature("55 89 E5 57 56 53 81 EC B8 00 00 00 FF 75 08 C7 85 74");
returns 0 when the nwnx_events plugin is loaded. Not weird, since the exact line is used in nwnx_events to hook on the Save Char event. Question is obviously: Why's the areas plugin trying to hook to the save char signature? Don't have enough knowledge of the internals to assign proper values to pScriptThis and pServThis myself to replace the references to org_SaveChar.
Back to top
View user's profile Send private message
SartriX



Joined: 13 Jul 2008
Posts: 16

PostPosted: Wed Dec 03, 2008 3:03    Post subject: Reply with quote

Righties, since the HookInfo returned seemingly fine values on the 6 functions it actually did use, I tried to base the pServThis and pScriptThis on the dword from the CNWSArea constructor. Works fine till as area is created and (after relog) shows up in the list. But jumping to the new area makes the server segfault.

This be my new hook, but I'm admittingly just a blind monkey trying to grope some invisible banana right now. Hope it's atleast of any help of those who know the details better.
Code:
int HookFunctions()
{
        *(dword*)&CNWSArea__CNWSArea = 0x080CBD30;
        *(dword*)&CNWSArea__LoadArea = 0x080CDFDC;
        *(dword*)&CExoArrayList__Add = 0x0805EEE0;
        *(dword*)&CNWSArea__Destructor = 0x080CC244;
        *(dword*)&GetAreaByGameObjectID = 0x080B0484;
        *(dword*)&CExoArrayList__Remove = 0x0805EE88;

        dword org = *(dword*)&CNWSArea__CNWSArea;
        if (org)
        {
                pServThis = *(dword*)(org + 0x3C);
                pScriptThis = pServThis - 8;
        }

        PrintHookInfo(*(dword*)CNWSArea__CNWSArea, "CNWSArea.new");
        PrintHookInfo(*(dword*)CNWSArea__LoadArea, "CNWSArea.load");
        PrintHookInfo(*(dword*)CExoArrayList__Add, "Array.add");
        PrintHookInfo(*(dword*)CNWSArea__Destructor, "CNWSArea.destruct");
        PrintHookInfo(*(dword*)GetAreaByGameObjectID, "GetAreaByID");
        PrintHookInfo(*(dword*)CExoArrayList__Remove, "Array.remove");

        return (org && pServThis && pScriptThis);
}
Back to top
View user's profile Send private message
metamud



Joined: 30 Sep 2008
Posts: 16

PostPosted: Wed Dec 03, 2008 20:17    Post subject: Reply with quote

For the record, I am not (yet) using the events plugin. This may account for my successful attempts at running the areas plugin vs. SartriX' problems.
Back to top
View user's profile Send private message
addicted2rpg



Joined: 01 Aug 2008
Posts: 106

PostPosted: Tue Dec 09, 2008 1:52    Post subject: Reply with quote

This is really impressive. I have been mulling over how I would do something like this lately, only to find out it has already been done!

Great job virusman!!!
Back to top
View user's profile Send private message
metamud



Joined: 30 Sep 2008
Posts: 16

PostPosted: Mon Dec 15, 2008 23:35    Post subject: Reply with quote

It's been a while SartriX .. did you manage to get your issues ironed out?

Any other development / experimenting still being carried out? Any help needed testing stuff (on a Linux platform)?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development All times are GMT + 2 Hours
Goto page 1, 2, 3, 4, 5, 6, 7  Next
Page 1 of 7

 
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