HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: manipulate data for a offline player  (Read 3855 times)

ExileThomas

  • General Accounts
  • *
  • Posts: 23
    • View Profile
manipulate data for a offline player
« on: Sep 18, 14, 02:34:46 PM »

hey guys

just wandering if anyone knows a way I could access and manipulate a field for an offline player.

The system is for sending items etc. from player to player and the system i currently have works when both players are online, however i need to expand this so an online player can send something to another player whether they are online or not.

i have tried accessing the players character node and therefore their data within it but when the player is not online this node is un-accessible to my knowledge. i have exhausted my knowledge and various forums and posts to try and find a way to either access this node or another way to manipulate the data but have had no success as of yet.

Any help would be greatly appreciated and i hope i explained this well enough for someone to try and help.
Thanks
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: manipulate data for a offline player
« Reply #1 on: Sep 18, 14, 05:39:50 PM »

I forget the details offhand, but there is a way you can load the root node for a character that is not currently loaded, which is something to look into.

Otherwise, I suppose an approach would be to manage a persistent node (probably in a system area) which is hard associated to the area root node.  That ensures that that node is loaded when ever that area is running, and having that area always up will ensure the node is always available.  That node could act as a set of automated mailboxes for characters that hold things for them when offline and delivers them when the character logs back on.

Maybe there is a better way, I don't know.  Just spit-balling here.
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: manipulate data for a offline player
« Reply #2 on: Sep 18, 14, 06:20:01 PM »

This might be what you are looking for:
 http://hewiki.heroengine.com/wiki/Node_Delivery_Service
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: manipulate data for a offline player
« Reply #3 on: Sep 18, 14, 08:05:15 PM »

Ha.  There you go.  Didn't know about that system.
Logged

ExileThomas

  • General Accounts
  • *
  • Posts: 23
    • View Profile
Re: manipulate data for a offline player
« Reply #4 on: Sep 19, 14, 09:00:56 AM »

hey

thanks for the responses and help

with what you were saying with the loading root nodes is this the sorta thing that you were describing http://hewiki.heroengine.com/wiki/Arbitrary_Root_Node ? think doing it this way would be the best way if it does what i think it is designed to do.

i had a look at the mail system and may be able to use this as a back up if this arbitrary root node thing does not work but will have to read up a lot more on it and how to fully implement it as i was unable to find an example of it to use as a reference point.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: manipulate data for a offline player
« Reply #5 on: Sep 19, 14, 09:19:56 AM »

Close.  The character is a built-in root node, whereas Arbitrary Root Nodes refer specifically to ones that would be created by us.  That process of loading ARN's might also be correct for the character node, however to be certain you may want to trace through the clean engine code that loads a character when a player logs in to see how that is done, in case there is anything else involved.

That being said, I am wondering what would happen if you have a character node loaded for this purpose and then at the same time the player who owns it tries to log in with that character.  That might cause some sort of conflict.
« Last Edit: Sep 19, 14, 09:22:33 AM by ScottZarnke »
Logged

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile
Re: manipulate data for a offline player
« Reply #6 on: Sep 19, 14, 10:55:17 AM »

I think that the Node Delivery Service is the way to go. It isn't that hard to wrap your brain around, just think of it as a mail service. You send mail(node) to a character with SendMail, and  the character picks it up with GetMail. You can send whenever you want and character can pick it up whenever he wants. In your case i guess it would be when he logs on (perhaps you can place GetMail here ---> HE_CSSSendCharacterToLastArea)

But, if you want the other way (which i think is not the right way, as Scott already mentioned, it can cause conflicts), there are some external functions that could be worth looking into (i haven't used them myself, and i have no idea if they can help you in your scenario):

  QueryRootNodeAccounts
  QueryRootNodeCharacters

  QueryArbitraryRootNodes
  QueryRootNodes
  QueryRootNodeAreas
  ...


and i guess you would have to know how to manipulate root nodes (http://hewiki.heroengine.com/wiki/Arbitrary_Root_Node)

« Last Edit: Sep 19, 14, 11:00:19 AM by AWW_boss »
Logged

JoshHalls

  • Founding Professional
  • *****
  • Posts: 335
    • View Profile
    • The Repopulation
Re: manipulate data for a offline player
« Reply #7 on: Sep 19, 14, 07:01:42 PM »

Maybe HE dev can speak up on this, but I imagine this routine is preferred if you are going to do an offline lookup.

LookupCharacterByName

Both loading and doing a name lookup will result in a DB hit, but loading it I imagine is going to be a much larger hit where I imagine that will be a indexed search, which should be quick. If there name is valid then find a place to store whatever you are trying to send until the player is online. The object can be stored using the node delivery service as mentioned or could be stored marshaled and then unmarsheled once the player is online. Just would send a check to the storage location to ping anything is waiting and then send it to the player when they hop online.

You could also load the character up after the character is found using that routine, but is going to force a full load, a write, and then a dump of the character and if you send a bunch of items 1 by 1 going to result in that happening each time.
Logged

ExileThomas

  • General Accounts
  • *
  • Posts: 23
    • View Profile
Re: manipulate data for a offline player
« Reply #8 on: Sep 19, 14, 07:08:30 PM »

ok im using the send and get mail system and about 90% of the way there i think but i have fallen at the last hurdle so to say.

from the sending player i have created a persisted node that has various fields within it and assigened information to these fields and then used sentmail to send it to the player :
external function SendMail(destinationNode as ID, package as NodeRef, package_title as String ) as Boolean
destinationnode = the players account
package = the presisted node with the information
package_title = the title of the message (just in this case its test)

then using CheckMail(mailboxNode as NodeRef) as List of Class MailInfo on the receiving player i can see that they have a new mail. so looping through the list that this creates i'm using getMail and this is where im getting lost on how to withdraw the node out and then get the information sent over it back out on the receiving players side.

external function GetMail(mailboxNode as NodeRef, attachNode as NodeRef, mailNode as ID)
mailboxnode = the players account
attachnode = where im unsure what this is wanting as everything i tried does not seam to be correct
mailnode = the mail node being referenced within the loop from checkmail

sorry to keep going on about this but any further help would be appreciated
« Last Edit: Sep 19, 14, 07:46:45 PM by ExileThomas »
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: manipulate data for a offline player
« Reply #9 on: Sep 19, 14, 07:45:13 PM »

I believe that hjref Used the node mailing system.
Logged

ExileThomas

  • General Accounts
  • *
  • Posts: 23
    • View Profile
Re: manipulate data for a offline player
« Reply #10 on: Sep 19, 14, 07:48:13 PM »

I have managed to do it now.

the send/get mail system was the best way to do it in the end and was fairly simple to do.

Thanks for the help guys.. was greatly appreciated :D
Logged