Quick-start Guide
While there are many ways to integrate the slot machine into your project, let’s start with the most basic example to get you up and going.
Create a new blank project in Unreal Engine
In this example, you could add it to a project you already have in progress, but it’s recommended to create a new project first to familiarise yourself with the asset before attempting to integrate it with your own project.
-
Launch Unreal Engine
-
When the Unreal Engine Project Browser appears, click Games, and choose Blank
-
Give your project a name, and untick Starter Content, as we will not be needing these for this demonstration.
-
Click Create
Import the asset to your new project
-
Open up the Epic Games Launcher
-
Click Unreal Engine down the left navigation pane
-
Click the Library tab along the top
-
Find the Slot Machine Blueprint in the Vault section, and click ‘Add to Project’
-
In the pop-up, choose the project you just created
-
Click Add to Project
-
If this is the first time adding to a project, the asset will download.
-
Close the Epic Games Launcher
-
Back in your project, open up the Content Browser, and confirm that you see the folder VSPM under Content.
Create a new level
-
Click File, and choose New Level
-
Choose Basic, and then click Create
-
In your Viewport, you should see a new level
-
Click File, and the choose, Save Current Level
-
Give your Level a name, and click Save
Add the blueprint to your level
-
Open up the VSPM folder in the Content Browser, and click the Blueprints folder
-
Drag BP_SlotMachine into the Viewport and move it where you would like it.
By default, it is not possible to rotate the slot machine on any axis other that Z, nor are you able to natively scale it. This is intentional as it would affect the physics programming for the reels and coins. If you wish to change the size of the machine, you may do this safely using the Machine Size drop-down under Basic Configuration.
It is possible to disable these restrictions by ticking Disable Transform Limits under Advanced Configuration, however, you may get undesirable results.
Set some basic settings
We need to program some basic settings to allow operation of the Slot Machine:
-
Ensure that the slot machine is selected within the viewport.
-
In the Details panel, set the following:
- Tick Enforce Local Balance - this enables the built-in coin balance to keep track of the number of coins that the player currently has.
- Set Initial Local Balance to 20 - this sets the number of coins that the player will start with.
- Tick Balance Widget - this enables the built-in widget to display the player’s current balance.
- Tick Instructions Widget - this enables the built-in widget to display the input bindings.
- Tick Lose Widget - this enables the built-in lose widget which is displayed when the player’s Local Balance is depleted.
- Tick Disable Bindings on Lose - this prevents the player from using any of the inputs once the player’s Local Balance is depleted.
- Tick Basic Input Binding - this enables the basic input binding system, allowing you to set up some local input bindings.
- Click the input button beside Play Input, and press the Space bar - This sets the space bar as the input that the player must press to begin a play.
- Click the input button beside Increase Bet Input, and press the R on the keyboard - This sets the R key as the input that the player must press to increase the bet amount.
- Click the input button beside Decrease Bet Input, and press the F on the keyboard - This sets the F key as the input that the player must press to decrease the bet amount.
- Click the input button beside Pay Table Input, and press the Z on the keyboard - This sets the Z key as the input that the player must hold to view the the pay table.
You don’t have to choose the input bindings suggested above, you can choose whatever input you like.
Set the blueprint to Auto-possess player
Currently, if you begin the game, the player will not possess the slot machine pawn, as the default pawn will be possessed. To fix this, we need to set the Slot Machine to be auto possessed when the game starts.
-
With the asset selected, scroll down to the Pawn section in the Details panel.
-
Click the Auto Possess Player drop-down, and select Player 0
Start the level
-
At this point, the machine is ready to use. Click Play at the top, or press Alt + P
-
Click into the viewpoint, and press Space bar (or the key/button that you set for Play Input). The machine should start a play.
So what now?
You have it working. Take a look at the sample maps included with the project, and explore the level blueprint for each to understand how they have been implemented. This will give you an idea of how you might configure it in your own projects.