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 
 
Itty Bitty Request - Player Perceptions?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Thu Jun 17, 2010 17:41    Post subject: Itty Bitty Request - Player Perceptions? Reply with quote

Is it at all possible, through nwnx, to control Player Perceptions?

Eg - Make one creature perceivable to one person, and not to another?

This is sorta already accomplishable via nwnscripting for creatures, but at the moment, it doesnt seem to be possible, without adding a Cutscene invisibility to the player to be invisible, but that would be a universal invisible to all players, while creatures may still see through it.

Players dont have a standard Perception script for other players I dont think. I think it might be client side handled, however that being said, the server must have some way of determining whether or not the client is meant to see this player etc.

eg
if player is invisible, and this client has not got true seeing, then we dont send them details about the player.

Some observations suggest this is how it works, sometimes, when I am playing with another player, and they go invisible, and I cannot see them, sometimes, they leave a ghost image in their location, while in reality, they have wandered away from that location ages ago. The Client shows the faded image, and doesnt update its location, because the server has refused to provide any more information for that player.


I know that visual effects are now able to be done via singular perception etc, One player can see it, and nothing else.

The thing I am trying to create is a sort of alternative plane of existance. Players on the same plane can see eachother, but those not on the plane, cannot see eachother.


Coding the nwnscript would be the easy part, but nwnx would be needed, if it were at all possible that is.

eg
int iPlane = GetLocalInt(oPC,"ON_PLANE");
if(iPlane == GetLocalInt(oPerceiv,"ON_PLANE"))
{
//These two can perceive eachother
}else
{
//These two cannot perceive eachother.
}


Events that this could go into would either be

1. Hooking onto the player perception event if one can be made accessible via nwnx. There must be a perception event hidden somewhere, because revealing of an invisible object etc is never really instant. Its like it waits for the next perceive event.

2. on the Player default script (heart-beat) - Loop though connected players, and determine if they are perceivable, and if so, apply the perceptual changes or not.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jun 18, 2010 3:09    Post subject: aPerceptionData Reply with quote

When looking in IDA, at some choice names n strings in nwnserver.exe

I see an array of char's called aPerceptionData, I was able to do a WinGraph on it, and saw it gets accessed by alot of subroutines.

Its possible that one of these subs handles perception data for players or creatures, or maybe they all do... I dunno...
Back to top
View user's profile Send private message
Skywing



Joined: 03 Jan 2008
Posts: 321

PostPosted: Fri Jun 18, 2010 3:45    Post subject: Reply with quote

You would need to hook the GameObjUpdate writing logic as this is where perception data is sent. I have this part of the protocol completely documented for NWN2, but not NWN1; however I would imagine that it will be quite similar.

In short: Possible, but you'll have to do a fair amount of work.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jun 18, 2010 5:11    Post subject: probably no hope Reply with quote

There is probably no hope of me managing to make it.

I know feck all about disassembling nwnserver,

I've been working in IDA For past 3 hours... its 4am here... Lol....
I tried,
Finding Perception related subroutines (and... yes found some... but Bioware has them tangled together so much that they look like a Giant Spaceship seen from 10 miles away..... and your still having to scroll accross the page to see the whole network of them)
well... gave up on perception stuff for a while,
tried finding subroutines that dealt with chat stuff - know its already been done, but I just wana practice.

Couldnt get that working.....
Then I tried possession of my familiar - didnt work

Then I did Summon Familiar... and I actually found a Subroutine that would be good for a hook, or event hook.

sub_4cc390 - Gets Fired when Summon Familiar is used.

I think I found this, by looking at the 'name' database, and found FamiliarName - then I looked for where it was used, and followed the function tree.

This function is not called by many, but does call many other functions (think I have that the right way round.....)
Not sure how the nwnx_events work/ed but if anyone wants to add summon familiar, this might help?
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Fri Jun 18, 2010 7:08    Post subject: Reply with quote

A couple of years ago I've made nwnx_visibility experimental plugin (Linux only, unreleased) that controls visibility of creatures to each other. Is it what you're trying to do?
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jun 18, 2010 12:25    Post subject: Reply with quote

