playMaker

Author Topic: Select random string with seed?  (Read 3436 times)

Groo Gadgets

  • Beta Group
  • Full Member
  • *
  • Posts: 175
Select random string with seed?
« on: September 10, 2013, 05:40:47 PM »
Heya,

I'm using the Select Random String action in my game and it works great. However I need to be able to set a random seed on this action.

I've been trying to add it to the action myself but I feel i'm out of my depth on this one. Please help!

Cheers,

Simon

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Select random string with seed?
« Reply #1 on: September 11, 2013, 02:50:55 AM »
Hi,

 Could you explain your use case for the need of seeding?

Bye,

 Jean

Groo Gadgets

  • Beta Group
  • Full Member
  • *
  • Posts: 175
Re: Select random string with seed?
« Reply #2 on: September 11, 2013, 07:30:44 AM »
Hey Jean,

Ok I'm creating a word game and am currently populating my word board by looping through the set random string string action. I'm using the weight value on each letter so harder letters like X and Z are less likely to be generated.

I would like to use a seed value specifically for populating multiplayer game boards. So hypothetically each client would only need the seed value to populate the game board with exactly the same letters.

I've been researching adding this functionality to the existing set random string action but I can't work it out, do you know if this is possible?

Thanks mate,

Simon

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Select random string with seed?
« Reply #3 on: September 12, 2013, 07:12:06 AM »
Hi,

 ok, I see. I would propery something different actually.

 Have this logic implemented in one place, and then distribute the result and not the actual seed. It will be easier.

 Typically, one way to go about it is the following:

save the board result online. Have your master responsible for generating the board content, and upload that content on a server or simply store the board content in a string and fire a RPC event to "OTHERS" so they can all match the board content.

If you have some php skills, this is easy to save content on a server and get it. If you don't have any php skills, then simply fire an RPC event in your game and pass a string featuring the content of the board.

Does that make sense? Implementing a seed if I think going to give you more trouble to implement than the above solution.

bye,

 Jean