Skip to content

Commit 07b3692

Browse files
authored
Post launch refactor (#13)
* Refactor UnityNakamaFriends * Refactor UnityNakamaLeaderboards * Refactor UnityNakamaCloudSave * Refactor UnityNakamaTournaments * Refactor UnityNakamaGroups * Update Nakama + implement join required for Tournaments * Fix Tournaments typo * Update to latest Unity release * Update to use latest Nakama Asset Store version * Workaround for socket closing and signout bug * Change how Nakama is being pulled in for Asset Store distribution
1 parent ae32b67 commit 07b3692

File tree

2,428 files changed

+6114
-5717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,428 files changed

+6114
-5717
lines changed

Nakama/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM heroiclabs/nakama-pluginbuilder:3.31.0 AS builder
1+
FROM heroiclabs/nakama-pluginbuilder:3.32.0 AS builder
22

33
ENV GO111MODULE on
44
ENV CGO_ENABLED 1
@@ -8,7 +8,7 @@ COPY . .
88

99
RUN go build --trimpath --mod=vendor --buildmode=plugin -o ./backend.so
1010

11-
FROM heroiclabs/nakama:3.31.0
11+
FROM heroiclabs/nakama:3.32.0
1212

1313
COPY --from=builder /backend/backend.so /nakama/data/modules
1414
COPY --from=builder /backend/local.yml /nakama/data/

Nakama/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ module heroiclabs/sample-templates
22

33
go 1.25.0
44

5-
require github.com/heroiclabs/nakama-common v1.38.0
5+
require github.com/heroiclabs/nakama-common v1.42.0
66

7-
require google.golang.org/protobuf v1.36.6 // indirect
7+
require google.golang.org/protobuf v1.36.8 // indirect

Nakama/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
22
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
3-
github.com/heroiclabs/nakama-common v1.38.0 h1:5ukM0QZkUDGEMzqaLN9uDSHh3nJRJpSW7tcc0ljI6rM=
4-
github.com/heroiclabs/nakama-common v1.38.0/go.mod h1:i5RyJ1I2Yge/K6DSwhXYq6CWGHFKluJXuCZ+8XDhDkc=
3+
github.com/heroiclabs/nakama-common v1.42.0 h1:Y+WbJ35YuYfTRBxNcnSYk8EjuG5ZIF2aPaOmkBGPzpI=
4+
github.com/heroiclabs/nakama-common v1.42.0/go.mod h1:E4yiMQmn8KHQ77WqBLVUfazdiPnwFYWqUrfGOrqOXk8=
55
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
66
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
7-
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
8-
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
7+
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
8+
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=

Nakama/main.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,32 +84,28 @@ func InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runti
8484
// Handle error.
8585
}
8686

87-
err := createTournament(ctx, logger, nk, "daily-dash", "Daily Dash", "Dash past your opponents for high scores and big rewards!", false)
87+
err := createTournament(ctx, logger, nk, "daily-dash", "0 12 * * *", "Daily Dash", "Dash past your opponents for high scores and big rewards!", 86400, 0, 1, false)
8888
if err != nil {
8989
// Handle error.
9090
}
9191

92-
err = createTournament(ctx, logger, nk, "limited-dash", "Limited Dash", "Limited spaces available, join now!", true)
92+
err = createTournament(ctx, logger, nk, "limited-dash", "0 * * * *", "Limited Dash", "Limited spaces available, join now!", 3600, 10000, 3, true)
9393
if err != nil {
9494
// Handle error.
9595
}
9696

9797
return nil
9898
}
9999

100-
func createTournament(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule, id, title, description string, joinRequired bool) error {
101-
authoritative := false // true by default
102-
sortOrder := "desc" // one of: "desc", "asc"
103-
operator := "best" // one of: "best", "set", "incr"
104-
resetSchedule := "0 12 * * *" // noon UTC each day
100+
func createTournament(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule, id, resetSchedule, title, description string, duration, maxSize, maxNumScore int, joinRequired bool) error {
101+
authoritative := false // true by default
102+
sortOrder := "desc" // one of: "desc", "asc"
103+
operator := "best" // one of: "best", "set", "incr"
105104
metadata := map[string]interface{}{}
106105
category := 1
107106
startTime := int(time.Now().UTC().Unix()) // start now
108-
endTime := 0 // never end, repeat the tournament each day forever
109-
duration := 86400 // in seconds
110-
maxSize := 10000 // first 10,000 players who join
111-
maxNumScore := 3 // each player can have 3 attempts to score
112-
enableRanks := false // ranks are disabled
107+
endTime := 0 // never end, repeat the tournament forever
108+
enableRanks := true // ranks are enabled
113109
err := nk.TournamentCreate(ctx, id, authoritative, sortOrder, operator, resetSchedule, metadata, title, description, category, startTime, endTime, duration, maxSize, maxNumScore, joinRequired, enableRanks)
114110
if err != nil {
115111
logger.Debug("unable to create tournament: %q", err.Error())

Nakama/vendor/github.com/heroiclabs/nakama-common/api/api.pb.go

Lines changed: 392 additions & 381 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Nakama/vendor/github.com/heroiclabs/nakama-common/api/api.proto

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Nakama/vendor/github.com/heroiclabs/nakama-common/rtapi/realtime.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Nakama/vendor/github.com/heroiclabs/nakama-common/runtime/config.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)