跳到主要内容Skip to main content

学习路径Learning path · 第 5 阶段Stage 5

存档与离线行为

Save and offline behaviour

**这一步决定什么****What this stage decides**:这两个是最容易在上线后才发现的问题,而且都会直接让玩家流失。: These are the two things you discover after launch, and both of them lose players directly.

**本站的判断****Our judgement**:发布前必须测:刷新页面后进度还在吗?断网了会崩还是优雅降级?: Before shipping, test: does progress survive a refresh, and does going offline crash or degrade gracefully?

性质:本站的判断,未经实测Nature: the site's judgement, not measured

一句话:这两个是「开发机上永远正常、上线后立刻出问题」的东西。

In one line: these are the two things that are "always fine on the dev machine and broken the moment you ship".

存档的四个坑

坑症状原因
⚠ 平台存储 API 不可用刷新后进度没了原生 API 在 Web 上常常不可用
⚠ 存储配额超限到某个关卡就崩localStorage 通常只有 5MB
⚠ 隐私模式玩家说「我存不了」隐私模式下存储受限
⚠ 版本不兼容更新后读不了旧档存档格式变了没做迁移

Four ways saves break

TrapSymptomCause
⚠ The platform's storage API is unavailableProgress gone after a refreshNative APIs are often unavailable on the web

| ⚠ Storage quota exceeded | Crashes at a certain level | localStorage is typically only 5 MB |

| ⚠ Private browsing | Players report "I can't save" | Storage is restricted in private mode |

| ⚠ Version incompatibility | Old saves unreadable after an update | The format changed with no migration |

⚠ 离线的三种处理

做法适用
优雅降级⚠ 断网时提示「需要网络」并暂停
本地优先离线可玩,联网后同步
拒绝启动强联网游戏(但 ⚠ 要给清晰提示)

⚠ 最差的做法是崩溃 —— 玩家不会给你第二次机会。

⚠ Three ways to handle being offline

ApproachWhen it fits
Graceful degradation⚠ Show "needs network" and pause
Local-firstPlayable offline, syncs when connected
Refuse to startStrictly online games (but ⚠ give a clear message)

⚠ The worst option is crashing — a player will not give you a second chance.

发布前必测清单

  • ⚠ 刷新页面后进度还在
  • ⚠ 存档满了会怎样(填满一个存档,看会不会崩)
  • ⚠ 断网后会怎样(飞行模式打开游戏)
  • ⚠ 更新版本后旧档能读吗
  • ⚠ 隐私模式下能玩吗

⚠ 这五条在开发机上全部正常 —— 因为开发机有正常的存储、有网络、

不涉及隐私模式。⚠ 必须用手机测,且开飞行模式。

The pre-ship checklist

  • ⚠ Progress survives a page refresh

[ ] ⚠ What happens when a save fills up (fill one and see if it crashes)

  • ⚠ What happens offline (open the game in aeroplane mode)
  • ⚠ Can old saves be read after an update
  • ⚠ Does it work in private browsing

⚠ All five pass on the dev machine — it has normal storage, a network, and no private mode. ⚠ Test on a phone, in aeroplane mode.

常见失败

  • ⚠ 只在开发机测 —— 开发机什么都是正常的
  • 忘了隐私模式 —— 相当一部分玩家会开
  • ⚠ 更新时不做存档迁移 —— 玩家会丢掉全部进度,然后不会再玩

Common failures

  • ⚠ Testing only on the dev machine — everything is normal there
  • Forgetting private browsing — a fair number of players use it
  • ⚠ No save migration on update — players lose all progress and do not come back