Install/Setup
Last updated
Was this helpful?
Last updated
Was this helpful?
Unity 2020.3.4f1
Docker
- (PlayFab is a complete backend platform for live games with managed game services. It is free, the only way that you will be required to pay is if your game scales a lot. For example, PlayFab can have 100 000 users for free and after that you will be required to upgrade. You can check the different plans, but you won't need to pay anything unless your game is getting a lot of traction.)
- We use Darkrift for the multiplayer
for ADS - (You can use whatever plugin you want and change the parts that use ads accordingly)
FREE
FREE
URP
Text Mesh Pro
Import
Import
Import , , ,
Setup PlayFab (you can do it now or later it's not required to be in that order)
Import TriviaFakeit project
Export YourProject\Assets\TriviaFakeit\Lib.zip into your main project folder "YourProject" so that the folders look similar to "Library, Packages etc.. and Lib should be in there as well after you have extracted Lib.zip
Build Lib \ dt \ multiplayer_server_script \ TriviaTilesMultiplayerServer \ TriviaTIlesMultiplayerServer.sln - (it creates the necessary dll files). Lib folder should be in the main directory if you change it the dll wont be created in the right place.
Go to Lib \ TriviaTiles directory open terminal/PowerShell and enter: docker-compose up -d (this starts all our projects)
Open and enter username: trivia password: p123456. ( It opens phpmyadmin which is just a tool we use to inspect and work with our database. )
Import -> Choose File -> tdb.sql (tdb.sql is located in the main asset directory it should be something like (Your Game/Assets/TriviaFakeit/tdb.sql)
Open the server project and in TriviaModels->Networking->Constents.cs change DEV_SECRET_KEY and PLAYFAB_ID
This should be it, you can start the game, login and play.
All the game scripts
TriviaTiles.sln
Location: Lib\TriviaTiles
TriviaTIlesMultiplayerServer.sln -
Location: Lib\dt\multiplayer_server_script\TriviaTilesMultiplayerServer
Wordpress (Admin panel)
Location: Lib\.wp\
It includes premade categories/sub categories 130 questions as example
All the scripts for the game in Unity
This is the main project which you start the API+Database+Multiplayer Server+Wordpress. Everything is connected with docker-composer file.
Darkrift 2 Multiplayer server - All the TCP/UDP requests go here
We use Wordpress as a base for our Admin Panel, it includes custom plugin which is controlling all the questions/categories/subcategories/tags in game. You can create/edit/delete all of that from the admin panel.
Check the Wordpress section for more info about the admin panel.
Export YourProject\Assets\TriviaFakeit\Lib.zip into your main project folder "YourProject" so that the folders look similar to "Library, Packages etc.. and Lib should be in there as well after you have extracted Lib.zip
One of the first things you need to do is Build the Project TriviaTilesMultiplayerServer. If it is in the correct directory which is pointed above, it should build successfuly and include the dlls inside Assets/Plugins folder.
These dependencies are required in order the project to run without errors:
Darkrift 2 Free version
Leantween Free
Rest Client free
PlayFab SDK, 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:
From the PlayFab link above, you should have went trough the steps and have created a Studio and Title ID
There are couple of settings we must configure in order our game to run with PlayFab correctly.
Go to Multiplayer -> Matchmaking -> New queue
Go to Economy -> Currency -> New Currency
We need 2 types of currency. For the MMR and Coins (Example in the below images)
Go to Leaderboards -> New Leaderboard
Go to Content -> Title Data and add these key/value pairs.
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 TriviaFakeit 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 TriviaFakeit 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 TriviaFakeit folder inside the Assets.
Check in the Build Settings if you have all the Scenes included. If you do not add them.
Go to TriviaTiles directory open terminal/PowerShell and enter: docker-compose up -d
This starts all our projects
Click on Import -> Choose File -> tdb.sql
Open the server project and in TriviaModels->Networking->Constents.cs change DEV_SECRET_KEY and PLAYFAB_ID
This should be it, you can start the game, login and play.
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 Game Solution 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.
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.
If you are going to change localhost to something else you need to change couple of places:
TriviaMultiplayerScene -> HomeCanvas
/Scripts/Helper/Api.cs
It's important to know that if you have some different settings in PlayFab for example your matchmaking queue is called differently you need to change the following variable value:
Helper -> Multiplayer -> Models -> MultiplayerGlobals.cs
If you are building for mobile sometimes the Unity engine can strip some code that is needed and might throw exception like Unable to find constructor... if that's the case you need to create a file named link.xml inside Plugins folder with the following code and build again:
You can check the api calls also from :
You can check it at . Login with username : admin pasword : admin. On the left side in the menu you can see our plugin Trivia Tiles.
Open and enter username: trivia password: p123456. It opens phpmyadmin which is just a tool we use to inspect and work with our database.
You can check more about what is causing the issue here: