HeroEngine Forums

HeroEngine Support => Scripting & Programming => Topic started by: Thazager on Apr 04, 19, 04:02:53 PM

Title: replication type
Post by: Thazager on Apr 04, 19, 04:02:53 PM
I'm trying to replicate a lookuplist from server to client. It seems to work partially, as in

it will replicate:

  lookuplist indexed by integer of string             // where values are stored in a string:   "name price"

but will not replicate:

  lookuplist indexed by integer of class auction    // where values are stored in a class:   data.name   data.price

Using the string, I need to Tokenize the string before checking the value, I think the "class" would be faster in this case.  Using the class, the size of list replicates, but the values are all blank.

It does not seem to even recognize list of string

  lookuplist indexed by integer of list of string     // where values are in a list:  data[1]   data[2]

Title: Re: replication type
Post by: HE-CHRISTOPHER on Apr 04, 19, 04:43:37 PM
A question for you...

Does the client destination class include destination fields for all of the fields marked to replicate in the server DOM (including anything it would inherit from parent class(es)?

Title: Re: replication type
Post by: Thazager on Apr 04, 19, 05:21:10 PM
Yes, before running the tests using replication, I had copied fields and classes from server to client side.

When originally making the system, I had sent the lookuplist directly from server to client and displayed the info in the GUI. It was using the class and fields at this point on both client and server.

Then I added the replication which works with the integer of string, and then tried integer of class, but it was missing the data.

will try world sleep
Title: Re: replication type
Post by: FI-ScottZ on Apr 05, 19, 12:04:19 AM
Did you set the server-side fields of auction to have their corresponding client fields as targets of replication?
Title: Re: replication type
Post by: Thazager on Apr 06, 19, 01:43:59 PM
Hmm, I know I had the main list set that way. I will check and see if the others are also set, and if not will try adding them.
Title: Re: replication type
Post by: Thazager on Apr 08, 19, 11:14:34 PM
Added the other fields for replication also.  Still not getting values.

E_nonPlayerCharacter            class that gets replicated

EO_AuctionItemList                field in class E_nonPlayerCharacter that gets replicated

   type= lookuplist indexed by integer of class AuctionData

AuctionData                          class with 5 fields   (all 5 set to replicate to client)

EO_AuctionItem                    spec ID of item
EO_AuctionPlayer                  name of player selling item
EO_AuctionPrice                    price item selling at
EO_AuctionHours                   amount of time its for sale
EO_AuctionTime                    start of time it started

All client side fields show no value for string, or 0 for ID / integer. List prints, showing they are there, but they are just blank.

Code: [Select]
shared function _OnReplicationFieldUpdated(updateNode as NodeRef, updateField as String)

  when toLower(updateField)
    is "eo_auctionitemlist"
      println("got updated auction list ")

// print values in auction list
function ShowAuctionList(npc as NodeRef)
  where npc is kindof E_nonplayerCharacter
    println("npc "+npc+"  size "+ npc.EO_AuctionItemList.length)
    data as Class AuctionData

    loop i from 1 to npc.EO_AuctionItemList.length
      data = npc.EO_AuctionItemList[i]
      println("offset "+i+"  name "+data.EO_AuctionPlayer+"  item "+data.EO_AuctionItem)

Server Side
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: npc 9223372131270022109  size 10
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 1  name Test1  item 22
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 2  name Test2  item 26
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 3  name Test3  item 11
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 4  name Test4  item 3
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 5  name Test5  item 15
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 6  name Test6  item 19
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 7  name Test7  item 6
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 8  name Test8  item 2
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 9  name Test9  item 16
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: offset 10  name Test10  item 10
[hsl_debug] 9223372086796021574,3: SCRIPT[E_nonPlayerCharacterClassMethods]: updating NPC auctionList Auctioneer  size 10

Client Side
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:got updated auction list
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:npc 9223372131270022109  size 10
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 1  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 2  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 3  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 4  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 5  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 6  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 7  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 8  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 9  name   item 0
22:57:16: SCRIPT:[E_nonplayerCharacterClassMethods]:offset 10  name   item 0