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 ¶
const ( SkirmishMapArena = "arena" SkirmishMapMaze = "maze" )
Skirmish map modes: the open field is the default show; the maze is the cave generator fitted to the screen, where rock blocks sight lines and shots and the fight happens around corners.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BattleOptions ¶ added in v0.0.28
type BattleOptions struct {
Programs []string // one Filo source per faction, Programs[0] = faction 1 (empty = house brain)
Factions int // teams, clamped to 2..maxFactions (0 = 2)
Ships int // hulls per faction (0 = 8)
Map string // SkirmishMapArena (default) or SkirmishMapMaze
Seed int64 // arena generation and placement seed
MaxTicks int // battle length cap in ticks (0 = 7200: two minutes of game time)
}
RunBattle fights one skirmish without a window: the ships are placed up front, there are no reinforcements, and the simulation steps at full CPU speed until one faction stands alone or the tick budget runs out. Hundreds of battles fit in a few seconds of processing, which is what makes program development honest — a change to an AI is measured over many fights, not eyeballed over one. The graphical skirmish and this runner step the same code: updateEnemies, the Filo pilots, the shots, the damage.
Placement is deterministic for a given Seed; each hull's temperament (standoff spread, orbit direction) still draws from the game's own dice, so two runs of the same seed are close but not identical.
type BattleResult ¶ added in v0.0.28
type BattleResult struct {
Winner int // the faction left standing; 0 = draw (timeout, or mutual destruction)
Ticks int // how long the fight ran
Alive map[int]int // live hulls per faction at the end
}
BattleResult is how one fight ended.
func RunBattle ¶ added in v0.0.28
func RunBattle(content fs.FS, mapDir string, opts BattleOptions) (BattleResult, error)
RunBattle builds the battlefield, lands the fleets and fights to the end.
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game is the ebiten.Game runtime.
func New ¶
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
NewSkirmish builds the faction battle for a transparent desktop window: an endless horde dealt round-robin across the teams, and a fresh procedurally generated arena every ~20 seconds. The caller runs it with ebiten.RunGameWithOptions and ScreenTransparent.
func (*Game) Draw ¶
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.
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)
Factions int // teams sharing the arena, clamped to 2..maxFactions (0 = 2)
Map string // SkirmishMapArena (default) or SkirmishMapMaze
// Programs is one Filo SOURCE per faction (Programs[0] drives faction 1,
// and so on); an empty entry leaves that faction on the house brain. The
// contract a program flies under is pilot.go's doc. Reading files is the
// caller's job: the game takes source text.
Programs []string
}
Source Files
¶
- align.go
- ally.go
- arsenal.go
- assetcache.go
- autofire.go
- battle.go
- bonus.go
- boost.go
- bounds.go
- breakable.go
- cheats.go
- checkpoint.go
- collision.go
- combatmods.go
- credits.go
- devourer.go
- drops.go
- edge.go
- effects.go
- ending.go
- endless.go
- floattext.go
- floodmap.go
- game.go
- gamelog.go
- hud.go
- hudslots.go
- laser.go
- mapscreen.go
- mapstate.go
- materialize.go
- menu.go
- mine.go
- minimap.go
- missile.go
- music.go
- musicweb.go
- nav.go
- objective.go
- perf.go
- pilot.go
- portal.go
- powerups.go
- procedural.go
- projectile.go
- resolution.go
- results.go
- rng.go
- roundview.go
- secondary.go
- shieldmods.go
- shockwave.go
- skirmish.go
- sound.go
- soundloop.go
- spawner.go
- title.go
- touch.go
- touchdraw.go
- victory.go
- vision.go
- weapon.go
- weaponpickup.go
- websettings.go
- world.go