Skip to content

GameFi runtime and mobile web game performance roadmap #76

Description

@Jim8y

English

This issue defines a focused roadmap for improving OneGate as a high-performance GameFi/mobile web game runtime while avoiding overlap with existing PRs and avoiding previously rejected directions from Erik/admin review.

Related context: #36 covers first-party OneGate Experiences compatible with current web dApps. This issue is narrower: game runtime performance, game developer requirements, and GameFi integration quality.

Current PR overlap audit

The following open PRs already cover adjacent work and should not be duplicated here:

Erik/admin review guardrails

Future PRs from this roadmap must respect these constraints from historical Erik/admin feedback:

Proposed PR sequence

Each PR must be independently reviewable, must avoid unrelated refactors, and must include Android + iOS simulator validation with screenshots posted in the PR comments only.

1. Game Runtime Mode

Scope: Add a dedicated runtime mode for game dApps: immersive/fullscreen container, safe exit affordance, orientation handling, safe-area handling, and minimized app chrome.

Why: Heavy games need more screen space and fewer layout interruptions than normal dApps. This is different from the rejected trust bar (#47): it removes chrome instead of adding a persistent bar.

Acceptance: Android and iOS simulator launch a game dApp in runtime mode; normal dApps remain unchanged; no game-specific UI adaptation is hardcoded.

2. Game Runtime Lifecycle Controls

Scope: Pause/resume hooks, background/foreground handling, audio suspension/resume, WebGL context-loss detection messaging, and reload recovery affordance.

Why: Mobile WebView games are sensitive to lifecycle changes. OneGate should help the runtime recover cleanly without owning the game's internal UI.

Acceptance: Runtime exposes lifecycle events to dApps and handles app background/foreground transitions without crashing.

3. Game Performance HUD for Developer Mode

Scope: Add a developer-only HUD for game dApps showing FPS estimate, long-frame count, load timing, WebGL support/context-loss status, and current URL/origin.

Why: Game performance issues need concrete metrics. The HUD must be developer-only so it does not repeat the rejected always-visible trust bar pattern.

Acceptance: HUD is hidden unless developer mode is enabled; screenshots show metrics on Android and iOS; no user-facing clutter by default.

4. Game Manifest and Capability Contract

Scope: Define a lightweight onegate-game.json manifest schema: game type, preferred orientation, fullscreen preference, asset budget, required OneGate APIs, supported input methods, and version/hash metadata.

Why: OneGate needs a predictable way to decide runtime mode and preload policy without guessing per dApp.

Acceptance: Runtime reads optional manifest metadata; missing manifest falls back to current behavior.

5. CDN Asset Budget and Cache Policy

Scope: Add documented and/or runtime-enforced budgets for initial JS/WASM, textures, audio, total first-load bytes, cache headers, and hashed filenames.

Why: Current game pain points include long white screens and heavy assets. The fix should be a game publishing contract, not ad hoc OneGate-side adaptation.

Acceptance: A developer checklist and optional runtime diagnostics warn when a game exceeds budget; no blocking behavior without explicit policy.

6. OneGate Game SDK Package

Scope: Provide a small TypeScript SDK wrapper over existing dAPI/native capabilities: wallet connect, sign/send, address picker (#72), QR scanner (#73), asset picker (#74), share (#75), fullscreen/orientation/lifecycle events.

Why: Game developers should not hand-roll bridge calls. The SDK should encode OneGate best practices while respecting NEP-21 semantics.

Acceptance: SDK sample works inside Android WebView and iOS WKWebView; SDK does not add new wallet authorization semantics that conflict with Erik's NEP-21 feedback.

7. Phaser/Pixi GameFi Starter Template

Scope: Add an external/template project or docs for a mobile-first GameFi starter using Phaser or PixiJS, TypeScript, Vite, responsive canvas, loading/progress/error states, wallet connect, and deferred chain settlement.

Why: For most OneGate games, Phaser/Pixi are better mobile-web defaults than shipping heavy desktop/Unity builds. This should guide game teams without bloating OneGate app code.

Acceptance: Template demonstrates mobile canvas sizing, resource loading, OneGate SDK usage, and a mock settlement flow.

8. Game QA Checklist and Performance Gate

Scope: Create a repeatable QA checklist for game submissions: Android/iOS simulator validation, low-end-device budget, load time, FPS/jank, memory, WebGL context loss, wallet connect/sign, orientation, offline/retry, screenshots.

Why: Game quality should be enforced before listing, not patched inside OneGate after launch.

Acceptance: Checklist is usable in PR/issue review and references current screenshot policy.

9. DApp/Game Submission Form Extension

Scope: Extend the dApp listing issue form after #70 lands to include game-specific fields: manifest URL, runtime mode, orientation, resource budget, wallet APIs used, screenshots, and licensing notes.

Why: Game submissions need more metadata than normal dApps.

Dependency: Wait for #70 to land or update #70 if reviewer prefers. Do not create a competing issue template PR before #70 is resolved.

10. Runtime Diagnostics Report Export

Scope: Add a debug action to export/copy a diagnostics summary for the current game session: URL, device, WebView platform, timing, errors, native API calls summary, and app version.

Why: Game developers need actionable reports when OneGate users report performance or wallet-integration issues.

Acceptance: Report contains no private keys, seed data, or sensitive wallet data.

Explicit non-goals

  • No OneGate-side per-game DOM/CSS adaptation for third-party dApps.
  • No persistent dApp trust bar.
  • No connected-app permission center that conflicts with NEP-21 semantics.
  • No local transaction history database.
  • No official dApp wrapper for existing dApps.
  • No broad dashboard redesign or unrelated visual polish.
  • No screenshots committed to the repository.

中文

这个 issue 定义 OneGate 作为高性能 GameFi / 移动 Web 游戏运行时的路线图,同时避免和现有 PR 重复,也避免重复做 Erik / 管理员历史上已经拒绝过的方向。

相关背景:#36 讨论的是兼容现有 web dApp 的 first-party OneGate Experiences。这个 issue 范围更窄,只关注游戏运行时性能、游戏开发规范、GameFi 钱包集成质量。

当前 PR 重合审计

以下 open PR 已经覆盖相邻工作,本 issue 后续任务不应重复:

Erik / 管理员历史意见约束

后续所有 PR 必须遵守这些历史反馈:

建议 PR 顺序

每个 PR 必须独立可 review,不混入无关重构,并且必须在 Android 和 iOS 模拟器验证,截图只放 PR 评论。

1. Game Runtime Mode

范围: 为游戏 dApp 增加专用运行模式:沉浸/fullscreen 容器、安全退出入口、方向处理、safe area、最小化普通 app chrome。

原因: 重游戏需要更多屏幕空间和更少布局干扰。这和被拒绝的 trust bar 不同:这里是减少 chrome,不是新增常驻栏。

验收: Android/iOS 模拟器能以 runtime mode 打开游戏 dApp;普通 dApp 不受影响;不写死任何具体游戏适配。

2. Game Runtime Lifecycle Controls

范围: pause/resume hooks、前后台切换、音频暂停/恢复、WebGL context lost 检测提示、reload recovery。

原因: 移动 WebView 游戏对生命周期变化敏感。OneGate 应帮助运行时恢复,而不是接管游戏内部 UI。

验收: runtime 能向 dApp 暴露 lifecycle events,前后台切换不崩溃。

3. Game Performance HUD for Developer Mode

范围: 给游戏 dApp 增加仅开发者模式可见的 HUD:FPS 估算、long frame 数量、加载耗时、WebGL 支持/context lost、当前 URL/origin。

原因: 游戏性能问题需要指标定位。HUD 默认隐藏,避免重复 trust bar 的占空间问题。

验收: 只有 developer mode 开启时显示;Android/iOS 截图展示指标;默认用户界面无额外干扰。

4. Game Manifest and Capability Contract

范围: 定义轻量 onegate-game.json:游戏类型、建议方向、是否 fullscreen、资源预算、需要的 OneGate API、输入方式、版本/hash metadata。

原因: OneGate 需要可预测地决定 runtime mode 和 preload 策略,而不是按 dApp 猜测。

验收: runtime 可读取可选 manifest;没有 manifest 时保持现有行为。

5. CDN Asset Budget and Cache Policy

范围: 为首屏 JS/WASM、纹理、音频、总首载大小、cache headers、hashed filenames 建立文档/诊断预算。

原因: 当前游戏痛点包括白屏时间长、资源过重。应通过发布规范解决,而不是 OneGate 临时适配。

验收: 有开发者 checklist;runtime diagnostics 可提示超预算;默认不做阻断。

6. OneGate Game SDK Package

范围: 做 TypeScript SDK 封装现有 dAPI/native 能力:钱包连接、签名/交易、地址簿 #72、扫码 #73、资产选择 #74、分享 #75、fullscreen/orientation/lifecycle events。

原因: 游戏开发者不应手写 bridge 调用。SDK 应编码 OneGate 最佳实践,同时尊重 NEP-21 语义。

验收: SDK 示例能在 Android WebView 和 iOS WKWebView 运行;不新增与 Erik NEP-21 反馈冲突的钱包授权语义。

7. Phaser/Pixi GameFi Starter Template

范围: 提供外部模板或 docs:Phaser/Pixi + TypeScript + Vite,移动优先 canvas、加载/进度/错误态、钱包连接、延迟链上结算。

原因: 对多数 OneGate 游戏,Phaser/Pixi 比直接上桌面化 Unity 大包更适合移动 WebView。

验收: 模板展示移动 canvas sizing、资源加载、OneGate SDK 使用、mock settlement flow。

8. Game QA Checklist and Performance Gate

范围: 制定游戏提交 QA checklist:Android/iOS 模拟器、低端机预算、加载耗时、FPS/jank、内存、WebGL context lost、钱包连接/签名、方向、离线/重试、截图。

原因: 游戏质量应该在上架前把关,而不是上线后靠 OneGate 修补。

验收: checklist 可直接用于 PR/issue review,并遵守当前截图策略。

9. DApp/Game Submission Form Extension

范围:#70 合并后扩展 dApp listing issue form,加入游戏特有字段:manifest URL、runtime mode、方向、资源预算、使用的钱包 API、截图、授权说明。

原因: 游戏提交需要比普通 dApp 更多 metadata。

依赖:#70 合并或按 reviewer 意见更新 #70。不要在 #70 未解决前再开竞争性 issue template PR。

10. Runtime Diagnostics Report Export

范围: 增加调试动作,导出/复制当前游戏 session 诊断摘要:URL、设备、WebView 平台、timing、错误、native API calls summary、app version。

原因: 当用户报告性能或钱包集成问题时,游戏开发者需要可操作的报告。

验收: 报告不包含私钥、助记词或敏感钱包数据。

明确不做

  • 不在 OneGate 侧为第三方 dApp 做逐个 DOM/CSS 适配。
  • 不做常驻 dApp trust bar。
  • 不做与 NEP-21 语义冲突的 connected apps 权限中心。
  • 不做本地交易历史数据库。
  • 不为现有 dApp 做“官方 dApp”包装。
  • 不混入 dashboard 重构或无关视觉 polish。
  • 不把截图提交进仓库。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions