Minor fix on backend coordinate ratio conversion.

This commit is contained in:
genxium 2022-11-13 12:52:17 +08:00
parent 4369729d9c
commit b031fc1c61
5 changed files with 11 additions and 6 deletions

View File

@ -14,7 +14,7 @@ _(in game screenshot)_
![screenshot-1](./charts/screenshot-1.png) ![screenshot-1](./charts/screenshot-1.png)
Please checkout [this demo video](https://pan.baidu.com/s/123LlWcT9X-wbcYybqYnvmA?pwd=qrlw) to see whether the source codes are doing what you expect for synchronization. Please checkout [this demo video](https://pan.baidu.com/s/1YkfuHjNLzlFVnKiEj6wrDQ?pwd=tkr5) to see whether the source codes are doing what you expect for synchronization.
The video mainly shows the following features. The video mainly shows the following features.
- The backend receives inputs from frontend peers and [by a GGPO-alike manner](https://github.com/pond3r/ggpo/blob/master/doc/README.md) broadcasts back for synchronization. - The backend receives inputs from frontend peers and [by a GGPO-alike manner](https://github.com/pond3r/ggpo/blob/master/doc/README.md) broadcasts back for synchronization.

View File

@ -790,9 +790,9 @@ func (pR *Room) Dismiss() {
func (pR *Room) OnDismissed() { func (pR *Room) OnDismissed() {
// Always instantiates new HeapRAM blocks and let the old blocks die out due to not being retained by any root reference. // Always instantiates new HeapRAM blocks and let the old blocks die out due to not being retained by any root reference.
pR.WorldToVirtualGridRatio = float64(10) pR.WorldToVirtualGridRatio = float64(1000)
pR.VirtualGridToWorldRatio = float64(1.0) / pR.WorldToVirtualGridRatio // this is a one-off computation, should avoid division in iterations pR.VirtualGridToWorldRatio = float64(1.0) / pR.WorldToVirtualGridRatio // this is a one-off computation, should avoid division in iterations
pR.PlayerDefaultSpeed = 20 // Hardcoded in virtual grids per frame pR.PlayerDefaultSpeed = int32(float64(2) * pR.WorldToVirtualGridRatio) // in virtual grids per frame
pR.Players = make(map[int32]*Player) pR.Players = make(map[int32]*Player)
pR.PlayersArr = make([]*Player, pR.Capacity) pR.PlayersArr = make([]*Player, pR.Capacity)
pR.CollisionSysMap = make(map[int32]*resolv.Object) pR.CollisionSysMap = make(map[int32]*resolv.Object)

View File

@ -16,6 +16,7 @@ import (
"time" "time"
. "dnmshared" . "dnmshared"
"runtime/debug"
) )
const ( const (
@ -104,7 +105,7 @@ func Serve(c *gin.Context) {
} }
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
Logger.Warn("Recovered from: ", zap.Any("panic", r)) Logger.Error("Recovered from: ", zap.Any("panic", r))
} }
}() }()
/** /**
@ -356,7 +357,7 @@ func Serve(c *gin.Context) {
receivingLoopAgainstPlayer := func() error { receivingLoopAgainstPlayer := func() error {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
Logger.Warn("Goroutine `receivingLoopAgainstPlayer`, recovery spot#1, recovered from: ", zap.Any("panic", r)) Logger.Error("Goroutine `receivingLoopAgainstPlayer`, recovery spot#1, recovered from: ", zap.Any("panic", r), zap.Any("callstack", debug.Stack()))
} }
Logger.Info("Goroutine `receivingLoopAgainstPlayer` is stopped for:", zap.Any("playerId", playerId), zap.Any("roomId", pRoom.Id)) Logger.Info("Goroutine `receivingLoopAgainstPlayer` is stopped for:", zap.Any("playerId", playerId), zap.Any("roomId", pRoom.Id))
}() }()

View File

@ -352,7 +352,7 @@ cc.Class({
window.mapIns = self; window.mapIns = self;
window.forceBigEndianFloatingNumDecoding = self.forceBigEndianFloatingNumDecoding; window.forceBigEndianFloatingNumDecoding = self.forceBigEndianFloatingNumDecoding;
self.showCriticalCoordinateLabels = true; self.showCriticalCoordinateLabels = false;
console.warn("+++++++ Map onLoad()"); console.warn("+++++++ Map onLoad()");
window.handleClientSessionError = function() { window.handleClientSessionError = function() {

View File

@ -30,6 +30,10 @@ cc.Class({
'2-1': 'attackedRight' '2-1': 'attackedRight'
}; };
this.arrowTipNode.active = false; this.arrowTipNode.active = false;
if (!this.mapIns.showCriticalCoordinateLabels) {
this.coordLabel.node.active = false;
}
}, },
showArrowTipNode() { showArrowTipNode() {