Shuffle Array bugged?

Hi,
I’m saving all target points of my level to an Array. Then i shuffle the Array and use it to spawn objects in a random order. This works fine as long as im playing in viewport. I just found out that my Array stays the same everytime i run the game in standalone mode. Is there a problem with Event BeginPlay or what causes this bug?

Hi Punkbuster,

I am attempting to reproduce this on my end but am a little confused with your setup. How are you spawning in the objects that you are attempting to spawn here? What are the float vars you used for Theta and Phi? I was able to get the spawn points to acknowledge that they were at different locations, however the change was not significant between each one.

I can’t make a screenshot before monday, but i can try to explain how it works.
I have a key event in my level bp which calls an event in my game mode and passes the transform array. This event simply uses spawn actor from class and the spawn transform from the array i passed. Phi is set to 0 and theta to 90,then they change in the for loops. This way i get 12 points on a sphere, so they are all the same distance from my pawn. My game works perfectly fine, only in stand alone mode i always get the same array. This means the positions where my objects spawn are always in the same order.

Here’s a screenshot how i spawn the actors. What i said before is wrong. The spawn part is in the level bp and i’m passing the array to another function

It seems to be a bug with the oculus. If the oculus is connected my array doesn’t change when i try to shuffle it. I’m using dev kit1 and 0.3.2

Hi Punkbuster0401,

We attempted to reproduce this on our end, both on PC and with Oculus (dk2 on build 0.4.4). Unfortunately we were unable to reproduce this effect on our end. Have you been able to reproduce this in a clean project with no additional content?

Yes, i had the bug in a clean project too. I didn’t check if i can fix it by removing the oculus. I can try this tomorrow.

I just created a clean project and i have the same problem. If i remove the hdmi cable from the oculus it works fine.

Hi PUnkbuster0401,

We will keep looking into this error. I am going to mark this as answered for tracking purposes. Thank you!

I’m just guessing here, but the shuffle array function might not be random in packaged games, the link below is in reference to that as well (just in c++ instead, where the solution was to make your own shuffle array function)

maybe a reseed for the shuffle array function is all we need, not sure.