Documentation ¶
Index ¶
- Constants
- Variables
- func ChangeScene[C any](ctx *Context, c gscene.Controller[C])
- type ArtifactDesign
- type BotProg
- type Context
- type Damage
- type InstructionKind
- type Level
- type OnDamageData
- type ProgBranch
- type ProgInstruction
- type ProgInstructionInfo
- type ProgThread
- type Projectile
- type SavedVessel
- type Session
- type ThreadKind
- type Vessel
- type VesselDesign
- type Weapon
- type WeaponDesign
- type WeaponFiringType
- type World
Constants ¶
View Source
const ( MaxBranches = 3 MaxInstructions = 10 )
Variables ¶
View Source
var ArtifactDesignList = []*ArtifactDesign{ { Name: "E-Shield", Icon: assets.ImageItemEnergyShield, ApplyBonus: func(v *Vessel) { v.EnergyResist += 0.15 }, }, { Name: "K-Shield", Icon: assets.ImageItemKineticShield, ApplyBonus: func(v *Vessel) { v.KineticResist += 0.25 }, }, { Name: "T-Shield", Icon: assets.ImageItemThermalShield, ApplyBonus: func(v *Vessel) { v.ThermalResist += 0.2 }, }, }
View Source
var InstOrder = []InstructionKind{ NopInstruction, RandomPosInstruction, RandomOffsetInstruction, VesselPosInstruction, TargetPosInstruction, CenterPosInstruction, ChanceInstruction, IsLtInstruction, IsGtInstruction, IsOutBoundsInstruction, EnergyPercentInstruction, HealthPercentInstruction, DistanceToInstruction, TargetSpeedInstruction, WaitInstruction, RotateToInstruction, MoveForwardInstruction, MoveAndRotateInstruction, SnapShotInstruction, NormalShotInstruction, AimShotInstruction, }
View Source
var Levels = []*Level{ { Dist: 160, Enemy: assets.RawLevel1EnemyJSON, }, { Dist: 64, Enemy: assets.RawLevel2EnemyJSON, }, { Dist: 256, Enemy: assets.RawLevel3EnemyJSON, }, { Dist: 32, Enemy: assets.RawLevel4EnemyJSON, }, { Dist: 320, Enemy: assets.RawLevel5EnemyJSON, }, { Dist: 96, Enemy: assets.RawLevel6EnemyJSON, }, }
View Source
var ProgInstInfoTab = func() []*ProgInstructionInfo { insts := []*ProgInstructionInfo{ NopInstruction: {}, RandomPosInstruction: {Icon: assets.ImageIconRandomPos, Mask: anyThreadMask, StackChange: +1, StackOutType: "vec2"}, RandomOffsetInstruction: {Icon: assets.ImageIconRandomOffset, Param: true, MaxParam: 999, DefaultParam: 32, Mask: anyThreadMask, StackInType: "vec2", StackOutType: "vec2"}, VesselPosInstruction: {Icon: assets.ImageIconSelfPos, Mask: anyThreadMask, StackChange: +1, StackOutType: "vec2"}, TargetPosInstruction: {Icon: assets.ImageIconTargetPos, Mask: anyThreadMask, StackChange: +1, StackOutType: "vec2"}, CenterPosInstruction: {Icon: assets.ImageIconCenterPos, Mask: anyThreadMask, StackChange: +1, StackOutType: "vec2"}, ChanceInstruction: {Icon: assets.ImageIconRand, Param: true, MaxParam: 100, DefaultParam: 50, Cond: true, Mask: anyThreadMask}, IsLtInstruction: {Icon: assets.ImageIconIsLt, Param: true, MaxParam: 9999, DefaultParam: 50, Cond: true, Mask: anyThreadMask, StackChange: -1, StackInType: "float"}, IsGtInstruction: {Icon: assets.ImageIconIsGt, Param: true, MaxParam: 9999, DefaultParam: 50, Cond: true, Mask: anyThreadMask, StackChange: -1, StackInType: "float"}, IsOutBoundsInstruction: {Icon: assets.ImageIconIsOutOfBounds, Cond: true, Mask: anyThreadMask, StackChange: -1, StackInType: "vec2"}, DistanceToInstruction: {Icon: assets.ImageIconDistanceTo, Mask: anyThreadMask, StackChange: 0, StackInType: "vec2", StackOutType: "float"}, TargetSpeedInstruction: {Icon: assets.ImageIconTargetSpeed, Mask: anyThreadMask, StackChange: 0, StackOutType: "float"}, HealthPercentInstruction: {Icon: assets.ImageIconSelfHealthPercent, Mask: anyThreadMask, StackChange: +1, StackOutType: "float"}, EnergyPercentInstruction: {Icon: assets.ImageIconSelfEnergyPercent, Mask: anyThreadMask, StackChange: +1, StackOutType: "float"}, WaitInstruction: {Icon: assets.ImageIconWait, Mask: anyThreadMask, Param: true, MaxParam: 9999, DefaultParam: 30}, RotateToInstruction: {Icon: assets.ImageIconRotateTo, Mask: MovementThread, StackChange: -1, StackInType: "vec2"}, MoveForwardInstruction: {Icon: assets.ImageIconMoveForward, Param: true, MaxParam: 999, DefaultParam: 100, Mask: MovementThread}, MoveAndRotateInstruction: {Icon: assets.ImageIconMoveAndRotate, Param: true, MaxParam: 999, DefaultParam: 100, Mask: MovementThread, StackChange: -1, StackInType: "vec2"}, SnapShotInstruction: {Icon: assets.ImageIconSnapShot, Mask: anyWeaponMask}, NormalShotInstruction: {Icon: assets.ImageIconNormalShot, Mask: anyWeaponMask}, AimShotInstruction: {Icon: assets.ImageIconAimShot, Mask: anyWeaponMask}, } for kind, inst := range insts { inst.Kind = InstructionKind(kind) } return insts }()
View Source
var VesselDesignList = []*VesselDesign{ { Image: assets.ImageVesselSmall1, Name: "Machpella", RotationSpeed: 2, MaxSpeed: 140, Acceleration: 160, MaxHealth: 30, MaxEnergy: 70, EnergyRegen: 6, HitboxSize: 4, KineticResist: 0.1, EnergyResist: 0.1, ThermalResist: 0.1, }, { Image: assets.ImageVesselNormal1, Name: "Fighter", RotationSpeed: 2.5, MaxSpeed: 110, Acceleration: 150, MaxHealth: 40, MaxEnergy: 50, EnergyRegen: 4, HitboxSize: 12, KineticResist: 0.3, EnergyResist: 0.2, ThermalResist: 0, }, { Image: assets.ImageVesselLarge1, Name: "Destroyer", RotationSpeed: 1.6, MaxSpeed: 90, Acceleration: 200, MaxHealth: 70, MaxEnergy: 90, EnergyRegen: 3, HitboxSize: 20, KineticResist: 0.1, EnergyResist: 0.5, ThermalResist: 0.3, }, { Image: assets.ImageVesselLarge2, Name: "Boss", RotationSpeed: 1.8, MaxSpeed: 90, Acceleration: 150, MaxHealth: 120, MaxEnergy: 170, EnergyRegen: 6, HitboxSize: 18, KineticResist: 0.2, EnergyResist: 0.5, ThermalResist: 0.5, }, }
View Source
var WeaponDesignList = []*WeaponDesign{ { Name: "Pusher", EnergyCost: 10, Reload: 2.0, Damage: Damage{Energy: 2, Kinetic: 2}, FiringType: TargetableWeapon, FireSound: assets.AudioFirePusher1, ProjectileImage: assets.ImageProjectilePusher, ProjectileSpeed: 500, MaxRange: 240, ProjectileImpactArea: 8, CollisionCheck: true, ImpactImage: assets.ImageImpactPusher, Burst: 1, MinLevel: 0, }, { Name: "Scatter Gun", EnergyCost: 0, Reload: 1.6, Damage: Damage{Kinetic: 2}, FiringType: TargetableWeapon, FireSound: assets.AudioFireScatter1, ProjectileImage: assets.ImageProjectileScatter, ProjectileSpeed: 300, MaxRange: 240, ProjectileImpactArea: 5, Burst: 7, MinLevel: 0, }, { Name: "Pulse Laser", BuyCost: 120, EnergyCost: 5, Reload: 0.45, Damage: Damage{Energy: 3}, FiringType: TargetableWeapon, FireSound: assets.AudioFireLaser1, ProjectileImage: assets.ImageProjectileLaser, ProjectileSpeed: 400, MaxRange: 250, ProjectileImpactArea: 8, ImpactImage: assets.ImageImpactLaser, Burst: 1, MinLevel: 0, }, { Name: "Ion Cannon", EnergyCost: 4, Reload: 0.5, Damage: Damage{Energy: 1, DrainEnergy: 8}, FiringType: TargetableWeapon, FireSound: assets.AudioFireIon1, ProjectileImage: assets.ImageProjectileIon, ProjectileSpeed: 450, MaxRange: 350, ProjectileImpactArea: 6, ImpactImage: assets.ImageImpactIon, Burst: 1, MinLevel: 1, }, { Name: "Plasma Cannon", BuyCost: 150, EnergyCost: 4, Reload: 0.7, Damage: Damage{Energy: 2, Thermal: 4}, FiringType: TargetableWeapon, FireSound: assets.AudioFirePlasma1, ProjectileImage: assets.ImageProjectilePlasma, ProjectileSpeed: 225, MaxRange: 300, ProjectileImpactArea: 10, ImpactImage: assets.ImageImpactPlasma, Burst: 1, MinLevel: 1, }, { Name: "Lancer", EnergyCost: 16, Reload: 1.0, Damage: Damage{Energy: 12}, FiringType: FixedAngleWeapon, FireSound: assets.AudioFireLancer1, ProjectileImage: assets.ImageProjectileLancer, ProjectileSpeed: 420, MaxRange: 400, ProjectileImpactArea: 8, CollisionCheck: true, ImpactImage: assets.ImageImpactLancer, Burst: 1, MinLevel: 2, }, { Name: "Freezer", EnergyCost: 20, Reload: 1, Damage: Damage{Energy: 1, Slow: 4}, FiringType: TargetableWeapon, FireSound: assets.AudioFireFreezer1, ProjectileImage: assets.ImageProjectileFreezer, ProjectileSpeed: 300, MaxRange: 250, ProjectileImpactArea: 8, ImpactImage: assets.ImageImpactFreezer, Burst: 1, CollisionCheck: true, Homing: 120, MinLevel: 2, }, { Name: "Missile Launcher", Reload: 4, Damage: Damage{Thermal: 5}, FiringType: FixedAngleWeapon, FireSound: assets.AudioFireMissile1, ProjectileImage: assets.ImageProjectileMissile, ProjectileSpeed: 160, MaxRange: 450, ProjectileImpactArea: 8, ImpactImage: assets.ImageImpactMissile, Burst: 2, CollisionCheck: true, Homing: 100, MinLevel: 2, }, }
Functions ¶
func ChangeScene ¶
func ChangeScene[C any](ctx *Context, c gscene.Controller[C])
Types ¶
type ArtifactDesign ¶
func FindArtifactDesignByName ¶
func FindArtifactDesignByName(name string) *ArtifactDesign
type BotProg ¶
type BotProg struct { MovementThread *ProgThread Weapon1Thread *ProgThread Weapon2Thread *ProgThread DefThread *ProgThread }
func NewBotProg ¶
func NewBotProg() *BotProg
func (*BotProg) EachThread ¶
func (p *BotProg) EachThread(f func(i int, t *ProgThread))
func (*BotProg) NumThreads ¶
type Context ¶
type Context struct { WindowSize gmath.Vec Loader *resource.Loader UIResources *eui.Resources GraphicsCache *graphics.Cache AudioSystem gaudio.System Rand gmath.Rand Session *Session CRT bool // contains filtered or unexported fields }
func NewContext ¶
func NewContext() *Context
func (*Context) CurrentScene ¶
func (ctx *Context) CurrentScene() gscene.GameRunner
type InstructionKind ¶
type InstructionKind int
const ( NopInstruction InstructionKind = iota RandomPosInstruction RandomOffsetInstruction VesselPosInstruction TargetPosInstruction CenterPosInstruction ChanceInstruction IsLtInstruction IsGtInstruction IsOutBoundsInstruction EnergyPercentInstruction HealthPercentInstruction DistanceToInstruction RotateToInstruction MoveForwardInstruction MoveAndRotateInstruction SnapShotInstruction NormalShotInstruction WaitInstruction AimShotInstruction TargetSpeedInstruction )
type OnDamageData ¶
type ProgBranch ¶
type ProgBranch struct {
Instructions []ProgInstruction
}
func (*ProgBranch) Compact ¶
func (b *ProgBranch) Compact() *ProgBranch
type ProgInstruction ¶
type ProgInstruction struct { Info *ProgInstructionInfo Param float64 }
func MakeInst ¶
func MakeInst(kind InstructionKind, param float64) ProgInstruction
func (ProgInstruction) MarshalJSON ¶
func (inst ProgInstruction) MarshalJSON() ([]byte, error)
func (*ProgInstruction) SetParam ¶
func (inst *ProgInstruction) SetParam(v float64)
func (*ProgInstruction) UnmarshalJSON ¶
func (inst *ProgInstruction) UnmarshalJSON(data []byte) error
type ProgInstructionInfo ¶
type ProgThread ¶
type ProgThread struct { Kind ThreadKind Branches []*ProgBranch }
func (*ProgThread) Compact ¶
func (t *ProgThread) Compact() *ProgThread
type Projectile ¶
type Projectile struct { Weapon *WeaponDesign Pos gmath.Vec Rotation gmath.Rad }
type SavedVessel ¶
type Session ¶
type Session struct { Level int Prog *BotProg Weapons []*WeaponDesign VesselDesign *VesselDesign ArtifactDesign *ArtifactDesign }
func NewSession ¶
func NewSession() *Session
type ThreadKind ¶
type ThreadKind int
const ( MovementThread ThreadKind = 1 << iota Weapon1Thread Weapon2Thread DefThread )
type Vessel ¶
type Vessel struct { Alliance int Pos gmath.Vec EngineVelocity gmath.Vec ExtraVelocity gmath.Vec Rotation gmath.Rad Health float64 Energy float64 Slow float64 Prog *BotProg Target *Vessel Weapons []*Weapon Artifact *ArtifactDesign EnergyResist float64 KineticResist float64 ThermalResist float64 Design VesselDesign EventOnDamage gsignal.Event[OnDamageData] EventDestroyed gsignal.Event[*Vessel] // Vessel arg is attacker }
type VesselDesign ¶
type VesselDesign struct { Image resource.ImageID Name string RotationSpeed gmath.Rad MaxHealth float64 MaxEnergy float64 EnergyRegen float64 MaxSpeed float64 Acceleration float64 EnergyResist float64 KineticResist float64 ThermalResist float64 HitboxSize float64 }
func FindVesselDesignByName ¶
func FindVesselDesignByName(name string) *VesselDesign
type Weapon ¶
type Weapon struct { Reload float64 // Cooldown before it can fire again Design *WeaponDesign }
type WeaponDesign ¶
type WeaponDesign struct { Name string EnergyCost float64 // Per shot BuyCost int Reload float64 // Base value (doesn't take multipliers into account) Damage Damage FiringType WeaponFiringType CollisionCheck bool Homing float64 FireSound resource.AudioID MaxRange float64 ProjectileImage resource.ImageID Burst int ProjectileSpeed float64 ProjectileImpactArea float64 ImpactImage resource.ImageID MinLevel int }
func FindWeaponDesignByName ¶
func FindWeaponDesignByName(name string) *WeaponDesign
type WeaponFiringType ¶
type WeaponFiringType int
const ( TargetableWeapon WeaponFiringType = iota FixedAngleWeapon )
Click to show internal directories.
Click to hide internal directories.