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 Previous  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
Mycohl



Joined: 21 Oct 2006
Posts: 8

PostPosted: Mon Dec 28, 2009 21:33    Post subject: Reply with quote

virusman wrote:
Yes, you have to initialize GetLocalObject hook:
GetLocalObject(GetModule(), "NWNX!INIT");


I am doing this. This is what causes the lines:

* NWNX2 activated.
name='NWNX!INIT'
INIT(S): valid ret=0x082041ec

to show up in the log.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Mon Dec 28, 2009 21:52    Post subject: Reply with quote

You're initializing only the SetLocalString hook. You need both hooks in order for NWNX Areas to work properly.
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Mycohl



Joined: 21 Oct 2006
Posts: 8

PostPosted: Mon Dec 28, 2009 22:27    Post subject: Reply with quote

Crap. I am an idiot, and I apologize for wasting your time.

I didn't realize there was a separate call needed for this. Where can I find more information about what initialization needs to be done for the various plugins in the SVN? I don't want to waste everyone's time all over again when I start messing with another plugin, but the documentation doesn't seem to exist on the SVN (or else I am not seeing it).
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Tue Dec 29, 2009 21:28    Post subject: Reply with quote

Code:
disablenwnxinit=y     #Set to "y" to not enforce the NWNX!INIT requirement


Problem solved, surely?
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Sat Jan 16, 2010 19:33    Post subject: Reply with quote

NWNX Areas 0.3.0 (Linux)
http://nwn.virusman.ru/trac/nwnx2-linux/changeset/291/
http://data.virusman.ru/nwn/nwnx_areas-0.3.0-linux.rar
  • Fixed the crash that was happening when a player was trying to enter the new area after removing any other area
  • DMs now see the new area in Creator immediately
  • Added SetAreaName function

NWNX Areas is officially out of 'experimental' stage and can be considered stable.
_________________
In Soviet Russia, NWN plays you!


Last edited by virusman on Sat Jan 16, 2010 19:47; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sat Jan 16, 2010 19:38    Post subject: Cool Reply with quote

Any new goodies for windows?

Eg - has there been any success on windows systems of making the new areas display correctly?

Eg - players be in the game, at the same time as the area created, and not get nothing but black?


At the minute, im having to generate my areas on Mod Load, before players join.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Thu Jun 03, 2010 5:55    Post subject: Re: Cool Reply with quote

Baaleos wrote:
Any new goodies for windows?

Eg - has there been any success on windows systems of making the new areas display correctly?

Eg - players be in the game, at the same time as the area created, and not get nothing but black?

At the minute, im having to generate my areas on Mod Load, before players join.


Yes, actually it works quite nicely on windows Cool
I've copied the code for loading and adding the area to a players area list using the structs from nwnx_funcs for windows. And it works under certain conditions. Or rather it fails under a certain condition but I think that has to do with the resman plugin.

If Virusman has no objections I would like to attempt to make a full windows port of the linux version.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Fri Jun 04, 2010 5:02    Post subject: Reply with quote

Is DestroyArea supposed to delete all the objects in the area as well, or do I have to do that separately?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sat Jul 31, 2010 22:29    Post subject: Blackout Reply with quote

We have some problems with the windows version and I wanted to ask if they're the same in linux:

- Create a new area (an inside one, e.g.: City Interior)
- Go to the area
- Log out
- Log back in
-> The area is black!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sat Jul 31, 2010 22:57    Post subject: Note - Change of behavior Reply with quote

When I used the early release areas plugin when it was first released by virusmas, the behavior was different.

The area would appear black to everyone in the server, if they had logged in before the area was made.

The resolution at the time, or rather, work around, was to generate the areas at the begining, during onModload. This meant that when the players joined, they received the minimaps etc and area data via the internal nwn client enter function, and the areas continued to function correctly, even after log outs.


Since the new version which I have used from your own branch, the change in behavior is that because your version has a SendAreaToCreatures function, which the first one lacked on a windows version. The areas will display if we are logged in when they are made.
However, logging out, and then back in, it is like the area minimaps are lost during this log out and in attempt.


My own makeshift function to 'resend' minimaps to the player, does work in that it makes the area visible again, but because it is adding the minimap to the ExoArray for the creature again, its possibly gonna cause problems in the long run. (eg - the Creatures Area Count increases continuously).


This might sound stupid, but is there perhaps a function that needs to be called, to 'Save' the area data, once it has been added to the Creature?

Perhaps the Save function, if one exists, is called on the first initial login per client, and anything else gained by the client, is shrugged off between logins?
Back to top
View user's profile Send private message
axs



Joined: 11 Feb 2005
Posts: 76

PostPosted: Thu Aug 12, 2010 19:06    Post subject: Reply with quote

MaxRock, I didn't noticed such effect.

I've used nwnx_areas in conjunction with nwnx_resman for dynamicaly added areas by DMs but I have to stop becouse server crashes often.

