MatchCreation Fails with Error "cannot encode params"

Hello,

I am working on a game where we use nk.MatchCreate (where nk is runtime.NakamaModule in go) to create match. but occasionally nk.MatchCreate fuction fails with error “cannot encode params” , but if we try multiple time using backoff.Retry it is working fine…

we are using

 nk.MatchCreate(ctx, "SitNGo", CreationData)

where

 CreationData := map[string]interface{}{
	"CashTableConfig": tableConfig,
}

tableConfig is pointer type of

TableConfig struct {
houseId                            string
tickRate                           int64
isRoundTimeBound                   bool
roundMaxTimeSecs                   time.Duration
tableEndTime                       time.Time
blinds                             *Blinds

}

type Blinds struct {
big   Blind
small Blind

}

i think like it can be because of fields are un exported in struct TableConfig? then the error should come all the time right ? but why the creation fails only in some cases?

any help would be really appreciated,
Junaid

You need to make sure any custom parameter types have exported fields (eg. houseId -> HouseId) and the types are registered with gob (eg. gob.Register(&TableConfig{})). This is part of the process that the RPC subsystem uses to send match parameters to the Authoritative Match subsystem.

We’ll investigate the error output and consistency for the next server release. :+1:

1 Like

This is off topic, and I see you’ve created a new thread here. We’ll continue discussion there.