~nromdotcom/gemif

9b7a8a567d14485941e0fa82d75b91b02d15b5e6 — Norm MacLennan 11 months ago f1ef4d5
try switching to protobuf for state tokens
8 files changed, 281 insertions(+), 27 deletions(-)

M Makefile
M cmd/gemif/main.go
M go.mod
M go.sum
R pkg/gamemanager/{dataloader.go => config.go}
M pkg/gamemanager/gamemanager.go
A pkg/gamemanager/statetoken.pb.go
A pkg/gamemanager/statetoken.proto
M Makefile => Makefile +3 -0
@@ 48,6 48,9 @@ clean: ## Delete any compiled artifacts
generate: ## Generate bindata from static files
	go generate gemif/cmd/gemif

protobuf: ## until i can reliably re-generate this, separate it from generate
	protoc -I pkg/ --go_out=pkg/ pkg/gamemanager/statetoken.proto

##@ Test
test: ## Run tests
	go test $(shell go list ./...) -coverprofile=coverage.out

M cmd/gemif/main.go => cmd/gemif/main.go +6 -1
@@ 17,7 17,12 @@ var (
)

func main() {
	gameMgr, err := gamemanager.New("./stories")
	config, loaderErr := gamemanager.NewConfig("./stories")
	if loaderErr != nil {
		fmt.Printf("Error loading stories! %s", loaderErr)
	}

	gameMgr, err := gamemanager.NewGameManager(config)
	if err != nil {
		fmt.Printf("Error loading game! %s", err)
		os.Exit(1)

M go.mod => go.mod +1 -0
@@ 6,5 6,6 @@ require (
	github.com/markbates/pkger v0.17.1
	github.com/pitr/gig v0.9.7
	github.com/stretchr/testify v1.4.0
	google.golang.org/protobuf v1.25.0
	gopkg.in/yaml.v2 v2.4.0
)

M go.sum => go.sum +65 -0
@@ 1,8 1,31 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/gobuffalo/here v0.6.0 h1:hYrd0a6gDmWxBM4TnrGw8mQg24iSVoIkHEk7FodQcBI=
github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=


@@ 17,6 40,7 @@ github.com/pitr/gig v0.9.7 h1:VMwGTynX2LHppwOJTlEeUtIZnPOG/iwOMWvDZ61/RXQ=
github.com/pitr/gig v0.9.7/go.mod h1:YHUShtPtgG/zAsdlVG2HyzfGA1EKB+QBVFKxJ2qzxhU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=


@@ 25,6 49,45 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.1.0 h1:RZqt0yGBsps8NGvLSGW804QQqCUYYLsaOjTVHy1Ocw4=
github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=


@@ 33,3 96,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

R pkg/gamemanager/dataloader.go => pkg/gamemanager/config.go +8 -6
@@ 9,7 9,7 @@ import (
	"gopkg.in/yaml.v2"
)

type config struct {
type Config struct {
	Stories map[string]Story `yaml:"stories" json:"stories"`
}



@@ 27,7 27,7 @@ type StoryMetadata struct {
	Author      string `yaml:"author"`
}

func (c *config) getStories(root string) error {
func NewConfig(root string) (Config, error) {
	var files []string

	err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {


@@ 42,23 42,25 @@ func (c *config) getStories(root string) error {
		panic(err)
	}

	c.Stories = make(map[string]Story)
	c := Config{
		Stories: map[string]Story{},
	}

	for _, file := range files {
		yamlFile, err := ioutil.ReadFile(file)
		if err != nil {
			return fmt.Errorf("couldn't load story: %w", err)
			return c, fmt.Errorf("couldn't load story: %w", err)
		}

		var thisStory *Story
		if err := yaml.Unmarshal(yamlFile, &thisStory); err != nil {
			fmt.Println(err.Error())

			return fmt.Errorf("couldn't load story: %w", err)
			return c, fmt.Errorf("couldn't load story: %w", err)
		}

		c.Stories[thisStory.Metadata.ID] = *thisStory
	}

	return nil
	return c, nil
}

M pkg/gamemanager/gamemanager.go => pkg/gamemanager/gamemanager.go +26 -20
@@ 2,14 2,15 @@ package gamemanager

import (
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"

	"google.golang.org/protobuf/proto"
)

// GameManager contains configuration info about stories and managed GameState objects.
type GameManager struct {
	config config
	Config Config
}

// SpeculativeState is used to provide "what if" GameStates for next available actions.


@@ 25,13 26,8 @@ var (
	ErrExitNotFound = errors.New("exit not found")
)

// New creates a new GameManager, loading all stories from a given path.
func New(path string) (*GameManager, error) {
	var config config
	if err := config.getStories(path); err != nil {
		return nil, fmt.Errorf("unable to load game: %w", err)
	}

// NewGameManager creates a new GameManager, using Stories in the Config.
func NewGameManager(config Config) (*GameManager, error) {
	return &GameManager{config}, nil
}



@@ 39,18 35,18 @@ func New(path string) (*GameManager, error) {
func (gm *GameManager) StartGame(storyID string) (GameState, error) {
	return GameState{
		StoryID:     storyID,
		CurrentRoom: gm.config.Stories[storyID].Rooms[0].ID,
		CurrentRoom: gm.Config.Stories[storyID].Rooms[0].ID,
		Conditions:  []string{},
	}, nil
}

// GetStories lists all StoryMetadata for stories tracked by GameManager.
func (gm *GameManager) GetStories() []StoryMetadata {
	metadata := make([]StoryMetadata, len(gm.config.Stories))
	metadata := make([]StoryMetadata, len(gm.Config.Stories))

	i := 0

	for _, e := range gm.config.Stories {
	for _, e := range gm.Config.Stories {
		metadata[i] = e.Metadata
		i++
	}


@@ 60,9 56,9 @@ func (gm *GameManager) GetStories() []StoryMetadata {

// GetRoomByID finds Room information based on room and story IDs.
func (gm *GameManager) GetRoomByID(storyID string, roomID string) (Room, error) {
	for i := range gm.config.Stories[storyID].Rooms {
		if gm.config.Stories[storyID].Rooms[i].ID == roomID {
			return gm.config.Stories[storyID].Rooms[i], nil
	for _, r := range gm.Config.Stories[storyID].Rooms {
		if r.ID == roomID {
			return r, nil
		}
	}



@@ 104,22 100,32 @@ func (gm *GameManager) DeserializeState(stateToken string) (GameState, error) {
		return GameState{}, fmt.Errorf("couldn't decode state token: %w", decodeErr)
	}

	var gameState GameState
	if unmarshallErr := json.Unmarshal(decodedString, &gameState); unmarshallErr != nil {
	var st StateToken
	if unmarshallErr := proto.Unmarshal(decodedString, &st); unmarshallErr != nil {
		return GameState{}, fmt.Errorf("failed to load state: %w", unmarshallErr)
	}

	return gameState, nil
	return GameState{
		StoryID:     st.StoryID,
		CurrentRoom: st.CurrentRoom,
		Conditions:  st.Conditions,
	}, nil
}

// SerializeState generates a stateToken based on the given GameState.
func (gm *GameManager) SerializeState(gameState GameState) (string, error) {
	jsonBytes, marshallErr := json.Marshal(gameState)
	st := StateToken{
		StoryID:     gameState.StoryID,
		CurrentRoom: gameState.CurrentRoom,
		Conditions:  gameState.Conditions,
	}

	protoBytes, marshallErr := proto.Marshal(&st)
	if marshallErr != nil {
		return "", fmt.Errorf("failed to save state: %w", marshallErr)
	}

	return base64.StdEncoding.EncodeToString(jsonBytes), nil
	return base64.StdEncoding.EncodeToString(protoBytes), nil
}

// ConstructSpeculativeStates makes a SpeculativeState from the active GameState and actions available in currentRoom.

A pkg/gamemanager/statetoken.pb.go => pkg/gamemanager/statetoken.pb.go +163 -0
@@ 0,0 1,163 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.25.0-devel
// 	protoc        v3.14.0
// source: gamemanager/statetoken.proto

package gamemanager

import (
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	sync "sync"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

type StateToken struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	StoryID     string   `protobuf:"bytes,1,opt,name=StoryID,proto3" json:"StoryID,omitempty"`
	CurrentRoom string   `protobuf:"bytes,2,opt,name=CurrentRoom,proto3" json:"CurrentRoom,omitempty"`
	Conditions  []string `protobuf:"bytes,3,rep,name=Conditions,proto3" json:"Conditions,omitempty"`
}

func (x *StateToken) Reset() {
	*x = StateToken{}
	if protoimpl.UnsafeEnabled {
		mi := &file_gamemanager_statetoken_proto_msgTypes[0]
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		ms.StoreMessageInfo(mi)
	}
}

func (x *StateToken) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*StateToken) ProtoMessage() {}

func (x *StateToken) ProtoReflect() protoreflect.Message {
	mi := &file_gamemanager_statetoken_proto_msgTypes[0]
	if protoimpl.UnsafeEnabled && x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use StateToken.ProtoReflect.Descriptor instead.
func (*StateToken) Descriptor() ([]byte, []int) {
	return file_gamemanager_statetoken_proto_rawDescGZIP(), []int{0}
}

func (x *StateToken) GetStoryID() string {
	if x != nil {
		return x.StoryID
	}
	return ""
}

func (x *StateToken) GetCurrentRoom() string {
	if x != nil {
		return x.CurrentRoom
	}
	return ""
}

func (x *StateToken) GetConditions() []string {
	if x != nil {
		return x.Conditions
	}
	return nil
}

var File_gamemanager_statetoken_proto protoreflect.FileDescriptor

var file_gamemanager_statetoken_proto_rawDesc = []byte{
	0x0a, 0x1c, 0x67, 0x61, 0x6d, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2f, 0x73, 0x74,
	0x61, 0x74, 0x65, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b,
	0x67, 0x61, 0x6d, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x22, 0x68, 0x0a, 0x0a, 0x53,
	0x74, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x74, 0x6f,
	0x72, 0x79, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x74, 0x6f, 0x72,
	0x79, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x6f,
	0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e,
	0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69,
	0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x6f, 0x6e, 0x64, 0x69,
	0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x0d, 0x5a, 0x0b, 0x67, 0x61, 0x6d, 0x65, 0x6d, 0x61, 0x6e,
	0x61, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}

var (
	file_gamemanager_statetoken_proto_rawDescOnce sync.Once
	file_gamemanager_statetoken_proto_rawDescData = file_gamemanager_statetoken_proto_rawDesc
)

func file_gamemanager_statetoken_proto_rawDescGZIP() []byte {
	file_gamemanager_statetoken_proto_rawDescOnce.Do(func() {
		file_gamemanager_statetoken_proto_rawDescData = protoimpl.X.CompressGZIP(file_gamemanager_statetoken_proto_rawDescData)
	})
	return file_gamemanager_statetoken_proto_rawDescData
}

var file_gamemanager_statetoken_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_gamemanager_statetoken_proto_goTypes = []interface{}{
	(*StateToken)(nil), // 0: gamemanager.StateToken
}
var file_gamemanager_statetoken_proto_depIdxs = []int32{
	0, // [0:0] is the sub-list for method output_type
	0, // [0:0] is the sub-list for method input_type
	0, // [0:0] is the sub-list for extension type_name
	0, // [0:0] is the sub-list for extension extendee
	0, // [0:0] is the sub-list for field type_name
}

func init() { file_gamemanager_statetoken_proto_init() }
func file_gamemanager_statetoken_proto_init() {
	if File_gamemanager_statetoken_proto != nil {
		return
	}
	if !protoimpl.UnsafeEnabled {
		file_gamemanager_statetoken_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
			switch v := v.(*StateToken); i {
			case 0:
				return &v.state
			case 1:
				return &v.sizeCache
			case 2:
				return &v.unknownFields
			default:
				return nil
			}
		}
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: file_gamemanager_statetoken_proto_rawDesc,
			NumEnums:      0,
			NumMessages:   1,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_gamemanager_statetoken_proto_goTypes,
		DependencyIndexes: file_gamemanager_statetoken_proto_depIdxs,
		MessageInfos:      file_gamemanager_statetoken_proto_msgTypes,
	}.Build()
	File_gamemanager_statetoken_proto = out.File
	file_gamemanager_statetoken_proto_rawDesc = nil
	file_gamemanager_statetoken_proto_goTypes = nil
	file_gamemanager_statetoken_proto_depIdxs = nil
}

A pkg/gamemanager/statetoken.proto => pkg/gamemanager/statetoken.proto +9 -0
@@ 0,0 1,9 @@
syntax = "proto3";
package gamemanager;
option go_package = "gamemanager";

message StateToken {
  string StoryID = 1;
  string CurrentRoom = 2;
  repeated string Conditions = 3;
}
\ No newline at end of file