Installing Hiro #
Prerequisites #
Before proceeding ensure that you have:
- Installed Nakama server
- Downloaded and installed Unity or Unreal
- Signed up for Heroic Cloud
- Set up the Go toolchain
- Set up your Nakama project with Go
Server #
Add Hiro to your project as a dependency using go get
:
go get "github.com/heroiclabs/hiro@latest"
Client #
The client is available from Heroic Labs. Contact us to request access.
Unity #
The Hiro.unitypackage
contains all source code and DLL dependencies required in the client code.
After downloading the file:
- Drag or import it into your Unity project
- Set the editor scripting runtime version to .NET 4.6 (from the Edit -> Project Settings -> Player -> Configuration menu).
Unreal #
The Hiro.zip
file contains all source code and dependencies required in the client code.
After downloading the file, add the contents to your Unreal project’s Plugins
folder:
- Open your Unreal project
- Navigate to the
Plugins
folder, if one doesn’t exist, create it - Extract the contents of the
Hiro.zip
file into thePlugins
folder- Optionally, place the Hiro files into your Unreal Engine
Plugins
folder to use the plugin across multiple projects
- Optionally, place the Hiro files into your Unreal Engine
- Restart Unreal Engine
Hiro deterministic startup #
A key philosophy of Hiro is its opinionated and structured method for bootstrapping your game using a deterministic startup. This is achieved by inheriting from the GdkCoordinator
and sequentially configuring and adding the required game Systems.
Hiro provides several different Systems out-of-the-box, such as the NakamaSystem
(which handles the connection to Nakama and keeps a reference to the Client, Session and Socket objects) and the EconomySystem
(which handles all aspects of in-game economy including both soft and hard currency purchases).
Configuration #
In the Scene Hierarchy, create a new Game Object and call it
GameCoordinator
.Attach a new C# script to the object and call it
GameCoordinator
.Override the
CreateSystems
method ofGameCoordinator
to configure and add individualSystem
instances to aSystems
object and return it:
|
|
These individual systems will be initialized in the order you specify, enabling you to have full control over the order of initialization.