Help Getting roulette wheel and Ball to communicate

Hello, I’ve made a roulette wheel and Ball Blueprint and I am trying to figure out how to make the two of them communicate. All I have is this so far (And Roulette_Player Controller and Game Mode, Both of which are currently empty)

I’m sure I’ll eventually need to make data tables and such for what happens when you are in a number, but for now I just want to be able to print a string that tells me what Number/color the ball has landed in (The ball must be within the number’s box collision for 3 seconds before print string happens, that way it doesn’t just tell me every Box Collison name it touches while its still moving)

I’m an art guy not a programmer so my knowledge is limited. I can do some basic things and reading Blueprints makes sense to me, but knowing what to call and how to do is beyond me currently. Thank you in advance for any advice you may have!

Hello there @Didgeridrew5!

I think you are on the right track for this one, having box collisions and a three second timer, tied with blueprints, should do the trick here. The flow would be:

  1. Ball enters a collision box
  2. Timer starts
  3. If the timer completes, print the slot name
  4. If the ball leaves the box, cancel the timer
  5. Start again from 1

Just make sure of the following for this setup:

  • Double check that each box collision is properly named (Red_19, Black_31, etc)

  • Review the ball’s collision component, and make sure it’s checking for component overlap with the boxes, whenever the overlap begins,or ends

  • Use a “Get Display Name” node to pick the slot’s name, and store it in a variable

  • Once stored, start a Delay timer of 3 seconds, which should be interrupted if the overlap ends

  • If the timer completes, it means the ball remained on the slot

  • Use a Print String node to show the resulting slot

I super appreciate the help. My biggest problem is I don’t know How to get the ball to recognize the individual box collisions within the roulette wheel. Currently, I got the ball to tell me when its sphere collision comes in contact with a box collision on the roulette wheel, but all it tells me is “BP_Roulette” in the print string rather than the individual slot names. I didn’t use the “Get Display name” Node because I couldn’t figure out how to actually make that work?

Hello again, glad you are making progress!

Checking your setup, I think it’s a matter of switching “Other Actor” (which represents the entire BP) for “Other Component” (which is just the collision component). You should also be able to connect it directly to the print, so the result would be On Component Begin Overlap > Get Display Name > Print String

When the ball rolls over a slot, it should ask the collision box for its name, and print it on screen. You could also plug the 3-second timer in this chain, using a Delay node, and the On Component End Overlap event.

Looks like the trick was I had to remove the collision sphere I put on the ball, and just use the ball itself. That, paired with the delay node got me a result I was looking for! Thanks

I’m sure its vastly more complicated, but do you have any suggestion on how you might set up the actual betting system payouts. Idk how much you know about roulette but if you bet on red and its red you get a 2 to 1 payout. If you bet on an individual number and get it right it’s a 35 to 1 payout. And there’s all sorts of other ranges within there. Evens/odds, betting a “street” (4,5,6) or corner (1,2,4,5) to name a couple examples, each of these has a different payout multiplier.

Glad that worked out for the ball logic!

And yeah, that next step is quite daunting. Checking with my peers, I think your best bet (:rofl:) is to setup a data table, which will handle all your bet types and payouts in one structure.

The overall workflow here would involve creating a structure blueprint, assigning the values for the bets (BetName, PayoutMultiplier, CoveredNumbers, etc), then adding a data table covering all possible variables of said bets (for example, BetName: Street_456 / PayoutMultiplier: 12 / CoveredNumbers: 4, 5, 6). After that, use the resolved logic from the ball to communicate the winning number to the table, and check for succesful bets.

Before tackling that, I would suggest taking a dive on the basics about Data Tables and how to work with them. Below you can check UE’s community guide on the matter, as well as a video course, please check them out:

I would be tempted to make this very simple. They don’t need to communicate because it only matters when the ball stops. So when the ball stops get to to check its relative location to the wheel - from the rotational angle with a bit of maths you know which slot it is in.

Oh my god you’re amazing, thank you! (I wish I had peers instead of just the mercy of strangers! haha) Learning this is going to help me with so many aspects of my projects!

I used to hire freelance programmers on fiverr and upwork, but life has gotten so expensive, I gotta learn all this stuff myself.