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

Author Topic: [Resolved] Persisted node available anywhere  (Read 3592 times)

brainache

  • World Owner
  • ****
  • Posts: 121
    • View Profile
[Resolved] Persisted node available anywhere
« on: Feb 16, 13, 06:53:29 PM »

If you have say, 100 nodes that contain some basic data.. and you want to persist those and load them once upon world load...   what is the best way to do that?

After doing some forum/wiki research...

I am thinking of something along the lines of:

Create an arbitrary root node in a system area ( say.. character selection )...
Associate the nodes to that ARN

Upon world load.. load the ARN.. add the data to a system node for usage...


does that make sense?
« Last Edit: Feb 19, 13, 09:10:52 AM by HE-Cooper »
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: Persisted node available anywhere
« Reply #1 on: Feb 16, 13, 07:54:29 PM »

It sounds feasable to me, though I have not worked with this part before. I am also searchng for a way to keep data from disappearing once I set it up in CSS and CCS.
Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

brainache

  • World Owner
  • ****
  • Posts: 121
    • View Profile
Re: Persisted node available anywhere
« Reply #2 on: Feb 17, 13, 04:14:54 AM »

After working on this for quite some time - I can not find anything that works.

System nodes do not persist across areas... so you cant load data into a system node from CSS then use it later in another area

I simply can not find anyway to store a collection of persisted nodes, that need to change, across all areas.

It seems the only thing that would work would be to create a prototype that has all the data you want to use - but that cant be updated dynamically in a production world.

Can anyone point me to a way to achieve this?
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Persisted node available anywhere
« Reply #3 on: Feb 17, 13, 10:37:14 AM »

So the root nodes approach did not work?
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

brainache

  • World Owner
  • ****
  • Posts: 121
    • View Profile
Re: Persisted node available anywhere
« Reply #4 on: Feb 17, 13, 10:45:48 AM »

Nope - Arbitrary root nodes are saved in the area - so they are lost when you move from one area to another... you could move them from one area to another if you had to ( like the character root node ) - but that would result in multiple copies of your nodes.. one for each area...

so.. nope...
Logged

grimcat

  • World Owner
  • ****
  • Posts: 20
    • View Profile
Re: Persisted node available anywhere
« Reply #5 on: Feb 17, 13, 11:50:37 AM »

I'm no doctor, but I play one on TV.

From your posts, it sounds like your data is mutable and not tied to a specific account or character right?

Seems like storing the data in a system area is the correct recipe based on what I've read:

http://hewiki.heroengine.com/wiki/Data_storage_options#Data_Storage_in_System_Areas

The description makes it sound a bit daunting, but the other options seem to limit you to data that either isn't mutable or isn't available from other areas.
Logged

brainache

  • World Owner
  • ****
  • Posts: 121
    • View Profile
Re: Persisted node available anywhere
« Reply #6 on: Feb 17, 13, 04:36:14 PM »

Thanks Grim - System Areas do read like the correct method, I hadn't come across that wiki page.

I did attempt this using a system area - but the nodes created were not available outside that area...   I must have missed something - I'll dig deeper into it
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Persisted node available anywhere
« Reply #7 on: Feb 17, 13, 05:27:36 PM »

You would use server-to-server remote calls.  Send a request to it and it sends back the requested data.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

JoshHalls

  • Founding Professional
  • *****
  • Posts: 335
    • View Profile
    • The Repopulation
Re: Persisted node available anywhere
« Reply #8 on: Feb 17, 13, 06:24:48 PM »

You might want to include a bit more information.  There are a variety of options and most of them involve system areas or prototypes depending on how often the data changes.  If the data changes at all during game play a prototype is pretty much off the table and system areas can be used.  You can use replication from system areas to zones if needed to keep a copy of the node in play in the zone and even can replicate out changes from different zones by using proxy nodes through the replication system.

It kind of depends on what the data is and how it will be used though as there might be a much simpler option as well.
Logged
Co-Owner/Programmer - The Repopulation

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
Re: Persisted node available anywhere
« Reply #9 on: Feb 18, 13, 03:27:07 AM »

Thanks guys, I have a working sending and receiving data transfer method.

I first set the value based on the button press in the CCS.

HaV_AlignmentMenuClassMethods (client) : _OnButtonMouseClick

  acct as NodeRef of Class E_playerAccount = GetAccountID()
  char as NodeRef of Class E_playerCharacter = acct.GetMyCharacter()

  when button.name
    is "MyButton"
      char.HaV_Align = "myValue"
      call server E_playerAccountClassMethods:SetAlignmentServer( acct, "myValue")



Which then sets the value on the server side.

E_playerAccountClassMethods (server):

// set the alignment to the data area
untrusted function SetAlignmentServer( accountID as ID, align as String)
  acct as NodeRef of Class E_playerAccount = accountID
  char as NodeRef of Class E_playerCharacter = acct.GetMyChar()
  char.HaV_Align = align
.



When I am loading the character in to the area, I then get that value.

E_playerAccountClassMethods (client):HE_OnReplicationNodeAdded

        MakeGameGUIs(addedNode)
        call server E_playerAccountClassMethods:GetAlignmentServer( me )



Which retrieves the data and sends it back to the client.

E_playerAccountClassMethods (server):

// retrieve the alignment from the data area
untrusted function GetAlignmentServer( accountID as ID)
  acct as NodeRef of Class E_playerAccount = accountID
  char as NodeRef of Class E_playerCharacter = acct.GetMyChar()
  align as String = char.HaV_Align
  // need to make a call back to the sending client with:
  call reply E_playerAccountClassMethods:AlignmentGiven( accountID, align )
.


Where the client then sets the value for the character.

E_playerAccountClassMethods (client):

remote function AlignmentGiven( accountID as ID, align as String)
  acct as NodeRef of Class E_playerAccount = accountID
  char as NodeRef of Class E_playerCharacter = acct.GetMyCharacter()
  char.HaV_Align = align

  InitGameGUIs(char)
.

Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Persisted node available anywhere
« Reply #10 on: Feb 19, 13, 05:01:16 AM »

If you are going to store it on the character, then the remote calls are mostly unneeded: just set up the field for replication and it will ready to be used on the client as soon as the client's character node is ready.

Although if you are going to change the value from the client, then it would need to either send that request via remote call or else you could enable reverse replication.  The remote call would be more secure as you can do any checks needed in the receiving function/method.
« Last Edit: Feb 19, 13, 05:04:00 AM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.