@Astrotronic
Couple of questions already if you donât mindâŚ
How can you control the direction in which the reels spin??? I donât see any add or set rotations⌠and this Physics stuff looks dangerously confusing at a first glance
How the heck did you get a zip of the project that has only 790Kb???
I tried zipping my project and it was 925Mb
I noticed on your cubes⌠you are somehow reading the final position that the reels land on based on the material texture??? Oh lordy⌠what sort of magic trickery is that?? Lol.
Iâm still trying to wrap my head around this whole physics model, but right now Iâm a bit lost.
Will digest more tomorrow and Iâm sure coming back with more questions.
But, I have to admit⌠the animation is more realistic than Add or Set rotations with timelines and lerps and other nonsense.
How can you control the direction in which the reels spin?
Feed a negative number into âAdd angular impulseâ instead of a positive one. (protip: multiply a positive number by -1 to make it negative)
How the heck did you get a zip of the project that has only 790Kb?
I love this about sharing projects. It uses meshes etc that are already installed with every engine install, so itâs basically just text data. (I did find that saving an âopen worldâ map causes bloat thoughâŚ)
Cube material/textures
The material/texture is completely irrelevant - I just wanted to have a texture that is different on each side easily. I saw that the rotation output was -90 to 90, so I mapped that range from 0-4. (Although itâs up to you to see if this idea holds up with more sides)
~
Agreed, jumping straight into working with rotations is certainly harder than working with location data.
still here, sorry for the delay. Been working on a couple of other projects at the same time.
I have to say it took me 2 days to figure out why the darn wheel was just falling when I hit play. Found out that you have to constrain its location on all 3 axes and the rotation on x,z. it looked funny though as the wheel just fell to the ground. Seems that this chaos slot machine is gonna be harder than what I initially thought of.
Nonetheless, I have a couple more questions if you donât mindâŚ
I still need to understand how to control the spin better. Mostly the speed of the spin. Donât have a clear understanding on the angular impulse and damping and how to properly adjust them. Also, I kept the -90 â 90 range you had initially for the cube, but I think I should maybe use -180 â 180 for a full 360 range of a disc??? Also, each disc(reel) will have exactly 30 symbols on it. However, the order of the symbols will be different on each reel.
I need to find a different way of getting the 3 reels, in the slot machine. Other than âGet All Actors of Classâ. Reason being, I want the reels to have a different texture on them, so each reel is unique in that sense. Not only the order of the symbols on the reels but also the repeating occurrences of 1 symbol on the other reels.
What I mean by that, letâs say the cherry symbol, could have 6 occurrences on reel1, but only 5 on reels 2 and 3.
Iâm thinking of a way to map those symbols on each reel. Maybe an array linked to an Enum or something that will help me pair the spin result for each reel to a value preset in an array. Iâve never done anything like this before in UE, so a little bit of guidance is greatly appreciated.
Any other thoughts or ideas that may point me in the right direction?
Again, your time and help so far are greatly appreciated. Eventually I will make something out of this thing even if I have to âreinvent the reelâ
Re: wheel falling out: You missed one of my steps from above!!
âAlso in the Mesh details panel:
Constraints â Lock Location on all Axis, Lock Rotation on 2/3 axis.â
I think youâd just need to experiment with different numbers. The âdampingâ is just like applying the brakes, maybe deciding on a result ahead of time and lerping might be a more âcontrollableâ path ~~~ Do a âprint stringâ on âGet world rotationâ It was outputting values from -90 to 90 when I put together that sample. (Which is weird, but it worked. I just looked into this now and I see that the other 2 rotation values are flipping to 180 (so there is 80 degrees with 0 rot on the other axes and 80 with 180 on the other axes for example. Mysterious.)) (You can open up the output log with Window â Output log to get a better view of the values itâs spitting out)
2/3. Different symbols patterns on different wheels (with the possibility of having the same symbol multiple times)⌠Thatâs an interesting data problem.
Array Maps seem like a path forward. I think knowing what sort of data you want for your âwin calculation functionâ would be prerequisite. 0-29 looked up using a unique mapping that outputs a string. (String being BAR or Cherry) seems good from a human readable/debuggers perspective. 2 nodes to know about would be âSwitchâ and âSelectâ, but I think the overall design would be feeding an array into a function.
I was just checking the Array Map video and Iâm thinking I might have an issue with that.
Itâs my understanding that the key should be unique, but in my case when I try to build the array, it would look something like this:
cherry, bar, bell, seven, cherry, diamond⌠cherry
Meaning, some of the symbols will have multiple occurrences in the array.
How can I do that???
Wow, I was literally, banging my head on this 5 min ago⌠canât believe I didnât think of reversing the key <-> value orderâŚ
Ok, how do I plug this array into the result of the spinning? Or do I need a function to get the result and look into this map? Any little guidance is golden
Also, should I do this inside the reel bp or the slot machine???
In my above image I changed âMyWheelSpinResultArrayâ to a map, donât do this. (Since youâd want the âlookup mapâ to be separate and static)
The general idea would be to feed the 3 result integers into the lookup map and have it spit out the strings. (Maybe even putting the strings into their own array to be fed into the âwin calculatorâ?)
I havenât worked with maps in a while⌠but I guess one piece of guidance is to use the âFindâ function to look up valuesâŚ
Protip: Drag off from a pin with âcontext sensitiveâ on and you can browse all applicable functions.
In the context of my sample project I imagine all of this happening in âThe_Machineâ blueprint since thatâs where the spin results are being collected.
Another quick issue that Iâm having a bit of trouble understanding and setting upâŚ
How can I set the starting position? Or what is the position that is returned by the spin function??? Is this based on the Map Range Clamped? And I should just play with the numbers there until they match or is there a more precise approach?
In order to set up my array, I have 30 symbols on the reel. I need to build the array in the order the symbols are on the texture. But, how do I know which position is read by the spin function when it stops? as in physically in the viewport??? Because out of the 3 that will be visible on each reel, only the middle spot will be considered for the pay table.
Not sure if Iâm making it sound more confusing than it already is⌠but if you look at my initial 3 reel attempt that had a cover of the machine case around them⌠3 symbols where visible on each reel, out of which the middle one should be the winning position. Technically it would be the 0° out of 360 (to be more specific it would be in the range of -6° - +6°) since each symbol takes up 12° on the wheel. So I would basically need to make sure that the spin function returns that position as the result.
Again, thanks for all the hand holding and appreciate all your help.
Please know that my goal here is not to do any hand-holding, but only to point you in the right direction. (But Iâll admit the âRinterp toâ rabbit hole was a dead-end direction)
Fifty replies back and forth - UNPRECEDENTED.
Iâve been in casinos and on cruise ships, watching old-timers play the slots. These machines fill me with a sense of sadness. Whatâs the point? Whereâs the strategy? What gods are we serving by re-creating a random number machine?
~
I think I get what youâre saying about the positioning. The âMap Ranged Clampedâ is probably non-essential. Working with 0-360 values seems like a good path as well.
If you share the textured 30-sided wheel Iâll plug it into my test project and see what I see. (But only in a âIâm curious to poke at thisâ way and not in a hand-holding way!)
Please know that my goal here is not to do any hand-holding, but only to point you in the right direction. (But Iâll admit the âRinterp toâ rabbit hole was a dead-end direction)
Fair enough, and my apologies for keeping this alive for so long. Iâm just super excited about learning something new about UE every day.
Iâve been in casinos and on cruise ships, watching old-timers play the slots. These machines fill me with a sense of sadness. Whatâs the point? Whereâs the strategy? What gods are we serving by re-creating a random number machine?
Technically, weâre invoking physics here no predetermined rng, although⌠it still kinda is rng dependant
Hereâs your original project modified with the 30 slot wheel and texture.
Somehow, I managed to make it 20Mb from your original 790Kb
Let me know if you can think of a way to have a predetermined spot for reading the winning symbol. As of right now, the Bell (between the 3xbar and 2xBar) that is facing the camera should be the position read.
I can make the array as you initially suggested by swapping the key<->value order, so I could have that Bell at the 0 position in the array. But I canât figure out a way to let the gods of physics know, that I want that specific position returned at the end of the spin, whatever symbol may end up thereâŚ
Again, I really appreciate all your help, and I know I have already asked way too much from you. My apologies for wasting your time with my silly project.
Best case scenario would be having the first symbol (symbol 0) be the one facing the camera when the mesh is at 0 rotation. Things could get complicated otherwise. (For example, if you Just figured out the offset and added 6, youâd also need to account for values in the mid-high 20s that would need to flip back to 0 once over 29)
Iâd say no, doing it the complicated way youâd always be compensating for the 90 degree offset. (90 degree offset from the current position always, so initial position does not seem relevant.)
Not an impossible task, but having the symbol at 0-11 degrees match symbol number 0 when reel is at 0 rotation feels like more of a âsimple/solid foundationâ
Gotcha! Again, thank you so much for your time and patience. I actually learned a lot from all this. Not sure if Iâm yet capable of making this work, but will give it my best