This Unity package contains the Nakama Client implementation for the Turn Based Strategy Framework. The Framework is a flexible tool for developing turn-based strategy games in Unity and is available in the Unity Asset Store. Additionally, this package is designed to work with a custom Nakama server, which is detailed in the GitHub repository at TBSF Nakama Server.
- Unity version 2020.3 or higher.
- Turn Based Strategy Framework version 3.0 or higher.
- Git version control system
- Nakama Unity SDK version 3.10.1 or higher.
- If you haven't already, purchase the Turn Based Strategy Framework from the Unity Asset Store.
- Import it into your Unity project following the Asset Store's instructions.
This package requires the Nakama Unity SDK. Follow these steps to install the Nakama Unity SDK in your Unity project:
-
Open Your Unity Project:
- Make sure you have your Unity project open and that it meets the minimum version requirements.
-
Unity Package Manager (UPM):
- Go to
Window
>Package Manager
in Unity.
- Go to
-
Add Package from Git URL:
- Click the '+' button at the top-left corner of the Package Manager window.
- Select
Add package from git URL
.
-
Enter the Git URL of the Nakama Unity SDK:
- Enter the Git URL for the Nakama Unity SDK:
https://github.com/heroiclabs/nakama-unity.git?path=/Packages/Nakama#v3.10.1
- Enter the Git URL for the Nakama Unity SDK:
-
Install the Package:
- Click 'Add' to install the Nakama Unity SDK into your project.
-
Verify Installation:
- After installation, the Nakama Unity SDK should appear in the list of packages in the Package Manager. Ensure that it's correctly installed and there are no errors.
After setting up the Nakama Unity SDK, you can proceed with installing the TBSF Nakama Client:
-
Navigate to Package Manager:
- In your Unity project, open the Package Manager from
Window
>Package Manager
.
- In your Unity project, open the Package Manager from
-
Add Package from Git URL:
- Click the '+' button at the top-left corner of the Package Manager.
- Select
Add package from git URL
.
-
Enter the TBSF Nakama Client URL:
- Input the Git URL for the TBSF Nakama Client package:
https://github.com/mzetkowski/tbsf-nakama-client.git?path=/Packages/com.crookedhead.tbsf.nakama
- Input the Git URL for the TBSF Nakama Client package:
-
Install the Package:
- Click 'Add' to install. This action will download and add the TBSF Nakama Client to your Unity project.
-
Check for Successful Installation:
- Ensure that the TBSF Nakama Client appears in the Package Manager and that there are no errors.
The TBSF Nakama Client
package includes a single script named NakamaConnection
. This script is an implementation of the abstract NetworkConnection
class found in the Turn Based Strategy Framework. The NakamaConnection
class is specifically tailored to work with a custom Nakama server, which is also available on GitHub at TBSF Nakama Server. Detailed instructions for deploying this server can be found in its repository.
Within the Turn Based Strategy Framework, there are several demo scenes located in the Assets/Examples
folder. Each of these scenes has a multiplayer counterpart designed for network play. To utilize NakamaConnection
in these scenes, follow these steps:
-
Create a New GameObject: In your desired scene, create a new GameObject.
-
Attach NakamaConnection Script: Attach the
NakamaConnection
script to this newly created GameObject. -
Configure Server Address: Enter the address of your Nakama server in the
host
field of theNakamaConnection
script. -
Assign CellGrid GameObject: Assign the CellGrid GameObject from the scene to the
CellGrid
field of theNakamaConnection
script. -
Set Up Network GUI: Locate the
NetworkGUI
GameObject in your scene. Assign the GameObject with theNakamaConnection
script to theNetworkConnection
field in theNetworkGUI
. -
Set Up CellGrid: The multiplayer scene includes game end conditions for host or player disconnections. Configure these by assigning the
NakamaConnection
script toNetworkConnection
fields on thePlayerDisconnectedCondition
andHostDisconnectedCondition
attached to theCellGrid
GameObject.
This setup integrates the NakamaConnection
with your chosen scene. For more in-depth details and guidelines, refer to the TBSF documentation that accompanies the Framework.
In case you encounter issues during the installation or operation of the TBSF Nakama Client, this section provides guidance to resolve common problems.
-
Missing Nakama SDK
- Error Message:
error CS0246: The type or namespace name 'Nakama' could not be found (are you missing a using directive or an assembly reference?)
- Cause: The Nakama Unity SDK is not installed in your Unity project.
- Solution: To install the Nakama Unity SDK, follow the installation instructions provided in this README.
- Error Message:
-
Missing Turn Based Strategy Framework (TBSF)
- Error Message:
error CS0246: The type or namespace name 'NetworkConnection' could not be found (are you missing a using directive or an assembly reference?)
- Cause: The Turn Based Strategy Framework is not imported into your project.
- Solution: Ensure the TBSF is properly installed by following these installation instructions.
- Error Message:
-
Incorrect Git Revision
- Error Message:
Cannot perform upm operation: Unable to add package [https://github.com/mzetkowski/tbsf-nakama-client.git?path=/Packages/tbsf-nakama-client#<branch-name>]: Could not clone [https://github.com/mzetkowski/tbsf-nakama-client.git]. Make sure [<branch-name>] is a valid branch name, tag, or full commit hash on the remote registry.
- Cause: The specified revision in the package URL is incorrect or does not exist.
- Solution: Verify and provide a valid package URL. Replace
<branch-name>
with a valid branch name, tag, or full commit hash. A list of available branches and tags can be found on the main page of the repository.
- Error Message:
-
Missing Git version control system
- Error Message:
Error adding package: [https://github.com/mzetkowski/tbsf-nakama-client.git?path=/Packages/tbsf-nakama-client#<branch-name>]. Unable to add package [https://github.com/mzetkowski/tbsf-nakama-client.git?path=/Packages/tbsf-nakama-client#<branch-name>]: No 'git' executable was found. Please install Git on your system then restart Unity and Unity Hub
- Cause: Git version control system is not installed on your machine
- Solution: Install Git and restart Unity
- Error Message:
If you have any questions, feedback, or need assistance with the TBSF Nakama Client, feel free to reach out. You can contact me directly via email at crookedhead@outlook.com for specific queries or suggestions. Additionally, for broader community support and discussions, join the TBSF Discord server: TBSF Discord. This platform is ideal for connecting with other TBSF users, sharing experiences, and getting help from the community.
This package uses the Nakama Unity SDK by Heroic Labs. Nakama is an open-source server for social and realtime games.
The Nakama Unity SDK is used under the terms of the Apache License 2.0. A copy of the Apache License 2.0 can be found in the LICENSE-Nakama.md
file in this repository.
This project is not endorsed by or affiliated with Heroic Labs. "Nakama" is a trademark of Heroic Labs and is used here for descriptive purposes only. This project's use of the "Nakama" name is not intended to imply any affiliation with or endorsement by Heroic Labs.