diff --git a/battle_srv/api/v1/player.go b/battle_srv/api/v1/player.go index 997727c..85e2dca 100644 --- a/battle_srv/api/v1/player.go +++ b/battle_srv/api/v1/player.go @@ -85,40 +85,35 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { c.Set(api.RET, Constants.RetCode.SmsCaptchaRequestedTooFrequently) return } - Logger.Info("A new SmsCaptcha record is needed for: ", zap.String("key", redisKey)) pass := false var succRet int if Conf.General.ServerEnv == SERVER_ENV_TEST { player, err := models.GetPlayerByName(req.Num) + Logger.Info("A new SmsCaptcha record is needed for: ", zap.String("key", redisKey), zap.Any("player", player)) if nil == err && nil != player { pass = true succRet = Constants.RetCode.IsTestAcc } } - if !pass { - player, err := models.GetPlayerByName(req.Num) - if nil == err && nil != player { - pass = true - succRet = Constants.RetCode.IsBotAcc - } - } - - if !pass { - if RE_PHONE_NUM.MatchString(req.Num) { - succRet = Constants.RetCode.Ok - pass = true - } - if req.CountryCode == "86" { - if RE_CHINA_PHONE_NUM.MatchString(req.Num) { - succRet = Constants.RetCode.Ok - pass = true - } else { - succRet = Constants.RetCode.InvalidRequestParam - pass = false + /* + // Real phonenum is not supported yet! + if !pass { + if RE_PHONE_NUM.MatchString(req.Num) { + succRet = Constants.RetCode.Ok + pass = true + } + if req.CountryCode == "86" { + if RE_CHINA_PHONE_NUM.MatchString(req.Num) { + succRet = Constants.RetCode.Ok + pass = true + } else { + succRet = Constants.RetCode.InvalidRequestParam + pass = false + } + } } - } - } + */ if !pass { c.Set(api.RET, Constants.RetCode.InvalidRequestParam) return @@ -481,16 +476,6 @@ func (p *playerController) maybeCreateNewPlayer(req smsCaptchaReq) (*models.Play Logger.Info("Got a test env player:", zap.Any("phonenum", req.Num), zap.Any("playerId", player.Id)) return player, nil } - } else { - botPlayer, err := models.GetPlayerByName(req.Num) - if err != nil { - Logger.Error("Seeking bot player error:", zap.Error(err)) - return nil, err - } - if botPlayer != nil { - Logger.Info("Got a bot player:", zap.Any("phonenum", req.Num), zap.Any("playerId", botPlayer.Id)) - return botPlayer, nil - } } bind, err := models.GetPlayerAuthBinding(Constants.AuthChannel.Sms, extAuthID) diff --git a/battle_srv/api/v1/player_test.go b/battle_srv/api/v1/player_test.go index 4d8b153..5413c1c 100644 --- a/battle_srv/api/v1/player_test.go +++ b/battle_srv/api/v1/player_test.go @@ -74,7 +74,7 @@ func Test_SMSCaptchaGet_illegalPhone(t *testing.T) { func Test_SMSCaptchaGet_testAcc(t *testing.T) { player, err := getTestPlayer() - if err == nil && player != nil { + if nil == err && nil != player { resp := mustDoSmsCaptchaGetReq(fakeSMSCaptchReq(player.Name), t) if resp.Ret != Constants.RetCode.IsTestAcc { t.Fail() diff --git a/battle_srv/models/room.go b/battle_srv/models/room.go index 9ebc48e..0b5b399 100644 --- a/battle_srv/models/room.go +++ b/battle_srv/models/room.go @@ -801,7 +801,7 @@ func (pR *Room) OnDismissed() { pR.PlayerSignalToCloseDict = make(map[int32]SignalToCloseConnCbType) pR.PlayerSecondarySignalToCloseDict = make(map[int32]SignalToCloseConnCbType) pR.JoinIndexBooleanArr = make([]bool, pR.Capacity) - pR.RenderCacheSize = 256 + pR.RenderCacheSize = 1024 pR.RenderFrameBuffer = resolv.NewRingBuffer(pR.RenderCacheSize) pR.InputsBuffer = resolv.NewRingBuffer((pR.RenderCacheSize >> 1) + 1) pR.rdfIdToActuallyUsedInput = make(map[int32]*pb.InputFrameDownsync) diff --git a/frontend/assets/resources/prefabs/FindingPlayer.prefab b/frontend/assets/resources/prefabs/FindingPlayer.prefab index c00611f..1fef272 100644 --- a/frontend/assets/resources/prefabs/FindingPlayer.prefab +++ b/frontend/assets/resources/prefabs/FindingPlayer.prefab @@ -241,7 +241,7 @@ "ctor": "Float64Array", "array": [ -379.577, - 90.576, + 140, 0, 0, 0, @@ -468,7 +468,7 @@ "ctor": "Float64Array", "array": [ 0, - -68.939, + -13.057, 0, 0, 0, diff --git a/frontend/assets/scenes/login.fire b/frontend/assets/scenes/login.fire index ac65035..3a227ba 100644 --- a/frontend/assets/scenes/login.fire +++ b/frontend/assets/scenes/login.fire @@ -461,7 +461,7 @@ "array": [ 0, 0, - 210.43877906529718, + 209.57814771583418, 0, 0, 0, diff --git a/frontend/assets/scenes/offline_map.fire b/frontend/assets/scenes/offline_map.fire index 4dd19fa..113795d 100644 --- a/frontend/assets/scenes/offline_map.fire +++ b/frontend/assets/scenes/offline_map.fire @@ -518,7 +518,7 @@ "array": [ 0, 0, - 210.43877906529718, + 217.5376534000385, 0, 0, 0, diff --git a/frontend/assets/scripts/Map.js b/frontend/assets/scripts/Map.js index 93ec351..2d8b251 100644 --- a/frontend/assets/scripts/Map.js +++ b/frontend/assets/scripts/Map.js @@ -865,13 +865,20 @@ cc.Class({ _markConfirmationIfApplicable() { const self = this; let newAllConfirmedCnt = 0; - while (self.recentInputCache.GetStFrameId() <= self.lastAllConfirmedInputFrameId && self.lastAllConfirmedInputFrameId < self.recentInputCache.GetEdFrameId()) { - const inputFrameDownsync = self.recentInputCache.GetByFrameId(self.lastAllConfirmedInputFrameId); + let candidateInputFrameId = (self.lastAllConfirmedInputFrameId + 1); + if (candidateInputFrameId < self.recentInputCache.GetStFrameId()) { + candidateInputFrameId = self.recentInputCache.GetStFrameId(); + } + while (self.recentInputCache.GetStFrameId() <= candidateInputFrameId && candidateInputFrameId < self.recentInputCache.GetEdFrameId()) { + const inputFrameDownsync = gopkgs.GetInputFrameDownsync(self.recentInputCache, candidateInputFrameId); if (null == inputFrameDownsync) break; - if (self._allConfirmed(inputFrameDownsync.ConfirmedList)) break; - ++self.lastAllConfirmedInputFrameId; + if (self._allConfirmed(inputFrameDownsync.GetConfirmedList())) break; + ++candidateInputFrameId; ++newAllConfirmedCnt; } + if (0 < newAllConfirmedCnt) { + self.lastAllConfirmedInputFrameId = candidateInputFrameId; + } return newAllConfirmedCnt; }, @@ -897,19 +904,17 @@ cc.Class({ continue; } // [WARNING] Now that "inputFrameDownsyncId > self.lastAllConfirmedInputFrameId", we should make an update immediately because unlike its backend counterpart "Room.LastAllConfirmedInputFrameId", the frontend "mapIns.lastAllConfirmedInputFrameId" might inevitably get gaps among discrete values due to "either type#1 or type#2 forceConfirmation" -- and only "onInputFrameDownsyncBatch" can catch this! - self.lastAllConfirmedInputFrameId = inputFrameDownsyncId; - - const localInputFrame = self.recentInputCache.GetByFrameId(inputFrameDownsyncId); + const localInputFrame = gopkgs.GetInputFrameDownsync(self.recentInputCache, inputFrameDownsyncId); if (null != localInputFrame && null == firstPredictedYetIncorrectInputFrameId && - !self.equalInputLists(localInputFrame.InputList, inputFrameDownsync.inputList) + !self.equalInputLists(localInputFrame.GetInputList(), inputFrameDownsync.inputList) ) { firstPredictedYetIncorrectInputFrameId = inputFrameDownsyncId; } // [WARNING] Take all "inputFrameDownsync" from backend as all-confirmed, it'll be later checked by "rollbackAndChase". - inputFrameDownsync.confirmedList = (1 << self.playerRichInfoDict.size) - 1; + inputFrameDownsync.confirmedList = (1 << window.boundRoomCapacity) - 1; const inputFrameDownsyncLocal = gopkgs.NewInputFrameDownsync(inputFrameDownsync.inputFrameId, inputFrameDownsync.inputList, inputFrameDownsync.confirmedList); // "battle.InputFrameDownsync" in "jsexport" for (let j in self.playerRichInfoArr) { const jj = parseInt(j); @@ -1007,7 +1012,7 @@ fromUDP=${fromUDP}`); // the returned "gopkgs.NewInputFrameDownsync.InputList" is immutable, thus we can only modify the values in "newInputList" and "newConfirmedList"! let newInputList = existingInputFrame.InputList.slice(); newInputList[peerJoinIndex - 1] = peerEncodedInput; - let newConfirmedList = (existingInputFrame.ConfirmedList | peerJoinIndex); + let newConfirmedList = (existingInputFrame.ConfirmedList | peerJoinIndexMask); const newInputFrameDownsyncLocal = gopkgs.NewInputFrameDownsync(inputFrameId, newInputList, newConfirmedList); //console.log(`Updated encoded input of peerJoinIndex=${peerJoinIndex} to ${peerEncodedInput} for inputFrameId=${inputFrameId}/renderedInputFrameIdUpper=${renderedInputFrameIdUpper} from ${JSON.stringify(inputFrame)}; newInputFrameDownsyncLocal=${self.gopkgsInputFrameDownsyncStr(newInputFrameDownsyncLocal)}; existingInputFrame=${self.gopkgsInputFrameDownsyncStr(existingInputFrame)}`); self.recentInputCache.SetByFrameId(newInputFrameDownsyncLocal, inputFrameId);