GitHubLoslegen

Diese Seite ist noch nicht auf Deutsch übersetzt und wird daher auf Englisch angezeigt.

Weitere

Small downloads and fast starts

The first frame should load only what it needs. Put runtime files under resources/ and refer to them with asset: URIs. They remain outside the Go binary and the web target can fetch them on demand. Use //go:embed or assets.WithFS for small files that must be available before the resource system starts, such as a loading-screen image or a tiny startup table.

Load a small first group

Create an assets.Manager, register a group for the first scene, and mount assets.LoadingScreen while it loads. Start other groups from the first scene after the first frame so their bytes do not delay the initial view.

mgr := assets.NewManager(cx)
first := mgr.Group("first").AddImage("logo", core.Src("asset:ui/logo.png"))
later := mgr.Group("level").AddAtlas("hero", "asset:hero.json", core.Src("asset:hero.png"))
return assets.LoadingScreen{Group: first, View: loadingView, Next: func() core.Node {
		later.Load(nil)
		return gameView(mgr)
}}

resources/ files ship in release packages. mobile.exclude_resources can omit desktop-only groups from iOS and Android packages. Build DLC packs for optional content and verify them with go tool game dlc verify instead of putting every level in the first download.

Web caching and progress

Set web.offline in nsgo.yaml when a release should cache its resources after the first successful launch. The web loader reports progress through the same assets.Group.Progress signal used by LoadingScreen; replace the default view with LoadingScreen.View or LoadingView to show a branded progress bar. A Brotli and gzip copy of the WebAssembly module is written by nsgo build for servers that negotiate either encoding.

Audio and budgets

Prefer compressed .ogg, .m4a or .mp3 music and short effects over WAV files. Run go tool game size -kind wasm -budget benchmarks/web-budget.json for the WebAssembly budget and use the AAB and IPA budgets before store uploads. The report lists the largest files and categories so a new first group or dependency has an attributable cost.

See Assets, Building and Shipping and Package Size Budgets for the APIs and release checks.

Diese Seite bearbeiten