Sign In Register

How can we help you today?

Start a new topic

Why pre-defined segment values?

What is the purpose of defining individual segment 'values', when any value can be set for a player segment via player.setSegmentValue(segmentShortCode, anyStringYouWant);

I would have expected the above setSegmentValue() to error out if the value submitted doesn't match one of the defined values for that segment.

I can easily end up with a player segment value (as seen in the system Player collection) that is not one of the defined ones in the segment configuration.

bump bump bump

Hi Jeff,

To ensure you are acquiring the correct values you can use SparkConfig.getSegments(); this will return a sparkSegment if one exists, through which you can acquire segment values. 

Best Regards, Patrick. 

Not sure that answers the question - are we REQUIRED to set up values for segments or are the just a convenience thing?

Hi Jeff,

I've tried setting a player to a custom non configured segment. It would appear that if you do that you can't select that segment when segmenting the games configuration. I'll look into this for you some more to see if this is the expected behavior or not. Have you run into any issues with this yourself ?



I have found that I CAN send in a non0configured segment via player.setSegmentValue(segmentShortCode, anyStringYouWant)   which causes me to do my own validation of each inbound value against the list of segment 'types' manually - instead of using a try/catch around a GS initiated error.    If we can't actually USE values (as you pointed out above) that aren't actual defined segment values, it would seem that they would be prevented from being set.

Hey Jeff,

So the segments that you configure on the portal are for segmenting the game configuration to customize the experience for the players within them. Setting players to segments in Cloud Code is essentially giving you the freedom to set players to non portal configured segments for your own custom cloud code based segment purposes. So as Patrick mentioned previously you could use .getSegments() call in Cloud Code if you want validate that the segment that you are adding a player to is a portal configured one or not.



Login to post a comment