Skip to content

heroiclabs/hiro

Repository files navigation

Hiro

The server interface for the Hiro game framework.

Hiro is a client and server framework built on top of Nakama server to rapidly build high performance, flexible, and composable gameplay systems like Achievements, Energies, Event Leaderboards, and much more.

The code is divided into a Go package of interfaces and a C# DLL which is packaged with utilities (such as UnityPurchasing, Unity Mobile Notifications, etc) for Unity Engine.

This repository maintains the public interfaces which make it easy to use the library from inside a Nakama game server project to extend and build additional gameplay systems.

To learn more about Hiro and integrate it into your Unity game project, have a look at these resources:

Reach out to Heroic Labs for more information about how to license Hiro as a developer or as part of a game studio.

Setup

  1. Set up the Go toolchain.

  2. Set up your Nakama project with Go.

  3. Add Hiro to your project as a dependency:

    go get "github.com/heroiclabs/hiro@latest"
  4. Sign up to the Heroic Cloud and contact us to obtain licenses to Hiro.

  5. Download and unzip the package. Add "hiro.bin" to your codebase.

  6. Follow the usage instructions for how to get started.

Usage

The game framework initializes and returns the configured gameplay systems with Init:

func InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, initializer runtime.Initializer) error {
	systems, err := hiro.Init(ctx, logger, nk, initializer, "hiro.bin", "LicenseKey"
		hiro.WithEconomySystem("economy.json", true),
		hiro.WithEnergySystem("energy.json", true),
		hiro.WithInventorySystem("inventory.json", true))
	if err != nil {
		return err
	}

	// systems.GetEnergySystem().Get(...)
	// ...

	return nil
}

For examples on how to write data definitions for the gameplay systems have a look at the documentation.

License

This codebase is licensed under the Apache-2 License.