You are on page 1of 11

Lucky Spin (Gacha)

documentation
Tool for monetization, retention and daily bonus

contact email: crazygiraffestudio@gmail.com


2
Table of contents

Integration

Settings

How to change rotation animation and duration?

How to change the sectors amount or rewards?

How to change the paid turn cost?

How to change the sector’s probability?


How the random sector is chosen accordingly to its probability?

Saving/Loading
3

Integration
1) To migrate asset to your project - right click on LuckySpin folder, choose “Migrate...”,
press OK, choose your project’s content folder, press OK.
4

2) Open Widgets/WBP_LuckySpin file.

Go to GiveReward function. Here you will need to change the logic inside the green block.
Now here are placed the logic of adding some coins to demo player. Probably you have
your own player controller with abilities to change coins, gems, lives or something else.

This is done as a function for more flexibility because you can want to do something else at
this step.
5
Then go to TakeTurnCost function. Here you will need to change the logic inside the green
block. Now here are placed the logic of taking 300 coins from demo player. Probably you
have your own player controller with abilities to taking coins, lives, gems or something else
for a turn.

This is done as a function for more flexibility because you can want to take coins or
something else accordingly current player state, health, the day of the week, etc.

3) See the “Demo/BP_LuckySpinDemoPlayerController” and “Demo/WBP_DemoHUD”


for examples of creating the widget, opening/hiding it, working with the coins.
6

Settings
A widget “WBP_LuckySpin” has some settings (public variables):

PaidTurnsEnabled - Can players make the spin for currency?

FreeTurnsEnabled - Can players make the spin for FREE from time to time?

HoursBetweenFreeTurns, MinutesBetweenFreeTurns, SecondsBetweenFreeTurns -


Set time between two free turns.

SectorsAmount - How many sectors are.

SectorsProbabilities - Each sector probability accordingly other sectors.

Rotation Curve - A CurveFloat asset for circle rotation easing.


7

How to change rotation animation and duration?


1) The rotation easing is set up from “Curves/Curve_Rotation_Float”.

You can add new points or change the positions of existing points to change the animation
of the sectors. Now the duration of the animation is 4 seconds. If you want to change this
time, you need to do two things:

- move the last point on the curve from 4.00 to desired X value. Y value in the last
point should be 1.00
- open “Widgets/WBP_LuckySpin” and change the “MaxRotationTime” variable’s
default value from 4 to the desired value in seconds.
8

How to change the sectors amount or rewards?


1) Change “SectorsAmount” settings of “WBP_LuckySpin” to desired sectors amount.

2) Change “SectorsImage” in “WBP_LuckySpin” to image with new sectors.

3) Add/remove/change texts/icons with rewards for each sector.

4) Go to function WPB_LuckySpin -> GiveReward, add/remove pins at Switch and


add/remove/change logic for this pins.
9

How to change the paid turn cost?


1) Go to function WPB_LuckySpin -> TakeTurnCost and change the logic in the green
blocks.

2) Open WPB_LuckySpin and change the image of PaidTurnButton


10

How to change the sector’s probability?


Change “SectorsAmount” settings of “WBP_LuckySpin” to desired sectors amount.

How the random sector is chosen accordingly to its probability?


1) At first, we sum up all probabilities, e.g. if we have 3 sectors with probability equals 100
and one sector with probability equals 1, then the probabilities sum will be equals 301.

You can imagine this as a long line consist of parts with different lengths accordingly to
probability |----------|----------|----------|-|

2) Generate random number >= 1 and <= probabilities sum.

3) On the next step, we go through this line and check in this part our random number is.

You can read about this idea here http://www.vcskicks.com/random-element.php.

Visualization as the line is showing that you can set as high probability as you want for
cheap items to decrease the chance of expensive items.

The final chance of some sector will be:

SECTOR_CHANCE = PROBABILITY_OF_SECTOR / SUM_OF_PROBABILITIES *100.

It is a fairly clear and easy way to calculate this. Though you should remember that
“Random integer in range” is not truly random function and this asset may not be suitable
for serious casino games without additional work.
11

Saving/Loading
Saving/loading system implemented like described here:
https://docs.unrealengine.com/en-us/Gameplay/SaveGame/Blueprints

You might also like