MoreGames
Framework for mod creators to build custom gambling machines
模組介紹 作者原文
GWYF_MoreGames
Framework mod for making new casino games in "Game With Your Friends".
Installation
- Install BepInEx 5.x into your Gamble With Your Friends directory.
- Copy the MoreGames.dll and the stampsprefab asset bundle into: BepInEx/plugins/MoreGames/
How to make your own custom game
Note: The Fishing Game mod: is a good reference for how to build a game using this framework.
To build a compatible mod you will need to set up your file structure as such:
- YourModName/
- Games/
- YourGameName/
- YourGameName (Unity Asset Bundle)
- YourGameName.dll (C# class extending GameBase)
- gamemanifest.json
- YourGameName2/ (if you want multiple games in one mod you can add both to the games folder)
- YourGameName2 (Unity Asset Bundle)
- YourGameName2.dll (C# class extending GameBase)
- gamemanifest.json
As you can see there are 3 main things you need for a game to work properly:
- A compatible unity asset bundle
- A dll containing a class extending GameBase
- A json defining important things about your mod
In the next sections, I will go through how to set up each of these correcly.
Asset Bundle
To build a compatible unity asset bundle you must first set up a good Unity scene. I highly recommend using AssetRipper on the Gamble With Your Friends_data folder in steamapps\common\Gamble With Your Friends. Then, in AssetRipper, export the ripped files to a Unity project. In Unity Hub make sure to download Unity version 6000.3.6f1 and open the Unity project with this version. This will give you all of the materials, meshes, and prefabs that the game has. The major issue is that all of the scripts get disconnected, so you should delete all C# scripts in the folder. Then find a prefab that already exists in the game like Crash CasinoGame. You can edit this prefab and use it as a base to build what you want. Make sure to remove all dangling components that use scripts, as these will throw errors. Also, make sure to add the TextMeshPro package so that you can add TextMeshPro components to any text. To get the game's font, look for Assets/Font/Dangrek-Regular.ttf and use it to build Dangrek-Regular SDF.asset which you should place in Assets/Resources/fonts & materials/ then just select Dangrek-Regular in TextMeshPro.
If you look at a prefab for a preexisting casino game it will look something like this:
- Example CasinoGame
- GameName (This needs a TextMeshPro)
- Model
- (Any 3D model) (Make sure that the material has a shader used by the game, I know that 01_GWYF/ and AllIn1SpriteShader/ work correctly, however these shaders make the 3D model look flat so make sure to prebake some lighting)
- Play Button (This has a BoxCollider)
- Model
- Text (This needs a TextMeshPro)
- SM_button_1 (This uses mesh: Cube.002, a mesh renderer, a BoxCollider and a material)
- Feedbacks
- PressFB
- (Any other buttons)
- Feedbacks
- GameResultFB
- GameWinFB
- GameLoseFB
- FloatingText Spawner
- GameWinVFX
- (A whole bunch of particles)
- GameLoseVFX
- (A whole bunch of particles)
- GameTieVFX
- (A whole bunch of particles)
- KeypadPoint
- Keypad (This has a BoxCollider)
- SM_keypad_base (This uses mesh: Cube_4)
- NavMeshModifier (This has a nav mesh obstacle component)
If you set up your Unity scene to have these things and set up asset bundling, after you bundle just rename the bundle to your game name and drag it into your game folder.
C# script
Download Visual Studio and setup a new project using "Class Library (.Net Framework)".
Make a new C# script. In this file you will only need to add a new public class extending gamebase. For example:
public class ExampleGameName: GameBase {}
I highly recommend using dnSpy to look at the classes for the base casino games or looking at to understand how to do things.
Here are a few helpful things you should know:
void Start() {} This will run when the object gets instantiated.
public override
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: