From fb43cb1fb7097c0383c10ac7194893fc3cfeb1b0 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sun, 16 Aug 2020 18:53:39 -0400 Subject: [PATCH 1/6] Generate basic world & recieve data on client --- ...t.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.md5 | 3 + ....png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex | Bin 0 -> 154 bytes ...s.png-d6f949232ad65f7c5ac8611d6943aaf7.md5 | 3 + ....png-d6f949232ad65f7c5ac8611d6943aaf7.stex | Bin 0 -> 3461 bytes client/art/tiles/dirt.png | Bin 0 -> 108 bytes client/art/tiles/dirt.png.import | 34 ++++++++++++ client/art/tiles/grass.png | Bin 0 -> 5029 bytes client/art/tiles/grass.png.import | 34 ++++++++++++ client/nodes/tileset.tres | 43 +++++++++++++++ client/scenes/World.tscn | 11 ++++ client/scripts/menus/login_form.gd | 2 +- client/scripts/singletons/ServerConnection.gd | 13 +++++ client/scripts/singletons/WorldManager.gd | 15 +++++ server/plugin/control/control.go | 33 ++++++++--- server/plugin/gamemap/gamemap.go | 52 ++++++++++++++++++ server/plugin/go.sum | 2 + 16 files changed, 237 insertions(+), 8 deletions(-) create mode 100644 client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.md5 create mode 100644 client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex create mode 100644 client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.md5 create mode 100644 client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.stex create mode 100644 client/art/tiles/dirt.png create mode 100644 client/art/tiles/dirt.png.import create mode 100644 client/art/tiles/grass.png create mode 100644 client/art/tiles/grass.png.import create mode 100644 client/nodes/tileset.tres create mode 100644 client/scenes/World.tscn create mode 100644 client/scripts/singletons/WorldManager.gd create mode 100644 server/plugin/gamemap/gamemap.go diff --git a/client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.md5 b/client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.md5 new file mode 100644 index 0000000..d3c727a --- /dev/null +++ b/client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.md5 @@ -0,0 +1,3 @@ +source_md5="ea3da320528c7d54640506628b12b80c" +dest_md5="f8c65d4e4cd80d79c48ff0c014cf0377" + diff --git a/client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex b/client/.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex new file mode 100644 index 0000000000000000000000000000000000000000..e688d241c774845eabe5806d2f29bf5575239913 GIT binary patch literal 154 zcmZ>F2@X+UU|;}Y79eI|5MXBnl662F;ODN;2_$&Aq_}`wUQZ8~ARw&(!W?Wsvbd`1 z3y@+g4sv&5Sa(k5C6Hs{>Eaj?(fanBAtQqU$B_femt`#z`mkS2Qb(M5=d1F1G3(jI dKxIgvK}FI)lF9CkUH?gtsHdx+%Q~loCIEh%A&CG0 literal 0 HcmV?d00001 diff --git a/client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.md5 b/client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.md5 new file mode 100644 index 0000000..675b906 --- /dev/null +++ b/client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.md5 @@ -0,0 +1,3 @@ +source_md5="b38dac28f777cd24a94ae764cf60780a" +dest_md5="8568362e706ffbdddbdcb895eaad16c8" + diff --git a/client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.stex b/client/.import/grass.png-d6f949232ad65f7c5ac8611d6943aaf7.stex new file mode 100644 index 0000000000000000000000000000000000000000..3f1b88d1b6e68a707aea54bae0df8c51566bc034 GIT binary patch literal 3461 zcmY+He>~Is9>=%q$CPTiog?`*=^iEIN5B0VMJknxm<;ptpb1CBv9&qn#0jnL(WEjZ z9cs-YGsmxqj>%*WW+CJ^TMRR7_TzrH&VAf__s3`Zd>`M>&-e5FdcEi2=6f*|3<5m? z{pX_t0lJ{rts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6j)LIY|+V>*uJAml)Kn)`NokAlQPHONb$=|B}~ zdDOHmW6Uh!`V0HfK%Bg8^#KGxR42o-Q;u5HoaN( zh>fL0GegbX?F)}2N%;@{r&`pTZ5OX}zU_CJ&9Du{CXNC%A~0HWruWT2)oJ@ow?UO^jyH`orYCL0ZqEZy**&!G|A_Ih3d8>r%-CE}Y1o|%%Frys^fj${XGQkH0xbp_8 W@3GG*B=ElpbjJOHTg8dc8~+A0I!dJg literal 0 HcmV?d00001 diff --git a/client/art/tiles/dirt.png b/client/art/tiles/dirt.png new file mode 100644 index 0000000000000000000000000000000000000000..b85005831dcfece5ff9dd5a8e8b9618f32e79aba GIT binary patch literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzV^0^ykO=p;7aRo{7+4q_gEW3N#c%!=G=A3oC$1gE3GO=(7C^$4g86R{Ddg|;SiY_}_1k}#p>FVdQ&MBb@0CkHU AnE(I) literal 0 HcmV?d00001 diff --git a/client/art/tiles/dirt.png.import b/client/art/tiles/dirt.png.import new file mode 100644 index 0000000..16e9e0a --- /dev/null +++ b/client/art/tiles/dirt.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/tiles/dirt.png" +dest_files=[ "res://.import/dirt.png-2d96e51b4345f83ec0fb0c1ed8bf2b89.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/client/art/tiles/grass.png b/client/art/tiles/grass.png new file mode 100644 index 0000000000000000000000000000000000000000..7bae1a10ae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;RwtkXX zHiTb>t$m*bJ%-lY!>qDu2uga>u# NakamaException: var result : NakamaException = null @@ -36,6 +42,7 @@ func connect_to_server_async() -> NakamaException: _socket = Nakama.create_socket_from(_client) var result : NakamaAsyncResult = yield(_socket.connect_async(_session), "completed") if not result.is_exception(): + _socket.connect("received_match_state", self, "_on_socket_received_match_state") _socket.connect("closed", self, "_on_socket_closed") return null return result.exception @@ -60,3 +67,9 @@ func join_world_async() -> Dictionary: func _on_socket_closed(): _socket = null + +func _on_socket_received_match_state(match_state: NakamaRTAPI.MatchData): + match match_state.op_code: + OPCODE.tile_update: + emit_signal("tile_update", JSON.parse(match_state.data).result) + diff --git a/client/scripts/singletons/WorldManager.gd b/client/scripts/singletons/WorldManager.gd new file mode 100644 index 0000000..322f467 --- /dev/null +++ b/client/scripts/singletons/WorldManager.gd @@ -0,0 +1,15 @@ +extends Node + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + ServerConnection.connect("tile_update", self, "on_tile_update") + yield(ServerConnection.join_world_async(), "completed") + +func on_tile_update(tile_data): + print(tile_data) diff --git a/server/plugin/control/control.go b/server/plugin/control/control.go index cd6dc87..73702e9 100644 --- a/server/plugin/control/control.go +++ b/server/plugin/control/control.go @@ -3,8 +3,14 @@ package control import ( "context" "database/sql" - "github.com/heroiclabs/nakama-common/runtime" + "github.com/josephbmanley/family/server/plugin/gamemap" +) + +type OpCode int64 + +const ( + OpCodeTileUpdate = 1 ) type Match struct{} @@ -12,20 +18,19 @@ type Match struct{} type MatchState struct { presences map[string]runtime.Presence inputs map[string]string - positions map[string]string - jumps map[string]string - colors map[string]string + positions map[string]map[string]int names map[string]string + worldMap *gamemap.WorldMap } func (m *Match) MatchInit(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, params map[string]interface{}) (interface{}, int, string) { + state := &MatchState{ presences: map[string]runtime.Presence{}, inputs: map[string]string{}, - positions: map[string]string{}, - jumps: map[string]string{}, - colors: map[string]string{}, + positions: map[string]map[string]int{}, names: map[string]string{}, + worldMap: gamemap.IntializeMap(), } tickRate := 10 label := "{\"name\": \"Game World\"}" @@ -47,6 +52,20 @@ func (m *Match) MatchJoin(ctx context.Context, logger runtime.Logger, db *sql.DB mState, _ := state.(*MatchState) for _, precense := range presences { mState.presences[precense.GetUserId()] = precense + + mState.positions[precense.GetUserId()] = map[string]int{"x": 16, "y": 16} + + mState.names[precense.GetUserId()] = "User" + + if regionData, err := mState.worldMap.GetJsonRegion(16-8, 16+8, 16-8, 16+8); err != nil { + logger.Error(err.Error()) + return mState + } else { + if sendErr := dispatcher.BroadcastMessage(OpCodeTileUpdate, regionData, []runtime.Presence{precense}, precense, true); sendErr != nil { + logger.Error(sendErr.Error()) + return mState + } + } } return mState } diff --git a/server/plugin/gamemap/gamemap.go b/server/plugin/gamemap/gamemap.go new file mode 100644 index 0000000..d76ca71 --- /dev/null +++ b/server/plugin/gamemap/gamemap.go @@ -0,0 +1,52 @@ +package gamemap + +import ( + "encoding/json" + "fmt" +) + +type WorldMap struct { + data [][]int + max_x int + max_y int +} + +func (m WorldMap) GetTile(x int, y int) (int, error) { + if x > m.max_x || y > m.max_y { + return -1, fmt.Errorf("Map out of bounds error: %d, %d", x, y) + } + return m.data[x][y], nil +} + +func (m WorldMap) GetJsonRegion(start_x, end_x, start_y, end_y int) ([]byte, error) { + regionMap := make(map[int]map[int]int) + for x := start_x; x < end_x; x++ { + + for y := start_y; y < end_y; y++ { + if result, err := m.GetTile(x, y); err != nil { + return nil, err + } else { + regionMap[x][y] = result + } + } + } + + jsonString, err := json.Marshal(regionMap) + return jsonString, err +} + +func IntializeMap() *WorldMap { + worldMap := new(WorldMap) + worldMap.max_x = 64 + worldMap.max_y = 64 + for x := 0; x < worldMap.max_x; x++ { + for y := 0; y < worldMap.max_y; y++ { + worldMap.data[x][y] = 0 + } + } + + // Add dot at top left for testing + worldMap.data[0][0] = 1 + + return worldMap +} diff --git a/server/plugin/go.sum b/server/plugin/go.sum index 2015c67..85aeb17 100644 --- a/server/plugin/go.sum +++ b/server/plugin/go.sum @@ -15,6 +15,7 @@ github.com/heroiclabs/nakama-common v1.5.1 h1:ViCm9AvYYdQOCSKEa34SuSQ80JyZOHl6OD github.com/heroiclabs/nakama-common v1.5.1/go.mod h1:nZAXHdeo4SyPlCyf7pU9rCVizxEhBF74gt7teDe/EaQ= github.com/heroiclabs/nakama-common v1.7.2 h1:FQedePGCorBl3tXW4Ro8+XLGbEDQfGrT5Tb07j1UaLc= github.com/josephbmanley/family v0.0.0-20200815220504-0d9d05943cef h1:6oijVkew6eKI1fGE+YMaxmiNlp/hkN9wDpStoid9/ZI= +github.com/josephbmanley/family v0.0.0-20200816202226-abfb0f428423 h1:ynsJFMYkfs3JspzvLCfmPGJwdKY/4QeX457U0+y4J1I= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 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= @@ -42,6 +43,7 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 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.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 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= From be346d52f3c13776dfc19736d1b217937d08f991 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sun, 16 Aug 2020 19:17:15 -0400 Subject: [PATCH 2/6] Hardcode map size --- server/plugin/gamemap/gamemap.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/plugin/gamemap/gamemap.go b/server/plugin/gamemap/gamemap.go index d76ca71..f714204 100644 --- a/server/plugin/gamemap/gamemap.go +++ b/server/plugin/gamemap/gamemap.go @@ -6,7 +6,7 @@ import ( ) type WorldMap struct { - data [][]int + data [64][64]int max_x int max_y int } @@ -39,6 +39,7 @@ func IntializeMap() *WorldMap { worldMap := new(WorldMap) worldMap.max_x = 64 worldMap.max_y = 64 + worldMap.data = [64][64]int{} for x := 0; x < worldMap.max_x; x++ { for y := 0; y < worldMap.max_y; y++ { worldMap.data[x][y] = 0 From 641da4ba5602bab75ccc863b9808e0c071e32670 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sun, 16 Aug 2020 19:42:35 -0400 Subject: [PATCH 3/6] Intialize regionMap --- server/plugin/gamemap/gamemap.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/plugin/gamemap/gamemap.go b/server/plugin/gamemap/gamemap.go index f714204..e2cc927 100644 --- a/server/plugin/gamemap/gamemap.go +++ b/server/plugin/gamemap/gamemap.go @@ -19,9 +19,9 @@ func (m WorldMap) GetTile(x int, y int) (int, error) { } func (m WorldMap) GetJsonRegion(start_x, end_x, start_y, end_y int) ([]byte, error) { - regionMap := make(map[int]map[int]int) + regionMap := map[int]map[int]int{} for x := start_x; x < end_x; x++ { - + regionMap[x] = map[int]int{} for y := start_y; y < end_y; y++ { if result, err := m.GetTile(x, y); err != nil { return nil, err From 1f12e916c301865387573d799d50e9260e831f4a Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sun, 16 Aug 2020 20:35:58 -0400 Subject: [PATCH 4/6] Valid state assertions pass --- server/plugin/control/control.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/server/plugin/control/control.go b/server/plugin/control/control.go index 73702e9..2eb9cc1 100644 --- a/server/plugin/control/control.go +++ b/server/plugin/control/control.go @@ -39,7 +39,11 @@ func (m *Match) MatchInit(ctx context.Context, logger runtime.Logger, db *sql.DB } func (m *Match) MatchJoinAttempt(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, presence runtime.Presence, metadata map[string]string) (interface{}, bool, string) { - mState, _ := state.(*MatchState) + mState, ok := state.(*MatchState) + if !ok { + logger.Error("Invalid match state on join attempt!") + return state, false, "Invalid match state!" + } if _, ok := mState.presences[presence.GetUserId()]; ok { return mState, false, "User already logged in." } else { @@ -49,7 +53,11 @@ func (m *Match) MatchJoinAttempt(ctx context.Context, logger runtime.Logger, db } func (m *Match) MatchJoin(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, presences []runtime.Presence) interface{} { - mState, _ := state.(*MatchState) + mState, ok := state.(*MatchState) + if !ok { + logger.Error("Invalid match state on join!") + return state, false, "Invalid match state!" + } for _, precense := range presences { mState.presences[precense.GetUserId()] = precense @@ -71,7 +79,11 @@ func (m *Match) MatchJoin(ctx context.Context, logger runtime.Logger, db *sql.DB } func (m *Match) MatchLeave(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, presences []runtime.Presence) interface{} { - mState, _ := state.(*MatchState) + mState, ok := state.(*MatchState) + if !ok { + logger.Error("Invalid match state on leave!") + return state + } for _, presence := range presences { delete(mState.presences, presence.GetUserId()) } From 336133d87524e1c1b03873efed12e5e840a88cc4 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sun, 16 Aug 2020 22:11:52 -0400 Subject: [PATCH 5/6] Cleanup plugin code --- server/plugin/control/control.go | 29 +++++++++++++++++++++++++---- server/plugin/gamemap/gamemap.go | 18 +++++++++++++++--- server/plugin/rpc/rpc.go | 15 ++++----------- 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/server/plugin/control/control.go b/server/plugin/control/control.go index 2eb9cc1..3aceab0 100644 --- a/server/plugin/control/control.go +++ b/server/plugin/control/control.go @@ -7,14 +7,21 @@ import ( "github.com/josephbmanley/family/server/plugin/gamemap" ) +// OpCode represents a enum for valid OpCodes +// used by the match logic type OpCode int64 const ( + // OpCodeTileUpdate is used for tile updates OpCodeTileUpdate = 1 ) +// Match is the object registered +// as a runtime.Match interface type Match struct{} +// MatchState holds information that is passed between +// Nakama match methods type MatchState struct { presences map[string]runtime.Presence inputs map[string]string @@ -23,6 +30,7 @@ type MatchState struct { worldMap *gamemap.WorldMap } +// MatchInit is called when a new match is created func (m *Match) MatchInit(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, params map[string]interface{}) (interface{}, int, string) { state := &MatchState{ @@ -38,12 +46,16 @@ func (m *Match) MatchInit(ctx context.Context, logger runtime.Logger, db *sql.DB return state, tickRate, label } +// MatchJoinAttempt is called when a player tried to join a match +// and validates their attempt func (m *Match) MatchJoinAttempt(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, presence runtime.Presence, metadata map[string]string) (interface{}, bool, string) { mState, ok := state.(*MatchState) if !ok { logger.Error("Invalid match state on join attempt!") return state, false, "Invalid match state!" } + + // Validate user is not already connected if _, ok := mState.presences[presence.GetUserId()]; ok { return mState, false, "User already logged in." } else { @@ -52,32 +64,39 @@ func (m *Match) MatchJoinAttempt(ctx context.Context, logger runtime.Logger, db } +// MatchJoin is called when a player successfully joins the match func (m *Match) MatchJoin(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, presences []runtime.Presence) interface{} { mState, ok := state.(*MatchState) if !ok { logger.Error("Invalid match state on join!") - return state, false, "Invalid match state!" + return state } + for _, precense := range presences { + + // Add presence to map mState.presences[precense.GetUserId()] = precense + // Set player spawn pos mState.positions[precense.GetUserId()] = map[string]int{"x": 16, "y": 16} mState.names[precense.GetUserId()] = "User" - if regionData, err := mState.worldMap.GetJsonRegion(16-8, 16+8, 16-8, 16+8); err != nil { + // Get intial tile data around player + if regionData, err := mState.worldMap.GetJSONRegionAround(16, 16, 8); err != nil { logger.Error(err.Error()) - return mState } else { + + // Broadcast tile data to client if sendErr := dispatcher.BroadcastMessage(OpCodeTileUpdate, regionData, []runtime.Presence{precense}, precense, true); sendErr != nil { logger.Error(sendErr.Error()) - return mState } } } return mState } +// MatchLeave is called when a player leaves the match func (m *Match) MatchLeave(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, presences []runtime.Presence) interface{} { mState, ok := state.(*MatchState) if !ok { @@ -90,6 +109,7 @@ func (m *Match) MatchLeave(ctx context.Context, logger runtime.Logger, db *sql.D return mState } +// MatchLoop is code that is executed every tick func (m *Match) MatchLoop(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, messages []runtime.MatchData) interface{} { // Custom code to: // - Process the messages received. @@ -99,6 +119,7 @@ func (m *Match) MatchLoop(ctx context.Context, logger runtime.Logger, db *sql.DB return state } +// MatchTerminate is code that is executed when the match ends func (m *Match) MatchTerminate(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, dispatcher runtime.MatchDispatcher, tick int64, state interface{}, graceSeconds int) interface{} { return state } diff --git a/server/plugin/gamemap/gamemap.go b/server/plugin/gamemap/gamemap.go index e2cc927..55bc45a 100644 --- a/server/plugin/gamemap/gamemap.go +++ b/server/plugin/gamemap/gamemap.go @@ -5,12 +5,14 @@ import ( "fmt" ) +// WorldMap is the data structure used game world type WorldMap struct { data [64][64]int max_x int max_y int } +// GetTile method is used to grab a tile value with error checking func (m WorldMap) GetTile(x int, y int) (int, error) { if x > m.max_x || y > m.max_y { return -1, fmt.Errorf("Map out of bounds error: %d, %d", x, y) @@ -18,11 +20,13 @@ func (m WorldMap) GetTile(x int, y int) (int, error) { return m.data[x][y], nil } -func (m WorldMap) GetJsonRegion(start_x, end_x, start_y, end_y int) ([]byte, error) { +// GetJSONRegion method returns a JSON object containing the tile values of everything +// within a given range +func (m WorldMap) GetJSONRegion(startX, endX, startY, endY int) ([]byte, error) { regionMap := map[int]map[int]int{} - for x := start_x; x < end_x; x++ { + for x := startX; x < endX; x++ { regionMap[x] = map[int]int{} - for y := start_y; y < end_y; y++ { + for y := startY; y < endY; y++ { if result, err := m.GetTile(x, y); err != nil { return nil, err } else { @@ -35,6 +39,14 @@ func (m WorldMap) GetJsonRegion(start_x, end_x, start_y, end_y int) ([]byte, err return jsonString, err } +// GetJSONRegionAround returns a JSON object of tile data from a center point +func (m WorldMap) GetJSONRegionAround(centerX, centerY, regionRadius int) ([]byte, error) { + jsonString, err := m.GetJSONRegion(centerX-regionRadius, centerX+regionRadius, centerY-regionRadius, centerY+regionRadius) + return jsonString, err +} + +// IntializeMap is a method that helps easily +// generate WorldMap objects func IntializeMap() *WorldMap { worldMap := new(WorldMap) worldMap.max_x = 64 diff --git a/server/plugin/rpc/rpc.go b/server/plugin/rpc/rpc.go index 8635a53..ea5855d 100644 --- a/server/plugin/rpc/rpc.go +++ b/server/plugin/rpc/rpc.go @@ -9,27 +9,20 @@ import ( func getFirstWorld(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule) (string, error) { // List existing matches - // that have been 1 & 4 players + // that have been 1 & 32 players minSize := 1 - maxSize := 31 - //5, false, "", &minSize, &maxSize, "" + maxSize := 32 + + // Lists server authorative servers if matches, err := nk.MatchList(ctx, 1, true, "", &minSize, &maxSize, ""); err != nil { logger.Printf("Failed to list matches when grabing first world! Error: %v\n", err) return "", err } else { - - //For debug purposes - for _, match := range matches { - logger.Info("Found match with id: %s", match.GetMatchId()) - } - // If no matches exist, create one if len(matches) <= 0 { // Create match - //params := map[string]interface{}{} matchID, createErr := nk.MatchCreate(ctx, "control", map[string]interface{}{}) - //return nakama.match_create("world_control", {}) // Return if creation error if createErr != nil { From f982fd0130a628892f6fc9962d0fa89a368bb3a5 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sun, 16 Aug 2020 22:26:30 -0400 Subject: [PATCH 6/6] Cleanup client --- client/scenes/World.tscn | 7 ++- client/scripts/menus/login_form.gd | 1 + client/scripts/singletons/ServerConnection.gd | 2 +- client/scripts/singletons/WorldManager.gd | 46 ++++++++++++++--- client/tests/test_worldmanager.gd | 50 +++++++++++++++++++ 5 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 client/tests/test_worldmanager.gd diff --git a/client/scenes/World.tscn b/client/scenes/World.tscn index 6581b23..247e3eb 100644 --- a/client/scenes/World.tscn +++ b/client/scenes/World.tscn @@ -1,11 +1,14 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://nodes/tileset.tres" type="TileSet" id=1] +[ext_resource path="res://scripts/singletons/WorldManager.gd" type="Script" id=2] [node name="World" type="Node2D"] +script = ExtResource( 2 ) +tilemapPath = NodePath("TileMap") [node name="TileMap" type="TileMap" parent="."] tile_set = ExtResource( 1 ) cell_size = Vector2( 32, 32 ) format = 1 -tile_data = PoolIntArray( -983049, 0, 0, -983048, 0, 1, -983047, 0, 1, -983046, 0, 1, -983045, 0, 1, -983044, 0, 1, -983043, 0, 1, -983042, 0, 1, -983041, 0, 1, -1048576, 0, 1, -1048575, 0, 1, -1048574, 0, 1, -1048573, 0, 1, -1048572, 0, 1, -1048571, 0, 1, -1048570, 0, 1, -1048569, 0, 1, -1048568, 0, 2, -917513, 0, 65536, -917512, 0, 65537, -917511, 0, 65537, -917510, 0, 65537, -917509, 0, 65537, -917508, 0, 65537, -917507, 0, 65537, -917506, 0, 65537, -917505, 0, 65537, -983040, 0, 65537, -983039, 0, 65537, -983038, 0, 65537, -983037, 0, 65537, -983036, 0, 65537, -983035, 0, 65537, -983034, 0, 65537, -983033, 0, 65537, -983032, 0, 131077, -983031, 0, 1, -983030, 0, 1, -983029, 0, 1, -983028, 0, 1, -983027, 0, 1, -983026, 0, 1, -983025, 0, 1, -983024, 0, 1, -983023, 0, 1, -983022, 0, 1, -983021, 0, 1, -983020, 0, 1, -983019, 0, 1, -983018, 0, 1, -983017, 0, 1, -983016, 0, 1, -983015, 0, 1, -983014, 0, 1, -983013, 0, 1, -983012, 0, 1, -983011, 0, 1, -983010, 0, 1, -983009, 0, 1, -983008, 0, 1, -983007, 0, 1, -983006, 0, 2, -851977, 0, 65536, -851976, 0, 65537, -851975, 0, 65537, -851974, 0, 65537, -851973, 0, 65537, -851972, 0, 65537, -851971, 0, 65537, -851970, 0, 65537, -851969, 0, 65537, -917504, 0, 65537, -917503, 0, 65537, -917502, 0, 65537, -917501, 0, 65537, -917500, 0, 65537, -917499, 0, 65537, -917498, 0, 65537, -917497, 0, 65537, -917496, 0, 65537, -917495, 0, 65537, -917494, 0, 65537, -917493, 0, 65537, -917492, 0, 65537, -917491, 0, 65537, -917490, 0, 65537, -917489, 0, 65537, -917488, 0, 65537, -917487, 0, 65537, -917486, 0, 65537, -917485, 0, 65537, -917484, 0, 65537, -917483, 0, 65537, -917482, 0, 65537, -917481, 0, 65537, -917480, 0, 65537, -917479, 0, 65537, -917478, 0, 65537, -917477, 0, 65537, -917476, 0, 65537, -917475, 0, 65537, -917474, 0, 65537, -917473, 0, 65537, -917472, 0, 65537, -917471, 0, 65537, -917470, 0, 131077, -917469, 0, 2, -786441, 0, 65536, -786440, 0, 65537, -786439, 0, 65537, -786438, 0, 65537, -786437, 0, 65537, -786436, 0, 65537, -786435, 0, 65537, -786434, 0, 65537, -786433, 0, 65537, -851968, 0, 65537, -851967, 0, 65537, -851966, 0, 65537, -851965, 0, 65537, -851964, 0, 65537, -851963, 0, 65537, -851962, 0, 65537, -851961, 0, 65537, -851960, 0, 65537, -851959, 0, 65537, -851958, 0, 65537, -851957, 0, 65537, -851956, 0, 65537, -851955, 0, 65537, -851954, 0, 65537, -851953, 0, 65537, -851952, 0, 65537, -851951, 0, 65537, -851950, 0, 65537, -851949, 0, 65537, -851948, 0, 65537, -851947, 0, 65537, -851946, 0, 65537, -851945, 0, 65537, -851944, 0, 65537, -851943, 0, 65537, -851942, 0, 65537, -851941, 0, 65537, -851940, 0, 65537, -851939, 0, 65537, -851938, 0, 65537, -851937, 0, 65537, -851936, 0, 65537, -851935, 0, 65537, -851934, 0, 65537, -851933, 0, 65538, -720905, 0, 65536, -720904, 0, 65537, -720903, 0, 65537, -720902, 0, 65537, -720901, 0, 65537, -720900, 0, 65537, -720899, 0, 65537, -720898, 0, 65537, -720897, 0, 65537, -786432, 0, 65537, -786431, 0, 65537, -786430, 0, 65537, -786429, 0, 65537, -786428, 0, 65537, -786427, 0, 65537, -786426, 0, 65537, -786425, 0, 65537, -786424, 0, 65537, -786423, 0, 65537, -786422, 0, 65537, -786421, 0, 65537, -786420, 0, 65537, -786419, 0, 65537, -786418, 0, 65537, -786417, 0, 65537, -786416, 0, 65537, -786415, 0, 65537, -786414, 0, 65537, -786413, 0, 65537, -786412, 0, 65537, -786411, 0, 65537, -786410, 0, 65537, -786409, 0, 65537, -786408, 0, 65537, -786407, 0, 65537, -786406, 0, 65537, -786405, 0, 65537, -786404, 0, 65537, -786403, 0, 65537, -786402, 0, 65537, -786401, 0, 65537, -786400, 0, 65537, -786399, 0, 65537, -786398, 0, 65537, -786397, 0, 65538, -655369, 0, 65536, -655368, 0, 65537, -655367, 0, 65537, -655366, 0, 65537, -655365, 0, 65537, -655364, 0, 65537, -655363, 0, 65537, -655362, 0, 65537, -655361, 0, 65537, -720896, 0, 65537, -720895, 0, 65537, -720894, 0, 65537, -720893, 0, 65537, -720892, 0, 65537, -720891, 0, 65537, -720890, 0, 65537, -720889, 0, 65537, -720888, 0, 65537, -720887, 0, 65537, -720886, 0, 65537, -720885, 0, 65537, -720884, 0, 65537, -720883, 0, 65537, -720882, 0, 65537, -720881, 0, 65537, -720880, 0, 65537, -720879, 0, 65537, -720878, 0, 65537, -720877, 0, 65537, -720876, 0, 65537, -720875, 0, 65537, -720874, 0, 65537, -720873, 0, 65537, -720872, 0, 65537, -720871, 0, 65537, -720870, 0, 65537, -720869, 0, 65537, -720868, 0, 65537, -720867, 0, 65537, -720866, 0, 65537, -720865, 0, 65537, -720864, 0, 65537, -720863, 0, 65537, -720862, 0, 65537, -720861, 0, 131077, -720860, 0, 2, -589833, 0, 65536, -589832, 0, 65537, -589831, 0, 65537, -589830, 0, 65537, -589829, 0, 65537, -589828, 0, 65537, -589827, 0, 65537, -589826, 0, 65537, -589825, 0, 65537, -655360, 0, 65537, -655359, 0, 65537, -655358, 0, 65537, -655357, 0, 65537, -655356, 0, 65537, -655355, 0, 65537, -655354, 0, 65537, -655353, 0, 65537, -655352, 0, 65537, -655351, 0, 65537, -655350, 0, 65537, -655349, 0, 65537, -655348, 0, 65537, -655347, 0, 65537, -655346, 0, 65537, -655345, 0, 65537, -655344, 0, 65537, -655343, 0, 65537, -655342, 0, 65537, -655341, 0, 65537, -655340, 0, 65537, -655339, 0, 65537, -655338, 0, 65537, -655337, 0, 65537, -655336, 0, 65537, -655335, 0, 65537, -655334, 0, 65537, -655333, 0, 65537, -655332, 0, 65537, -655331, 0, 65537, -655330, 0, 65537, -655329, 0, 65537, -655328, 0, 65537, -655327, 0, 65537, -655326, 0, 65537, -655325, 0, 65537, -655324, 0, 65538, -524297, 0, 65536, -524296, 0, 65537, -524295, 0, 65537, -524294, 0, 65537, -524293, 0, 65537, -524292, 0, 65537, -524291, 0, 65537, -524290, 0, 65537, -524289, 0, 65537, -589824, 0, 65537, -589823, 0, 65537, -589822, 0, 65537, -589821, 0, 65537, -589820, 0, 65537, -589819, 0, 65537, -589818, 0, 65537, -589817, 0, 65537, -589816, 0, 65537, -589815, 0, 65537, -589814, 0, 65537, -589813, 0, 65537, -589812, 0, 65537, -589811, 0, 65537, -589810, 0, 65537, -589809, 0, 65537, -589808, 0, 65537, -589807, 0, 65537, -589806, 0, 65537, -589805, 0, 65537, -589804, 0, 65537, -589803, 0, 65537, -589802, 0, 65537, -589801, 0, 65537, -589800, 0, 65537, -589799, 0, 65537, -589798, 0, 65537, -589797, 0, 65537, -589796, 0, 65537, -589795, 0, 65537, -589794, 0, 65537, -589793, 0, 65537, -589792, 0, 65537, -589791, 0, 65537, -589790, 0, 65537, -589789, 0, 65537, -589788, 0, 65538, -458761, 0, 65536, -458760, 0, 65537, -458759, 0, 65537, -458758, 0, 65537, -458757, 0, 65537, -458756, 0, 65537, -458755, 0, 65537, -458754, 0, 65537, -458753, 0, 65537, -524288, 0, 65537, -524287, 0, 65537, -524286, 0, 65537, -524285, 0, 65537, -524284, 0, 65537, -524283, 0, 65537, -524282, 0, 65537, -524281, 0, 65537, -524280, 0, 65537, -524279, 0, 65537, -524278, 0, 65537, -524277, 0, 65537, -524276, 0, 65537, -524275, 0, 65537, -524274, 0, 65537, -524273, 0, 65537, -524272, 0, 65537, -524271, 0, 65537, -524270, 0, 65537, -524269, 0, 65537, -524268, 0, 65537, -524267, 0, 65537, -524266, 0, 65537, -524265, 0, 65537, -524264, 0, 65537, -524263, 0, 65537, -524262, 0, 65537, -524261, 0, 65537, -524260, 0, 65537, -524259, 0, 65537, -524258, 0, 65537, -524257, 0, 65537, -524256, 0, 65537, -524255, 0, 65537, -524254, 0, 65537, -524253, 0, 65537, -524252, 0, 65538, -393225, 0, 65536, -393224, 0, 65537, -393223, 0, 65537, -393222, 0, 65537, -393221, 0, 65537, -393220, 0, 65537, -393219, 0, 65537, -393218, 0, 65537, -393217, 0, 65537, -458752, 0, 65537, -458751, 0, 65537, -458750, 0, 65537, -458749, 0, 65537, -458748, 0, 65537, -458747, 0, 65537, -458746, 0, 65537, -458745, 0, 65537, -458744, 0, 65537, -458743, 0, 65537, -458742, 0, 65537, -458741, 0, 65537, -458740, 0, 65537, -458739, 0, 65537, -458738, 0, 65537, -458737, 0, 65537, -458736, 0, 65537, -458735, 0, 65537, -458734, 0, 65537, -458733, 0, 65537, -458732, 0, 65537, -458731, 0, 65537, -458730, 0, 65537, -458729, 0, 65537, -458728, 0, 65537, -458727, 0, 65537, -458726, 0, 65537, -458725, 0, 65537, -458724, 0, 65537, -458723, 0, 65537, -458722, 0, 65537, -458721, 0, 65537, -458720, 0, 65537, -458719, 0, 65537, -458718, 0, 65537, -458717, 0, 65537, -458716, 0, 131077, -458715, 0, 2, -327689, 0, 65536, -327688, 0, 65537, -327687, 0, 65537, -327686, 0, 65537, -327685, 0, 65537, -327684, 0, 65537, -327683, 0, 65537, -327682, 0, 65537, -327681, 0, 65537, -393216, 0, 65537, -393215, 0, 65537, -393214, 0, 65537, -393213, 0, 65537, -393212, 0, 65537, -393211, 0, 65537, -393210, 0, 65537, -393209, 0, 65537, -393208, 0, 65537, -393207, 0, 65537, -393206, 0, 65537, -393205, 0, 65537, -393204, 0, 65537, -393203, 0, 65537, -393202, 0, 65541, -393201, 0, 131073, -393200, 0, 131073, -393199, 0, 65542, -393198, 0, 65537, -393197, 0, 65537, -393196, 0, 65537, -393195, 0, 65537, -393194, 0, 65537, -393193, 0, 65537, -393192, 0, 65537, -393191, 0, 65537, -393190, 0, 65537, -393189, 0, 65537, -393188, 0, 65537, -393187, 0, 65537, -393186, 0, 65537, -393185, 0, 65537, -393184, 0, 65537, -393183, 0, 65537, -393182, 0, 65537, -393181, 0, 65537, -393180, 0, 65537, -393179, 0, 65538, -262153, 0, 65536, -262152, 0, 65537, -262151, 0, 65537, -262150, 0, 65537, -262149, 0, 65537, -262148, 0, 65537, -262147, 0, 65537, -262146, 0, 65537, -262145, 0, 65537, -327680, 0, 65537, -327679, 0, 65537, -327678, 0, 65537, -327677, 0, 65537, -327676, 0, 65537, -327675, 0, 65537, -327674, 0, 65537, -327673, 0, 65537, -327672, 0, 65537, -327671, 0, 65537, -327670, 0, 65537, -327669, 0, 65537, -327668, 0, 65537, -327667, 0, 65537, -327666, 0, 65538, -327665, 1, 0, -327664, 1, 0, -327663, 0, 65536, -327662, 0, 65537, -327661, 0, 65537, -327660, 0, 65537, -327659, 0, 65537, -327658, 0, 65537, -327657, 0, 65537, -327656, 0, 65537, -327655, 0, 65537, -327654, 0, 65537, -327653, 0, 65537, -327652, 0, 65537, -327651, 0, 65537, -327650, 0, 65537, -327649, 0, 65537, -327648, 0, 65537, -327647, 0, 65537, -327646, 0, 65537, -327645, 0, 65537, -327644, 0, 65537, -327643, 0, 65538, -196617, 0, 65536, -196616, 0, 65537, -196615, 0, 65537, -196614, 0, 65537, -196613, 0, 65537, -196612, 0, 65537, -196611, 0, 65537, -196610, 0, 65537, -196609, 0, 65537, -262144, 0, 65537, -262143, 0, 65537, -262142, 0, 65537, -262141, 0, 65537, -262140, 0, 65537, -262139, 0, 65537, -262138, 0, 65537, -262137, 0, 65537, -262136, 0, 65537, -262135, 0, 65537, -262134, 0, 65537, -262133, 0, 65537, -262132, 0, 65537, -262131, 0, 65537, -262130, 0, 65538, -262129, 1, 0, -262128, 1, 0, -262127, 0, 65536, -262126, 0, 65537, -262125, 0, 65537, -262124, 0, 65537, -262123, 0, 65537, -262122, 0, 65537, -262121, 0, 65537, -262120, 0, 65537, -262119, 0, 65537, -262118, 0, 65537, -262117, 0, 65537, -262116, 0, 65537, -262115, 0, 65537, -262114, 0, 65537, -262113, 0, 65537, -262112, 0, 65537, -262111, 0, 65537, -262110, 0, 65537, -262109, 0, 65537, -262108, 0, 65537, -262107, 0, 65538, -131081, 0, 65536, -131080, 0, 65537, -131079, 0, 65537, -131078, 0, 65537, -131077, 0, 65537, -131076, 0, 65537, -131075, 0, 65537, -131074, 0, 65537, -131073, 0, 65537, -196608, 0, 65537, -196607, 0, 65537, -196606, 0, 65537, -196605, 0, 65537, -196604, 0, 65537, -196603, 0, 65537, -196602, 0, 65537, -196601, 0, 65537, -196600, 0, 65537, -196599, 0, 65537, -196598, 0, 65537, -196597, 0, 65537, -196596, 0, 65537, -196595, 0, 65537, -196594, 0, 65538, -196593, 1, 0, -196592, 1, 0, -196591, 0, 65536, -196590, 0, 65537, -196589, 0, 65537, -196588, 0, 65537, -196587, 0, 65537, -196586, 0, 65537, -196585, 0, 65537, -196584, 0, 65537, -196583, 0, 65537, -196582, 0, 65537, -196581, 0, 65537, -196580, 0, 65537, -196579, 0, 65537, -196578, 0, 65537, -196577, 0, 65537, -196576, 0, 65537, -196575, 0, 65537, -196574, 0, 65537, -196573, 0, 65537, -196572, 0, 65537, -196571, 0, 65538, -65545, 0, 65536, -65544, 0, 65537, -65543, 0, 65537, -65542, 0, 65537, -65541, 0, 65537, -65540, 0, 65537, -65539, 0, 65537, -65538, 0, 65537, -65537, 0, 65537, -131072, 0, 65537, -131071, 0, 65537, -131070, 0, 65537, -131069, 0, 65537, -131068, 0, 65537, -131067, 0, 65537, -131066, 0, 65537, -131065, 0, 65537, -131064, 0, 65537, -131063, 0, 65537, -131062, 0, 65537, -131061, 0, 65537, -131060, 0, 65537, -131059, 0, 65537, -131058, 0, 65538, -131057, 1, 0, -131056, 1, 0, -131055, 0, 65536, -131054, 0, 65537, -131053, 0, 65537, -131052, 0, 65537, -131051, 0, 65537, -131050, 0, 65537, -131049, 0, 65537, -131048, 0, 65537, -131047, 0, 65537, -131046, 0, 65537, -131045, 0, 65537, -131044, 0, 65537, -131043, 0, 65537, -131042, 0, 65537, -131041, 0, 65537, -131040, 0, 65537, -131039, 0, 65537, -131038, 0, 65537, -131037, 0, 65537, -131036, 0, 65537, -131035, 0, 65538, -9, 0, 65536, -8, 0, 65537, -7, 0, 65537, -6, 0, 65537, -5, 0, 65537, -4, 0, 65537, -3, 0, 65537, -2, 0, 65537, -1, 0, 65537, -65536, 0, 65537, -65535, 0, 65537, -65534, 0, 65537, -65533, 0, 65537, -65532, 0, 65537, -65531, 0, 65537, -65530, 0, 65537, -65529, 0, 65537, -65528, 0, 65537, -65527, 0, 65537, -65526, 0, 65537, -65525, 0, 65537, -65524, 0, 65537, -65523, 0, 65537, -65522, 0, 65538, -65521, 1, 0, -65520, 1, 0, -65519, 0, 65536, -65518, 0, 65537, -65517, 0, 65537, -65516, 0, 65537, -65515, 0, 65537, -65514, 0, 65537, -65513, 0, 65537, -65512, 0, 65537, -65511, 0, 65537, -65510, 0, 65537, -65509, 0, 65537, -65508, 0, 65537, -65507, 0, 65537, -65506, 0, 65537, -65505, 0, 65537, -65504, 0, 65537, -65503, 0, 65537, -65502, 0, 65537, -65501, 0, 65537, -65500, 0, 65537, -65499, 0, 65538, 65527, 0, 65536, 65528, 0, 65537, 65529, 0, 65537, 65530, 0, 65537, 65531, 0, 65537, 65532, 0, 65537, 65533, 0, 65537, 65534, 0, 65537, 65535, 0, 65537, 0, 0, 65537, 1, 0, 65537, 2, 0, 65537, 3, 0, 65537, 4, 0, 65537, 5, 0, 65537, 6, 0, 65537, 7, 0, 65537, 8, 0, 65541, 9, 0, 131073, 10, 0, 131073, 11, 0, 131073, 12, 0, 131073, 13, 0, 131073, 14, 0, 131074, 15, 1, 0, 16, 1, 0, 17, 0, 65536, 18, 0, 65537, 19, 0, 65537, 20, 0, 65537, 21, 0, 65537, 22, 0, 65537, 23, 0, 65537, 24, 0, 65537, 25, 0, 65537, 26, 0, 65537, 27, 0, 65537, 28, 0, 65537, 29, 0, 65537, 30, 0, 65537, 31, 0, 65537, 32, 0, 65537, 33, 0, 65537, 34, 0, 65537, 35, 0, 65537, 36, 0, 65537, 37, 0, 65538, 131063, 0, 65536, 131064, 0, 65537, 131065, 0, 65537, 131066, 0, 65537, 131067, 0, 65537, 131068, 0, 65537, 131069, 0, 65537, 131070, 0, 65537, 131071, 0, 65537, 65536, 0, 65537, 65537, 0, 65537, 65538, 0, 65537, 65539, 0, 65537, 65540, 0, 65537, 65541, 0, 65537, 65542, 0, 65537, 65543, 0, 65537, 65544, 0, 65538, 65545, 1, 0, 65546, 1, 0, 65547, 1, 0, 65548, 1, 0, 65549, 1, 0, 65550, 1, 0, 65551, 1, 0, 65552, 1, 0, 65553, 0, 65536, 65554, 0, 65537, 65555, 0, 65537, 65556, 0, 65537, 65557, 0, 65537, 65558, 0, 65537, 65559, 0, 65537, 65560, 0, 65537, 65561, 0, 65537, 65562, 0, 65537, 65563, 0, 65537, 65564, 0, 65537, 65565, 0, 65537, 65566, 0, 65537, 65567, 0, 65537, 65568, 0, 65537, 65569, 0, 65537, 65570, 0, 65537, 65571, 0, 65537, 65572, 0, 65537, 65573, 0, 65538, 196599, 0, 65536, 196600, 0, 65537, 196601, 0, 65537, 196602, 0, 65537, 196603, 0, 65537, 196604, 0, 65537, 196605, 0, 65537, 196606, 0, 65537, 196607, 0, 65537, 131072, 0, 65537, 131073, 0, 65537, 131074, 0, 65537, 131075, 0, 65537, 131076, 0, 65537, 131077, 0, 65537, 131078, 0, 65537, 131079, 0, 65537, 131080, 0, 65538, 131081, 1, 0, 131082, 1, 0, 131083, 1, 0, 131084, 1, 0, 131085, 1, 0, 131086, 1, 0, 131087, 1, 0, 131088, 1, 0, 131089, 0, 65536, 131090, 0, 65537, 131091, 0, 65537, 131092, 0, 65537, 131093, 0, 65537, 131094, 0, 65537, 131095, 0, 65537, 131096, 0, 65537, 131097, 0, 65537, 131098, 0, 65537, 131099, 0, 65537, 131100, 0, 65537, 131101, 0, 65537, 131102, 0, 65537, 131103, 0, 65537, 131104, 0, 65537, 131105, 0, 65537, 131106, 0, 65537, 131107, 0, 65537, 131108, 0, 65537, 131109, 0, 65538, 262135, 0, 65536, 262136, 0, 65537, 262137, 0, 65537, 262138, 0, 65537, 262139, 0, 65537, 262140, 0, 65537, 262141, 0, 65537, 262142, 0, 65537, 262143, 0, 65537, 196608, 0, 65537, 196609, 0, 65537, 196610, 0, 65537, 196611, 0, 65537, 196612, 0, 65537, 196613, 0, 65537, 196614, 0, 65537, 196615, 0, 65537, 196616, 0, 65538, 196617, 1, 0, 196618, 1, 0, 196619, 0, 0, 196620, 0, 1, 196621, 0, 1, 196622, 0, 1, 196623, 0, 1, 196624, 0, 1, 196625, 0, 131078, 196626, 0, 65537, 196627, 0, 65537, 196628, 0, 65537, 196629, 0, 65537, 196630, 0, 65537, 196631, 0, 65537, 196632, 0, 65537, 196633, 0, 65537, 196634, 0, 65537, 196635, 0, 65537, 196636, 0, 65537, 196637, 0, 65537, 196638, 0, 65537, 196639, 0, 65537, 196640, 0, 65537, 196641, 0, 65537, 196642, 0, 65537, 196643, 0, 65537, 196644, 0, 65537, 196645, 0, 65538, 327671, 0, 65536, 327672, 0, 65537, 327673, 0, 65537, 327674, 0, 65537, 327675, 0, 65537, 327676, 0, 65537, 327677, 0, 65537, 327678, 0, 65537, 327679, 0, 65537, 262144, 0, 65537, 262145, 0, 65537, 262146, 0, 65537, 262147, 0, 65537, 262148, 0, 65537, 262149, 0, 65537, 262150, 0, 65537, 262151, 0, 65537, 262152, 0, 65538, 262153, 1, 0, 262154, 1, 0, 262155, 0, 65536, 262156, 0, 65537, 262157, 0, 65537, 262158, 0, 65537, 262159, 0, 65537, 262160, 0, 65537, 262161, 0, 65537, 262162, 0, 65537, 262163, 0, 65537, 262164, 0, 65537, 262165, 0, 65537, 262166, 0, 65537, 262167, 0, 65537, 262168, 0, 65537, 262169, 0, 65537, 262170, 0, 65537, 262171, 0, 65537, 262172, 0, 65537, 262173, 0, 65537, 262174, 0, 65537, 262175, 0, 65537, 262176, 0, 65537, 262177, 0, 65537, 262178, 0, 65537, 262179, 0, 65537, 262180, 0, 65537, 262181, 0, 65538, 393207, 0, 65536, 393208, 0, 65537, 393209, 0, 65537, 393210, 0, 65537, 393211, 0, 65537, 393212, 0, 65537, 393213, 0, 65537, 393214, 0, 65537, 393215, 0, 65537, 327680, 0, 65537, 327681, 0, 65537, 327682, 0, 65537, 327683, 0, 65541, 327684, 0, 131073, 327685, 0, 131073, 327686, 0, 131073, 327687, 0, 131073, 327688, 0, 131074, 327689, 1, 0, 327690, 1, 0, 327691, 0, 131072, 327692, 0, 131073, 327693, 0, 131073, 327694, 0, 131073, 327695, 0, 131073, 327696, 0, 131073, 327697, 0, 131073, 327698, 0, 131073, 327699, 0, 131073, 327700, 0, 131073, 327701, 0, 131073, 327702, 0, 131073, 327703, 0, 65542, 327704, 0, 65537, 327705, 0, 65537, 327706, 0, 65537, 327707, 0, 65537, 327708, 0, 65537, 327709, 0, 65537, 327710, 0, 65537, 327711, 0, 65537, 327712, 0, 65537, 327713, 0, 65537, 327714, 0, 65537, 327715, 0, 65537, 327716, 0, 65537, 327717, 0, 65538, 458743, 0, 65536, 458744, 0, 65537, 458745, 0, 65537, 458746, 0, 65537, 458747, 0, 65537, 458748, 0, 65537, 458749, 0, 65537, 458750, 0, 65537, 458751, 0, 65537, 393216, 0, 65537, 393217, 0, 65537, 393218, 0, 65537, 393219, 0, 65538, 393220, 1, 0, 393221, 1, 0, 393222, 1, 0, 393223, 1, 0, 393224, 1, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 1, 0, 393229, 1, 0, 393230, 1, 0, 393231, 1, 0, 393232, 1, 0, 393233, 1, 0, 393234, 1, 0, 393235, 1, 0, 393236, 1, 0, 393237, 1, 0, 393238, 1, 0, 393239, 0, 65536, 393240, 0, 65537, 393241, 0, 65537, 393242, 0, 65537, 393243, 0, 65537, 393244, 0, 65537, 393245, 0, 65537, 393246, 0, 65537, 393247, 0, 65537, 393248, 0, 65537, 393249, 0, 65537, 393250, 0, 65537, 393251, 0, 65537, 393252, 0, 65537, 393253, 0, 65538, 524279, 0, 65536, 524280, 0, 65537, 524281, 0, 65537, 524282, 0, 65537, 524283, 0, 65537, 524284, 0, 65537, 524285, 0, 65537, 524286, 0, 65537, 524287, 0, 65537, 458752, 0, 65537, 458753, 0, 65537, 458754, 0, 65537, 458755, 0, 65538, 458756, 1, 0, 458757, 1, 0, 458758, 1, 0, 458759, 1, 0, 458760, 1, 0, 458761, 1, 0, 458762, 1, 0, 458763, 1, 0, 458764, 1, 0, 458765, 1, 0, 458766, 1, 0, 458767, 1, 0, 458768, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 1, 0, 458772, 1, 0, 458773, 1, 0, 458774, 1, 0, 458775, 0, 65536, 458776, 0, 65537, 458777, 0, 65537, 458778, 0, 65537, 458779, 0, 65537, 458780, 0, 65537, 458781, 0, 65537, 458782, 0, 65537, 458783, 0, 65537, 458784, 0, 65537, 458785, 0, 65537, 458786, 0, 65537, 458787, 0, 65537, 458788, 0, 65537, 458789, 0, 131077, 458790, 0, 2, 589815, 0, 65536, 589816, 0, 65537, 589817, 0, 65537, 589818, 0, 65537, 589819, 0, 65537, 589820, 0, 65537, 589821, 0, 65537, 589822, 0, 65537, 589823, 0, 65541, 524288, 0, 131073, 524289, 0, 131073, 524290, 0, 131073, 524291, 0, 131074, 524292, 1, 0, 524293, 1, 0, 524294, 0, 0, 524295, 0, 1, 524296, 0, 1, 524297, 0, 1, 524298, 0, 1, 524299, 0, 1, 524300, 0, 1, 524301, 0, 1, 524302, 0, 1, 524303, 0, 1, 524304, 0, 1, 524305, 0, 1, 524306, 0, 1, 524307, 0, 1, 524308, 0, 2, 524309, 1, 0, 524310, 1, 0, 524311, 0, 65536, 524312, 0, 65537, 524313, 0, 65537, 524314, 0, 65537, 524315, 0, 65537, 524316, 0, 65537, 524317, 0, 65537, 524318, 0, 65537, 524319, 0, 65537, 524320, 0, 65537, 524321, 0, 65537, 524322, 0, 65537, 524323, 0, 65537, 524324, 0, 65537, 524325, 0, 65537, 524326, 0, 65538, 655351, 0, 65536, 655352, 0, 65537, 655353, 0, 65537, 655354, 0, 65537, 655355, 0, 65537, 655356, 0, 65537, 655357, 0, 65537, 655358, 0, 65537, 655359, 0, 65538, 589824, 1, 0, 589825, 1, 0, 589826, 1, 0, 589827, 1, 0, 589828, 1, 0, 589829, 1, 0, 589830, 0, 65536, 589831, 0, 65537, 589832, 0, 65537, 589833, 0, 65537, 589834, 0, 65537, 589835, 0, 65537, 589836, 0, 65537, 589837, 0, 65537, 589838, 0, 65537, 589839, 0, 65537, 589840, 0, 65537, 589841, 0, 65537, 589842, 0, 65537, 589843, 0, 65537, 589844, 0, 65538, 589845, 1, 0, 589846, 1, 0, 589847, 0, 65536, 589848, 0, 65537, 589849, 0, 65537, 589850, 0, 65537, 589851, 0, 65537, 589852, 0, 65537, 589853, 0, 65537, 589854, 0, 65537, 589855, 0, 65537, 589856, 0, 65537, 589857, 0, 65537, 589858, 0, 65537, 589859, 0, 65537, 589860, 0, 65537, 589861, 0, 65537, 589862, 0, 65538, 720887, 0, 65536, 720888, 0, 65537, 720889, 0, 65537, 720890, 0, 65537, 720891, 0, 65537, 720892, 0, 65537, 720893, 0, 65537, 720894, 0, 65537, 720895, 0, 65538, 655360, 1, 0, 655361, 1, 0, 655362, 1, 0, 655363, 1, 0, 655364, 1, 0, 655365, 1, 0, 655366, 0, 65536, 655367, 0, 65537, 655368, 0, 65537, 655369, 0, 65537, 655370, 0, 65537, 655371, 0, 65537, 655372, 0, 65537, 655373, 0, 65537, 655374, 0, 65537, 655375, 0, 65537, 655376, 0, 65537, 655377, 0, 65537, 655378, 0, 65537, 655379, 0, 65537, 655380, 0, 65538, 655381, 1, 0, 655382, 1, 0, 655383, 0, 65536, 655384, 0, 65537, 655385, 0, 65537, 655386, 0, 65537, 655387, 0, 65537, 655388, 0, 65537, 655389, 0, 65537, 655390, 0, 65537, 655391, 0, 65537, 655392, 0, 65537, 655393, 0, 65537, 655394, 0, 65537, 655395, 0, 65537, 655396, 0, 65537, 655397, 0, 65537, 655398, 0, 65538, 786423, 0, 131072, 786424, 0, 65542, 786425, 0, 65537, 786426, 0, 65537, 786427, 0, 65537, 786428, 0, 65537, 786429, 0, 65537, 786430, 0, 65537, 786431, 0, 131077, 720896, 0, 1, 720897, 0, 1, 720898, 0, 1, 720899, 0, 1, 720900, 0, 1, 720901, 0, 1, 720902, 0, 131078, 720903, 0, 65537, 720904, 0, 65537, 720905, 0, 65537, 720906, 0, 65537, 720907, 0, 65537, 720908, 0, 65537, 720909, 0, 65537, 720910, 0, 65537, 720911, 0, 65537, 720912, 0, 65537, 720913, 0, 65537, 720914, 0, 65537, 720915, 0, 65537, 720916, 0, 65538, 720917, 1, 0, 720918, 1, 0, 720919, 0, 65536, 720920, 0, 65537, 720921, 0, 65537, 720922, 0, 65537, 720923, 0, 65537, 720924, 0, 65537, 720925, 0, 65537, 720926, 0, 65537, 720927, 0, 65537, 720928, 0, 65537, 720929, 0, 65537, 720930, 0, 65537, 720931, 0, 65537, 720932, 0, 65537, 720933, 0, 65537, 720934, 0, 65538, 851960, 0, 65536, 851961, 0, 65537, 851962, 0, 65537, 851963, 0, 65537, 851964, 0, 65537, 851965, 0, 65537, 851966, 0, 65537, 851967, 0, 65537, 786432, 0, 65537, 786433, 0, 65537, 786434, 0, 65537, 786435, 0, 65537, 786436, 0, 65537, 786437, 0, 65537, 786438, 0, 65537, 786439, 0, 65537, 786440, 0, 65537, 786441, 0, 65537, 786442, 0, 65537, 786443, 0, 65537, 786444, 0, 65537, 786445, 0, 65537, 786446, 0, 65537, 786447, 0, 65537, 786448, 0, 65537, 786449, 0, 65537, 786450, 0, 65537, 786451, 0, 65537, 786452, 0, 65538, 786453, 1, 0, 786454, 1, 0, 786455, 0, 131072, 786456, 0, 131073, 786457, 0, 131073, 786458, 0, 131073, 786459, 0, 131073, 786460, 0, 131073, 786461, 0, 131073, 786462, 0, 131073, 786463, 0, 131073, 786464, 0, 131073, 786465, 0, 131073, 786466, 0, 131073, 786467, 0, 131073, 786468, 0, 65542, 786469, 0, 65537, 786470, 0, 65538, 917496, 0, 131072, 917497, 0, 65542, 917498, 0, 65537, 917499, 0, 65537, 917500, 0, 65537, 917501, 0, 65537, 917502, 0, 65537, 917503, 0, 65537, 851968, 0, 65537, 851969, 0, 65537, 851970, 0, 65537, 851971, 0, 65537, 851972, 0, 65537, 851973, 0, 65537, 851974, 0, 65537, 851975, 0, 65537, 851976, 0, 65537, 851977, 0, 65537, 851978, 0, 65537, 851979, 0, 65537, 851980, 0, 65537, 851981, 0, 65537, 851982, 0, 65537, 851983, 0, 65537, 851984, 0, 65537, 851985, 0, 65537, 851986, 0, 65537, 851987, 0, 65537, 851988, 0, 65538, 851989, 1, 0, 851990, 1, 0, 851991, 1, 0, 851992, 1, 0, 851993, 1, 0, 851994, 1, 0, 851995, 1, 0, 851996, 1, 0, 851997, 1, 0, 851998, 1, 0, 851999, 1, 0, 852000, 1, 0, 852001, 1, 0, 852002, 1, 0, 852003, 1, 0, 852004, 0, 65536, 852005, 0, 65537, 852006, 0, 65538, 983033, 0, 131072, 983034, 0, 65542, 983035, 0, 65537, 983036, 0, 65537, 983037, 0, 65537, 983038, 0, 65537, 983039, 0, 65537, 917504, 0, 65537, 917505, 0, 65537, 917506, 0, 65537, 917507, 0, 65537, 917508, 0, 65537, 917509, 0, 65537, 917510, 0, 65537, 917511, 0, 65537, 917512, 0, 65537, 917513, 0, 65537, 917514, 0, 65537, 917515, 0, 65537, 917516, 0, 65537, 917517, 0, 65537, 917518, 0, 65537, 917519, 0, 65537, 917520, 0, 65537, 917521, 0, 65537, 917522, 0, 65537, 917523, 0, 65537, 917524, 0, 65538, 917525, 1, 0, 917526, 1, 0, 917527, 1, 0, 917528, 1, 0, 917529, 1, 0, 917530, 1, 0, 917531, 1, 0, 917532, 1, 0, 917533, 1, 0, 917534, 1, 0, 917535, 1, 0, 917536, 1, 0, 917537, 1, 0, 917538, 1, 0, 917539, 1, 0, 917540, 0, 65536, 917541, 0, 65541, 917542, 0, 131074, 1048570, 0, 131072, 1048571, 0, 65542, 1048572, 0, 65537, 1048573, 0, 65537, 1048574, 0, 65537, 1048575, 0, 65537, 983040, 0, 65537, 983041, 0, 65537, 983042, 0, 65537, 983043, 0, 65537, 983044, 0, 65537, 983045, 0, 65537, 983046, 0, 65537, 983047, 0, 65537, 983048, 0, 65537, 983049, 0, 65537, 983050, 0, 65537, 983051, 0, 65537, 983052, 0, 65537, 983053, 0, 65537, 983054, 0, 65537, 983055, 0, 65537, 983056, 0, 65537, 983057, 0, 65537, 983058, 0, 65537, 983059, 0, 65537, 983060, 0, 131077, 983061, 0, 1, 983062, 0, 1, 983063, 0, 1, 983064, 0, 1, 983065, 0, 1, 983066, 0, 1, 983067, 0, 1, 983068, 0, 1, 983069, 0, 1, 983070, 0, 1, 983071, 0, 1, 983072, 0, 1, 983073, 0, 1, 983074, 0, 1, 983075, 0, 1, 983076, 0, 131078, 983077, 0, 65538, 1114107, 0, 131072, 1114108, 0, 65542, 1114109, 0, 65537, 1114110, 0, 65537, 1114111, 0, 65537, 1048576, 0, 65537, 1048577, 0, 65537, 1048578, 0, 65537, 1048579, 0, 65537, 1048580, 0, 65537, 1048581, 0, 65537, 1048582, 0, 65537, 1048583, 0, 65537, 1048584, 0, 65537, 1048585, 0, 65537, 1048586, 0, 65537, 1048587, 0, 65537, 1048588, 0, 65537, 1048589, 0, 65537, 1048590, 0, 65537, 1048591, 0, 65537, 1048592, 0, 65537, 1048593, 0, 65537, 1048594, 0, 65537, 1048595, 0, 65537, 1048596, 0, 65537, 1048597, 0, 65537, 1048598, 0, 65537, 1048599, 0, 65537, 1048600, 0, 65537, 1048601, 0, 65537, 1048602, 0, 65537, 1048603, 0, 65537, 1048604, 0, 65537, 1048605, 0, 65537, 1048606, 0, 65537, 1048607, 0, 65537, 1048608, 0, 65537, 1048609, 0, 65537, 1048610, 0, 65537, 1048611, 0, 65537, 1048612, 0, 65537, 1048613, 0, 65538, 1179644, 0, 131072, 1179645, 0, 65542, 1179646, 0, 65537, 1179647, 0, 65537, 1114112, 0, 65537, 1114113, 0, 65537, 1114114, 0, 65537, 1114115, 0, 65537, 1114116, 0, 65537, 1114117, 0, 65537, 1114118, 0, 65537, 1114119, 0, 65537, 1114120, 0, 65537, 1114121, 0, 65537, 1114122, 0, 65537, 1114123, 0, 65537, 1114124, 0, 65537, 1114125, 0, 65537, 1114126, 0, 65537, 1114127, 0, 65537, 1114128, 0, 65537, 1114129, 0, 65537, 1114130, 0, 65537, 1114131, 0, 65537, 1114132, 0, 65537, 1114133, 0, 65537, 1114134, 0, 65537, 1114135, 0, 65537, 1114136, 0, 65537, 1114137, 0, 65537, 1114138, 0, 65537, 1114139, 0, 65537, 1114140, 0, 65537, 1114141, 0, 65537, 1114142, 0, 65537, 1114143, 0, 65537, 1114144, 0, 65537, 1114145, 0, 65537, 1114146, 0, 65537, 1114147, 0, 65537, 1114148, 0, 65541, 1114149, 0, 131074, 1245181, 0, 131072, 1245182, 0, 131073, 1245183, 0, 65542, 1179648, 0, 65537, 1179649, 0, 65537, 1179650, 0, 65537, 1179651, 0, 65537, 1179652, 0, 65537, 1179653, 0, 65537, 1179654, 0, 65537, 1179655, 0, 65537, 1179656, 0, 65537, 1179657, 0, 65537, 1179658, 0, 65537, 1179659, 0, 65537, 1179660, 0, 65537, 1179661, 0, 65537, 1179662, 0, 65537, 1179663, 0, 65537, 1179664, 0, 65537, 1179665, 0, 65537, 1179666, 0, 65537, 1179667, 0, 65537, 1179668, 0, 65537, 1179669, 0, 65537, 1179670, 0, 65537, 1179671, 0, 65537, 1179672, 0, 65537, 1179673, 0, 65537, 1179674, 0, 65537, 1179675, 0, 65537, 1179676, 0, 65537, 1179677, 0, 65537, 1179678, 0, 65537, 1179679, 0, 65537, 1179680, 0, 65537, 1179681, 0, 65537, 1179682, 0, 65541, 1179683, 0, 131073, 1179684, 0, 131074, 1310719, 0, 131072, 1245184, 0, 131073, 1245185, 0, 131073, 1245186, 0, 65542, 1245187, 0, 65537, 1245188, 0, 65537, 1245189, 0, 65537, 1245190, 0, 65537, 1245191, 0, 65537, 1245192, 0, 65537, 1245193, 0, 65537, 1245194, 0, 65537, 1245195, 0, 65537, 1245196, 0, 65537, 1245197, 0, 65537, 1245198, 0, 65537, 1245199, 0, 65537, 1245200, 0, 65537, 1245201, 0, 65537, 1245202, 0, 65537, 1245203, 0, 65537, 1245204, 0, 65537, 1245205, 0, 65537, 1245206, 0, 65537, 1245207, 0, 65537, 1245208, 0, 65537, 1245209, 0, 65537, 1245210, 0, 65537, 1245211, 0, 65537, 1245212, 0, 65537, 1245213, 0, 65537, 1245214, 0, 65537, 1245215, 0, 65541, 1245216, 0, 131073, 1245217, 0, 131073, 1245218, 0, 131074, 1310722, 0, 131072, 1310723, 0, 131073, 1310724, 0, 131073, 1310725, 0, 65542, 1310726, 0, 65537, 1310727, 0, 65537, 1310728, 0, 65537, 1310729, 0, 65537, 1310730, 0, 65537, 1310731, 0, 65537, 1310732, 0, 65537, 1310733, 0, 65537, 1310734, 0, 65537, 1310735, 0, 65537, 1310736, 0, 65537, 1310737, 0, 65537, 1310738, 0, 65537, 1310739, 0, 65537, 1310740, 0, 65537, 1310741, 0, 65537, 1310742, 0, 65537, 1310743, 0, 65541, 1310744, 0, 131073, 1310745, 0, 131073, 1310746, 0, 131073, 1310747, 0, 131073, 1310748, 0, 131073, 1310749, 0, 131073, 1310750, 0, 131073, 1310751, 0, 131074, 1376261, 0, 131072, 1376262, 0, 131073, 1376263, 0, 131073, 1376264, 0, 131073, 1376265, 0, 131073, 1376266, 0, 131073, 1376267, 0, 131073, 1376268, 0, 131073, 1376269, 0, 131073, 1376270, 0, 131073, 1376271, 0, 131073, 1376272, 0, 131073, 1376273, 0, 131073, 1376274, 0, 131073, 1376275, 0, 131073, 1376276, 0, 131073, 1376277, 0, 131073, 1376278, 0, 131073, 1376279, 0, 131074 ) +tile_data = PoolIntArray( 0, 0, 0, 1, 0, 1, 2, 0, 1, 3, 0, 1, 4, 0, 1, 5, 0, 1, 6, 0, 5, 7, 0, 196609, 8, 0, 196609, 9, 0, 6, 10, 0, 1, 11, 0, 1, 12, 0, 1, 13, 0, 1, 14, 0, 1, 15, 0, 2, 65536, 0, 65536, 65537, 0, 65537, 65538, 0, 65537, 65539, 0, 65537, 65540, 0, 65537, 65541, 0, 65537, 65542, 0, 65538, 65543, 1, 0, 65544, 1, 0, 65545, 0, 65536, 65546, 0, 65537, 65547, 0, 65537, 65548, 0, 65537, 65549, 0, 65537, 65550, 0, 65537, 65551, 0, 65538, 131072, 0, 65536, 131073, 0, 65537, 131074, 0, 65537, 131075, 0, 65537, 131076, 0, 65537, 131077, 0, 65537, 131078, 0, 65538, 131079, 1, 0, 131080, 1, 0, 131081, 0, 65536, 131082, 0, 65537, 131083, 0, 65537, 131084, 0, 65537, 131085, 0, 65537, 131086, 0, 65537, 131087, 0, 65538, 196608, 0, 65536, 196609, 0, 65537, 196610, 0, 65537, 196611, 0, 65537, 196612, 0, 65537, 196613, 0, 65537, 196614, 0, 65538, 196615, 1, 0, 196616, 1, 0, 196617, 0, 65536, 196618, 0, 65537, 196619, 0, 65537, 196620, 0, 65537, 196621, 0, 65537, 196622, 0, 65537, 196623, 0, 65538, 262144, 0, 65536, 262145, 0, 65537, 262146, 0, 65537, 262147, 0, 65537, 262148, 0, 65537, 262149, 0, 65537, 262150, 0, 65538, 262151, 1, 0, 262152, 1, 0, 262153, 0, 65536, 262154, 0, 65537, 262155, 0, 65537, 262156, 0, 65537, 262157, 0, 65537, 262158, 0, 65537, 262159, 0, 65538, 327680, 0, 65536, 327681, 0, 65537, 327682, 0, 65537, 327683, 0, 65537, 327684, 0, 65537, 327685, 0, 65537, 327686, 0, 65538, 327687, 1, 0, 327688, 1, 0, 327689, 0, 65536, 327690, 0, 65537, 327691, 0, 65537, 327692, 0, 65537, 327693, 0, 65537, 327694, 0, 65537, 327695, 0, 65538, 393216, 0, 65540, 393217, 0, 131073, 393218, 0, 131073, 393219, 0, 131073, 393220, 0, 131073, 393221, 0, 131073, 393222, 0, 131074, 393223, 1, 0, 393224, 1, 0, 393225, 0, 131072, 393226, 0, 131073, 393227, 0, 131073, 393228, 0, 131073, 393229, 0, 131073, 393230, 0, 131073, 393231, 0, 65543, 458752, 0, 65539, 458753, 1, 0, 458754, 1, 0, 458755, 1, 0, 458756, 1, 0, 458757, 1, 0, 458758, 1, 0, 458759, 1, 0, 458760, 1, 0, 458761, 1, 0, 458762, 1, 0, 458763, 1, 0, 458764, 1, 0, 458765, 1, 0, 458766, 1, 0, 458767, 0, 65539, 524288, 0, 65539, 524289, 1, 0, 524290, 1, 0, 524291, 1, 0, 524292, 1, 0, 524293, 1, 0, 524294, 1, 0, 524295, 1, 0, 524296, 1, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 1, 0, 524301, 1, 0, 524302, 1, 0, 524303, 0, 65539, 589824, 0, 131076, 589825, 0, 1, 589826, 0, 1, 589827, 0, 1, 589828, 0, 1, 589829, 0, 1, 589830, 0, 2, 589831, 1, 0, 589832, 1, 0, 589833, 0, 0, 589834, 0, 1, 589835, 0, 1, 589836, 0, 1, 589837, 0, 1, 589838, 0, 1, 589839, 0, 131079, 655360, 0, 65536, 655361, 0, 65537, 655362, 0, 65537, 655363, 0, 65537, 655364, 0, 65537, 655365, 0, 65537, 655366, 0, 65538, 655367, 1, 0, 655368, 1, 0, 655369, 0, 65536, 655370, 0, 65537, 655371, 0, 65537, 655372, 0, 65537, 655373, 0, 65537, 655374, 0, 65537, 655375, 0, 65538, 720896, 0, 65536, 720897, 0, 65537, 720898, 0, 65537, 720899, 0, 65537, 720900, 0, 65537, 720901, 0, 65537, 720902, 0, 65538, 720903, 1, 0, 720904, 1, 0, 720905, 0, 65536, 720906, 0, 65537, 720907, 0, 65537, 720908, 0, 65537, 720909, 0, 65537, 720910, 0, 65537, 720911, 0, 65538, 786432, 0, 65536, 786433, 0, 65537, 786434, 0, 65537, 786435, 0, 65537, 786436, 0, 65537, 786437, 0, 65537, 786438, 0, 65538, 786439, 1, 0, 786440, 1, 0, 786441, 0, 65536, 786442, 0, 65537, 786443, 0, 65537, 786444, 0, 65537, 786445, 0, 65537, 786446, 0, 65537, 786447, 0, 65538, 851968, 0, 65536, 851969, 0, 65537, 851970, 0, 65537, 851971, 0, 65537, 851972, 0, 65537, 851973, 0, 65537, 851974, 0, 65538, 851975, 1, 0, 851976, 1, 0, 851977, 0, 65536, 851978, 0, 65537, 851979, 0, 65537, 851980, 0, 65537, 851981, 0, 65537, 851982, 0, 65537, 851983, 0, 65538, 917504, 0, 65536, 917505, 0, 65537, 917506, 0, 65537, 917507, 0, 65537, 917508, 0, 65537, 917509, 0, 65537, 917510, 0, 65538, 917511, 1, 0, 917512, 1, 0, 917513, 0, 65536, 917514, 0, 65537, 917515, 0, 65537, 917516, 0, 65537, 917517, 0, 65537, 917518, 0, 65537, 917519, 0, 65538, 983040, 0, 131072, 983041, 0, 131073, 983042, 0, 131073, 983043, 0, 131073, 983044, 0, 131073, 983045, 0, 131073, 983046, 0, 196613, 983047, 0, 196609, 983048, 0, 196609, 983049, 0, 196614, 983050, 0, 131073, 983051, 0, 131073, 983052, 0, 131073, 983053, 0, 131073, 983054, 0, 131073, 983055, 0, 131074 ) diff --git a/client/scripts/menus/login_form.gd b/client/scripts/menus/login_form.gd index a2ed1c1..3007593 100644 --- a/client/scripts/menus/login_form.gd +++ b/client/scripts/menus/login_form.gd @@ -41,6 +41,7 @@ func login(_text=""): else: display_message("Connected to server!", Color.green) # Load World + get_tree().change_scene("res://scenes/World.tscn") func display_message(message="", color=Color.red): errorLabel.add_color_override("font_color", color) diff --git a/client/scripts/singletons/ServerConnection.gd b/client/scripts/singletons/ServerConnection.gd index 69196ea..de594d1 100644 --- a/client/scripts/singletons/ServerConnection.gd +++ b/client/scripts/singletons/ServerConnection.gd @@ -61,7 +61,7 @@ func join_world_async() -> Dictionary: for precense in match_join_result.presences: _precenses[precense.user_id] = precense - print("Currently connected: %s" % _precenses.size()) + print("Joined matched with %s other players!" % _precenses.size()) return _precenses diff --git a/client/scripts/singletons/WorldManager.gd b/client/scripts/singletons/WorldManager.gd index 322f467..4e09f8c 100644 --- a/client/scripts/singletons/WorldManager.gd +++ b/client/scripts/singletons/WorldManager.gd @@ -1,15 +1,47 @@ extends Node +export(NodePath) var tilemapPath -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +var tilemap : TileMap - -# Called when the node enters the scene tree for the first time. func _ready(): + + # Setup tilemap + tilemap = get_node(tilemapPath) + tilemap.clear() + + # Setup connections and join wolrd ServerConnection.connect("tile_update", self, "on_tile_update") yield(ServerConnection.join_world_async(), "completed") -func on_tile_update(tile_data): - print(tile_data) +func on_tile_update(tile_data, update_bitmask=true): + print("Updating tilemap") + + var max_pos_x : int + var min_pos_x : int + var max_pos_y : int + var min_pos_y : int + + for x in tile_data: + + # Find max & min x + if not max_pos_x or max_pos_x > int(x): + max_pos_x = int(x) + if not min_pos_x or min_pos_x < int(x): + min_pos_x = int(x) + + for y in tile_data[x]: + + # Find max & min y + if not max_pos_y or max_pos_y > int(y): + max_pos_y = int(y) + if not min_pos_y or min_pos_y < int(y): + min_pos_y = int(y) + + # Update tile data + tilemap.set_cell(int(x),int(y), int(tile_data[x][y]), false, false, false, tilemap.get_cell_autotile_coord(int(x), int(y))) + + if update_bitmask: + tilemap.update_bitmask_region(Vector2(min_pos_x, min_pos_y), Vector2(max_pos_x, max_pos_y)) + + print("Update complete!") diff --git a/client/tests/test_worldmanager.gd b/client/tests/test_worldmanager.gd new file mode 100644 index 0000000..be8ed87 --- /dev/null +++ b/client/tests/test_worldmanager.gd @@ -0,0 +1,50 @@ +extends "res://addons/gut/test.gd" + +var world_manager = load("res://scripts/singletons/WorldManager.gd") + +func test_adding_tiles_to_map(): + # Configure world to have a + var world = world_manager.new() + world.tilemap = TileMap.new() + + world.on_tile_update({ + "0" : { + "0" : "0", + "1" : "0", + "2" : "0", + "3" : "1", + "4" : "0" + }, + "1" : { + "0" : "1" + } + }, false) + + assert_eq(world.tilemap.get_cell(0,0), 0) + assert_eq(world.tilemap.get_cell(0,1), 0) + assert_eq(world.tilemap.get_cell(0,2), 0) + assert_eq(world.tilemap.get_cell(0,3), 1) + assert_eq(world.tilemap.get_cell(0,4), 0) + assert_eq(world.tilemap.get_cell(1,0), 1) + + # Test Updates + world.on_tile_update({ + "0" : { + "1" : "0", + "2" : "1" + } + }, false) + + assert_eq(world.tilemap.get_cell(0,1), 0) + assert_eq(world.tilemap.get_cell(0,2), 1) + + # Test New Additions + world.on_tile_update({ + "1" : { + "6" : "0", + "7" : "1" + } + }, false) + + assert_eq(world.tilemap.get_cell(1,6), 0) + assert_eq(world.tilemap.get_cell(1,7), 1)