Once sometime when player disconnects.
Code:
#0  0xb7de79f6 in memcpy () from /lib/libc.so.6
#1  0x0000014a in ?? ()
#2  0x080606e9 in CNWSPlayerTURD::CopyAutomapData(int, CExoArrayList<unsigned long> *, unsigned char **) ()
#3  0x0805434c in CNWSPlayer::DropTURD(void) ()
#4  0x080a4ead in CServerExoAppInternal::RemovePCFromWorld(CNWSPlayer *) ()
#5  0x080a24f4 in CServerExoAppInternal::PlayerListChange(unsigned long, int, int) ()
#6  0x082aa08c in CNetLayerInternal::DisconnectPlayer(unsigned long, unsigned long, int, int) ()
#7  0x082a71ea in CNetLayerInternal::NonWindowMessages(unsigned long, unsigned char *, unsigned long) ()
#8  0x082a0744 in CNetLayerInternal::ProcessReceivedFrames(int) ()
#9  0x080a04f4 in CServerExoAppInternal::MainLoop(void) ()
#10 0x0804bbe7 in main ()


And second sometime when player enters created area (I think it's related with minimap update):
Code:
#0  0x0806ef39 in CNWSMessage::WriteGameObjUpdate_PlayerUpdate(CNWSPlayer *, CNWSPlayerLastUpdateObject *, CLastUpdateObject *, unsigned short) ()
#1  0x0806d113 in CNWSMessage::WriteGameObjUpdate_MajorGUIPanels(CNWSPlayer *) ()
#2  0x0806ba41 in CNWSMessage::SendServerToPlayerGameObjUpdate(CNWSPlayer *, unsigned long) ()
#3  0x0808036e in CNWSMessage::SendServerToPlayerGameObjUpdate(CNWSPlayer *) ()
#4  0x080a4b87 in CServerExoAppInternal::UpdateClientGameObjectsForPlayer(CNWSPlayer *, int, unsigned long long) ()
#5  0x080b0275 in CServerExoAppInternal::UpdateClientGameObjects(int) ()
#6  0x080a053e in CServerExoAppInternal::MainLoop(void) ()
#7  0x0804bbe7 in main ()
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Fri Aug 13, 2010 11:39    Post subject: Reply with quote

axs wrote:
MaxRock, I didn't noticed such effect.

I've used nwnx_areas in conjunction with nwnx_resman for dynamicaly added areas by DMs but I have to stop becouse server crashes often.

Once sometime when player disconnects.
Code:
#0  0xb7de79f6 in memcpy () from /lib/libc.so.6
#1  0x0000014a in ?? ()
#2  0x080606e9 in CNWSPlayerTURD::CopyAutomapData(int, CExoArrayList<unsigned long> *, unsigned char **) ()
#3  0x0805434c in CNWSPlayer::DropTURD(void) ()
#4  0x080a4ead in CServerExoAppInternal::RemovePCFromWorld(CNWSPlayer *) ()
#5  0x080a24f4 in CServerExoAppInternal::PlayerListChange(unsigned long, int, int) ()
#6  0x082aa08c in CNetLayerInternal::DisconnectPlayer(unsigned long, unsigned long, int, int) ()
#7  0x082a71ea in CNetLayerInternal::NonWindowMessages(unsigned long, unsigned char *, unsigned long) ()
#8  0x082a0744 in CNetLayerInternal::ProcessReceivedFrames(int) ()
#9  0x080a04f4 in CServerExoAppInternal::MainLoop(void) ()
#10 0x0804bbe7 in main ()


And second sometime when player enters created area (I think it's related with minimap update):
Code:
#0  0x0806ef39 in CNWSMessage::WriteGameObjUpdate_PlayerUpdate(CNWSPlayer *, CNWSPlayerLastUpdateObject *, CLastUpdateObject *, unsigned short) ()
#1  0x0806d113 in CNWSMessage::WriteGameObjUpdate_MajorGUIPanels(CNWSPlayer *) ()
#2  0x0806ba41 in CNWSMessage::SendServerToPlayerGameObjUpdate(CNWSPlayer *, unsigned long) ()
#3  0x0808036e in CNWSMessage::SendServerToPlayerGameObjUpdate(CNWSPlayer *) ()
#4  0x080a4b87 in CServerExoAppInternal::UpdateClientGameObjectsForPlayer(CNWSPlayer *, int, unsigned long long) ()
#5  0x080b0275 in CServerExoAppInternal::UpdateClientGameObjects(int) ()
#6  0x080a053e in CServerExoAppInternal::MainLoop(void) ()
#7  0x0804bbe7 in main ()
Do you remove areas anywhere in your code?
The current area deletion code doesn't do proper minimap cleanup: it can result in blackout for players.
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
axs



Joined: 11 Feb 2005
Posts: 76

PostPosted: Wed Aug 18, 2010 0:45    Post subject: Reply with quote

virusman wrote:
Do you remove areas anywhere in your code?
The current area deletion code doesn't do proper minimap cleanup: it can result in blackout for players.
Yeah I know, so I've deleted area removal code, but didn't help.
Now when I reverted to old method - areas are added to module permanently (by Moneo/LETO) just before server starts, there is no such crashes.
So it's most likely related to area loading by nwnx_areas, I'm realy sad with this fact.
Back to top
View user's profile Send private message
Nabla



Joined: 19 Aug 2010
Posts: 4

PostPosted: Thu Aug 19, 2010 19:20    Post subject: Reply with quote

I have recently installed and tested this plugin. I like it a lot. And I have begining to look the source code for adapting the plugin to my need.
In this process, i have found the following bug in the destroy fonction.


  • When we delete a empty area (with no object in it) the server segfault.
    I think that the solution is to change in HookFunc.cpp the function NWNXDestroyArea by

    Code:

    if(CNWSArea__GetFirstObjectInArea(pArea, &nTmpObj)){
       do{
    CGameObject *pObject = (CGameObject *) CServerExoAppInternal__GetGameObject((void *)pServInternal, nTmpObj);
    ...
    }
       while(CNWSArea__GetNextObjectInArea(pArea, &nTmpObj));
       }


  • In the same function,
    Code:
    pDestructor(pObject, 3);

    Seem to only delete pObject, not the non pObject part of pCreature. This result in a memory leak.


Edit:

After a litle of work, it seem, that the while loop need to be modified in the following way:

Code:

   while(CNWSArea__GetFirstObjectInArea(pArea, &nTmpObj));

I think that it is because the destructor destroy the first object. And change the list of object.

I have changed the end of the function in adding the unload and desctructor function.

Like this the first test show that it work correctly.

The code used was:

Code:

void NWNXDestroyArea(void *pModule, dword nAreaID)
{
   if(!nAreaID || nAreaID == OBJECT_INVALID)
      return;
   if(!pServInternal)
      InitConstants();
   areas.Log(2, "Unregistering area %08lX\n", nAreaID);
   
   void *pArray = ((dword *)pModule+0x7);
   CExoArrayList__Remove(pArray, nAreaID);
   
   areas.Log(2, "Destroying objects on area %08lX\n", nAreaID);
   CNWSArea *pArea = (CNWSArea *) GetAreaByGameObjectID((void *)pServInternal, nAreaID);
if(pArea->NumPlayers > 0)
   {   cout<<"destroy aborted"<<endl;
      areas.Log(1, "NumPlayers > 0, aborting\n");
      return;
   }
   dword nTmpObj;
   if(CNWSArea__GetFirstObjectInArea(pArea, &nTmpObj)){
   do{   
      CGameObject *pObject = (CGameObject *) CServerExoAppInternal__GetGameObject((void *)pServInternal, nTmpObj);
   void (*pDestructor)(CGameObject *pthis, int flag) =
         (void (*)(CGameObject *pthis, int flag))(*(dword*)((dword*)(pObject->Methods)+0x2));
               areas.Log(2, "Destroying object %08lX\n", nTmpObj);
      pDestructor(pObject,3);   
      }
   while(CNWSArea__GetFirstObjectInArea(pArea, &nTmpObj));
   }
   areas.Log(0, "Destroying area %08lX\n", nAreaID);
   CNWSArea__UnloadArea(pArea);
   CNWSArea__Destructor(pArea);
   RemoveAreaForCreatures((CNWSModule *)pModule, nAreaID);
   UpdateAreasForDMs();
}
Back to top
View user's profile Send private message
axs



Joined: 11 Feb 2005
Posts: 76

PostPosted: Mon Oct 25, 2010 18:52    Post subject: Reply with quote

I'm wondering if only I have a problem.
Most likely minimap tiles data are not reallocated properly in some circumstances on large server, there is no way to crash server localy while testing, but when there is lot of players and action it's happen often.

It's related mostly to PlayerUpdateObject, DMs Un/Possession.

Code:
#0  0xb7d9b9f6 in memcpy () from /lib/libc.so.6
#1  0x0000019f in ?? ()
#2  0x080606e9 in CNWSPlayerTURD::CopyAutomapData(int, CExoArrayList<unsigned long> *, unsigned char **) ()
#3  0x0805434c in CNWSPlayer::DropTURD(void) ()
#4  0x080a4ead in CServerExoAppInternal::RemovePCFromWorld(CNWSPlayer *) ()
#5  0x080a24f4 in CServerExoAppInternal::PlayerListChange(unsigned long, int, int) ()
#6  0x082aa08c in CNetLayerInternal::DisconnectPlayer(unsigned long, unsigned long, int, int) ()


Code:
#0  0x0810e8d8 in CNWSCreature::UnpossessCreature(void) ()
#1  0x08113430 in CNWSCreature::UnpossessCreatureDM(void) ()
#2  0x08165fd0 in CNWSDungeonMaster::PossessCreature(unsigned long, unsigned char) ()
#3  0x08188762 in CNWSMessage::HandlePlayerToServerDungeonMasterMessage(CNWSPlayer *, unsigned char, int) ()
#4  0x08196905 in CNWSMessage::HandlePlayerToServerMessage(unsigned long, unsigned char *, unsigned long) ()
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 Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 5 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