If it allows one player to be set as invisible to one player but visible to others, then yes, that's that I'm after. Module I'm working on is vampire related, and will utilize vampire senses, and vampire powers. The ability to make a player invisible to a handful of players would be useful, while maintaining visibility to others.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 22, 2010 20:50    Post subject: CNWSCreature::RemoveFromVisibleList(uLong) Reply with quote

CNWSCreature::RemoveFromVisibleList(uLong)

Im not skilled, yet, at nwnx, but does anyone else think this function might be the right track or place to start for making a plugin which can control player perceptions?

Eg - Selective Invisibility.


We know the engine has the ability to make a player invisible to one person ,and not to another.

After all, if you are in the room with another player, that player is visible, but to anyone outside of the room, both of you are invisible. Obstruction prevents sight.

This function, I found, is in the flow graph for
DoPerceptionUpdateOnCreature function, and the RemoveFromVisibleList function, seems to come somewhere along the flow chart, after a
GetVisibleList call, and then after evaluating if it is true or false, then it removes from Visibility list.

Im guessing this particular call is doing this.

Get list of Visible Creatures.
Check if they are still visible
If yes - Continue
If no (false) - Remove from Visible List.

If hooking is possible on the perception event, then it might be possible to have the function call, request whether or not the creature is meant to be visible or not.

eg - Hook onto the function
when called, it runs a nss, which will capture the arguments of the function.
In this case, its a uLong, which 'might' be a creature id?
Who knows...
Then if our script determines the perceived creature is meant to be visible for the creature calling the perception event, it can return true or false in the script to nwnx.

SetLocalInt(oPerceiver,"NWNX!PERCEP!INVISIBLE",1)// Override default visibility - setting to 1 could tell nwnx to go along the path of 'false'
possibly SetLocalInt with a value of 0, might tell it to behave normally.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Tue Jun 22, 2010 23:06    Post subject: Reply with quote

CNWSMessage::TestObjectVisible(CNWSObject *, CNWSObject *)
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 22, 2010 23:09    Post subject: Saw that too Reply with quote

I saw that function too.
It was my next guess. Lol

I think your function calls mine, to test if it should be added to the visible list.

As for ways to accomplish a selective visibility system, do you think the approach described above is accurate?

eg
Hook the test visibility
query nwn nss file to find out if the target should be visible to the caller
nwnx receives the reply
nwnx will then change the result of TestVisibility to match whatever the nss tells it.

Alternativly, could hook the AddToVisible list funtion, and have it only process the creatures specifically allowed to be processed.

This way, it wont interfere with things that naturally are invisible.
Stealthed players etc
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Tue Jun 22, 2010 23:28    Post subject: Reply with quote

I think calling nwscript every time may be resource intensive. Instead, I'm going to create an array of structures.
Available fuctions:
OverrideVisibilitySettings(oObject, int) - set default setting for the object; always visible, always visible or check (nwn default)
SetVisible(...) - to set visibility per player/creature per object.
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 22, 2010 23:33    Post subject: Lol Reply with quote

Im bit 'hook crazy' at the minute.

I just successfully Hooked the Toggle Pause for windows32. (my first successful hooking - im more a c# developer - c++ is way over my head.)

Its an easy thing to hook, but dont think there was any public release of it on windows32.


Im just working on how to bypass hooked functions now. Already got nwn setup to send the BYPASS signal.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Fri Jun 25, 2010 0:35    Post subject: Reply with quote

http://nwn.virusman.ru/trac/nwnx2-linux/browser/trunk/plugins/visibility
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jun 25, 2010 0:48    Post subject: Cool Reply with quote

Im gonna have a look and see if I can incorporate this into a windows plugin.

I've not got a clue how to start a plugin from scratch yet, so im gonna try adding this to events.
Back to top
View user's profile Send private message
Wyldhunt



Joined: 06 Nov 2011
Posts: 1

PostPosted: Sun Nov 06, 2011 4:03    Post subject: Reply with quote

Sorry to bring up an old post, but I was curious if anyone ever made any progress on getting this to work in Windows?

This would be an amazing addition to NWNX...

I may have to brush up on my scripting skilz if no one ever did any work on this.

Btw, thanks for the helpful start Virusman.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Sun Nov 06, 2011 20:55    Post subject: Reply with quote

It's been ported to Windows as part of nwnx_funcs, as far as I know.
_________________
In Soviet Russia, NWN plays you!
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 -> Windows 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