Install/Setup

Requirements

  1. Unity 2020.3.4f1

  2. Docker

  3. Dakrift 2 Free version - We use Darkrift for the Roulette multiplayer

  4. Gley plugin for ADS - (You can use whatever plugin you want and change the parts that use ads accordingly)

  5. URP

  6. Text Mesh Pro

Setup Instructions (Short)

  1. Import the Casino package

  2. Extract Assets\CasinoFakeit\Lib.zip in the main directory of the game. Where there are folders like "Packages" "UserSettings" "Library". After you extract it you should have folders like "Assets" "Lib" "Library" etc..

  3. Open Lib\SlotFunc\SlotFunc.sln and build it (it generates the necessary dll)

  4. Open Lib\ApiAndMulti\dt\multiplayer_server_script\CasinoMultiplayerServer\CasinoMultiplayerServer.sln and build it (it generates the necessary dll)

  5. If Tags & Layers are missing. Go to Tags & Layers and select the CasinoFakeitLayersTags from the Presets.

  6. Go to CasinoApi directory open terminal/PowerShell and enter: docker-compose up -d

  7. Open http://localhost:8093/ and enter username: casino_user password: p123456. It opens phpmyadmin which is just a tool we use to inspect and work with our database.

  8. Click on Import -> Choose File -> Assets/CasinoFakeit/cdb.sql

  9. Open CasinoLobbyLogin scene and start the game

Setup Instructions (Long)

The Casino Includes

4 Projects

  1. All the game scripts

  2. CasinoApi.sln -

    1. Location: Lib\ApiAndMulti

  3. CasinoMultiplayerServer.sln -

    1. Location: Lib\ApiAndMulti\dt\multiplayer_server_script\CasinoMultiplayerServer

  4. SlotFunc.sln -

    1. Location: Lib\SlotFunc

You need to get the Lib projects from Assets\CasinoFakeit\Lib.zip extract it in the main directory of your game. Where there are folders like "Packages" "UserSettings" "Library" so when you extrat it you should have Lib folder with the main projects in it.

CasinoGame

The main solution that contains all the scripts for the game in Unity

CasinoApi

This is the main project which you start the API+Database+Multiplayer Server. Everything is connected with docker-composer file.

You can check the api calls also from : http://localhost:8094/swagger/index.html

CasinoMultiplayerServer

Darkrift 2 Multiplayer server - All the TCP/UDP requests go here

SlotFunc

The functionallity for the Slots. It is separated from all the code for the Unity game. This is the place where the calculations for every slot is generated. All the spins, free spins etc.. The main point of the project to be separate is so if someone wants to extend it and create a system to calcuate the RTP or generate new slots more easily.

Installation/Setup

One of the first things you need to do is Build the Projects CasinoMultiplayerServer and SlotFunc. If they are in the correct directory which is pointed above, it should build successfuly and include the dlls inside Assets/Plugins folder.

If Assets\Plugins folder doesn't exist create one and after that build/rebuild the projects again.

These dependencies are required in order the project to run without errors:

Facebook SDK and Newtonsoft are external libraries so you need to download them from the links and locate the .unitypackage file that they provide. Then you import it from here:

Newtonsoft requires that there are no errors inside the project (this is stated inside the documentation of the newtonsoft package) so we need to install it before we put our CasinoFakeit folder inside the Assets. If you already downloaded the package which might be the case before installing Newtonsoft it's not a problem. Just move the CasinoFakeit folder which is located inside the Assets to somewhere outside of the project and install Newtonsoft. After Newtonsoft is installed and you can see the package added to your main game Solution you can move back the CasinoFakeit folder inside the Assets.

The Newtonsoft reference should be added automatically to the solution

If your Unity game doesnt have a solution, you can easily create one by going to (inside Unity) Edit->Preferences->External Tools->Regenerate project files (External script editor should be pointing to Visual studio). Check the image below.

  • Open Lib\SlotFunc\SlotFunc.sln and build it (it generates the necessary dll)

  • Open Lib\ApiAndMulti\dt\multiplayer_server_script\CasinoMultiplayerServer\CasinoMultiplayerServer.sln and build it (it generates the necessary dll)

If Tags & Layers are missing. Go to Tags & Layers and select the CasinoFakeitLayersTags from the Presets.

Go to CasinoApi directory open terminal/PowerShell and enter: docker-compose up -d

This starts all our projects

Open http://localhost:8093/ and enter username: casino_user password: p123456. It opens phpmyadmin which is just a tool we use to inspect and work with our database.

Click on Import -> Choose File -> cdb.sql

cdb.sql is located in the main aset directory it should be something like (Your Game/Assets/CasinoFakeit/cdb.sql, after importing you can delete it it includes all the tables + the main data we need for the game.

Check in the Build Settings if you have all the scenes there, if you do not, add them.

This should be it, you can start the game, login and play.

Facebook login requires additional setup. You can check the Facebook SDK documentation for how to setup login with Facebook.

Gley plugin - ADS

If you want to enable the ADS the most easy way it will be if you get the Gley plugin. If you use something else you just have to put the required code for the plugin you are using at the specific places.

You can search the CasinoGame.sln project with CTRL+SHIFT+F for ADSHERE keyword and it will show you where the ads code should be in the project. Uncomment the code and the ads should start working.

ShopDialogItemComponent.cs

CasinoLevelMain.cs

Important

If you change the location of any of the projects you might have issues with dependencies. Currently when the projects are built they automatically copy the generated dll in the right directory. You can change that by going to the specific project Build Events and change the locations acoordingly your change.

SlotFunc might require dependency of UnityEngine.dll if you decide to do Unity Logs inside the library for example and if it is missing it should be located to a similar locaiton like this one C:\Program Files\Unity\Hub\Editor\2020.3.4f1\Editor\Data\Managed

If you are going to change localhost to something else you need to change couple of places:

CasinoRoulette Scene - Inside the Main Camera object

CasinoGame.sln - /Scripts/Helper/Api.cs

Building for Android

If you are building for Android depends on your settings, but sometimes Unity can strip some code which will cause the multiplayer to not work on Android, to resolve that, just create a new file inside the Assets/Plugins folder and name it link.xml with the following code inside.

<linker>
    <assembly fullname="CasinoModels" preserve="all"/>
</linker>

Demo

You can check out a demo for android from here (keep in mind this is a demo and might not contain the latest changes)

Last updated