game

package
v0.0.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package game is the Linefire runtime: it loads a player asset and a level and runs a minimal ship-in-a-world prototype. The ship stays centered on screen always pointing up; the world rotates and translates around it (the camera follows the ship's position and heading).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(content fs.FS, player *asset.Asset, lvl *level.Level, mapDir, mapName string) error

Run opens the window and starts the game loop. content is where the game data lives (the embedded bundle, or a directory on disk); mapDir is content's map subdirectory and mapName is the current map's file stem, so portals can load sibling maps by name (and detect same-map targets).

Types

type Game

type Game struct {
	// contains filtered or unexported fields
}

Game is the ebiten.Game runtime.

func New

func New(player *asset.Asset, lvl *level.Level, mapDir string, simple bool) *Game

New builds a game from a player asset and a level. simple skips the per-area flood negative-space map and the fog-of-war (line-wall view, no discovery grid / fog texture): the procedural map uses it so a large streamed region renders fast and rebuilds cheaply on a chunk crossing. New builds a game that reads its data straight from the operating system (the default for tests and dev, which pass a directory such as "../gameassets"). Run uses newWithContent to serve the same data from the embedded bundle instead.

func NewSkirmish added in v0.0.19

func NewSkirmish(content fs.FS, mapDir string, opts SkirmishOptions) (*Game, error)

NewSkirmish builds the attract demo for a transparent desktop window: the autopilot ship (indestructible, as the attract ship always is), an endless horde, and a fresh procedurally generated arena every ~20 seconds. The caller runs it with ebiten.RunGameWithOptions and ScreenTransparent.

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

Draw renders the world around the centered, upward-pointing ship. Because the world swings by a large per-frame angle during a turn, a single still frame on a sample-and-hold display reads as a doubled line (stroboscopic stepping). To fill the gap, the moving world is accumulated over several intermediate camera poses between the previous and current frame and averaged. The ship itself is fixed at the screen center, so it is drawn once, crisp, on top.

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int)

Layout renders at the display's native pixel density: the offscreen the game draws into is sized in device pixels and mapped 1:1 to the framebuffer, so vector strokes are anti-aliased at full resolution with no resampling step.

func (*Game) Update

func (g *Game) Update() error

type SkirmishOptions added in v0.0.19

type SkirmishOptions struct {
	Sound bool // create the audio context (default silent)
	Debug bool // show the debug HUD (there is no F3 to toggle it: skirmish reads no keys)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL