services

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Tank Class Constants
	TankMaxVelocity = 6.0
	TankAccel       = 0.5
	TankDecel       = 1.0
	TankGunCooling  = 0.1
	TankMaxShield   = 50.0
	TankMaxEnergy   = 150.0
	TankRadarFOV    = 60.0

	// Scout Class Constants
	ScoutMaxVelocity = 12.0
	ScoutAccel       = 2.0
	ScoutDecel       = 3.0
	ScoutGunCooling  = 0.2
	ScoutMaxShield   = 20.0
	ScoutMaxEnergy   = 80.0
	ScoutRadarFOV    = 120.0

	// Sniper Class Constants
	SniperMaxVelocity = 8.0
	SniperAccel       = 1.0
	SniperDecel       = 2.0
	SniperGunCooling  = 0.05
	SniperMaxShield   = 30.0
	SniperMaxEnergy   = 100.0
	SniperRadarFOV    = 30.0

	// Global Constants
	RadarRange  = 800.0
	RobotRadius = 20.0 // Effective radius for collision/hit detection
)

Physics Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type GameLoop

type GameLoop struct {
	Engine    *SimulationEngine
	Ticker    *time.Ticker
	StopChan  chan bool
	Broadcast func(*pb.WorldState)
	TickRate  time.Duration
}

func NewGameLoop

func NewGameLoop(engine *SimulationEngine, tickRate time.Duration, broadcast func(*pb.WorldState)) *GameLoop

func (*GameLoop) Run

func (gl *GameLoop) Run()

func (*GameLoop) Start

func (gl *GameLoop) Start()

func (*GameLoop) Stop

func (gl *GameLoop) Stop()

type PhysicsEngine

type PhysicsEngine struct{}

PhysicsEngine handles the simulation of movement, combat, and environment rules.

func NewPhysicsEngine

func NewPhysicsEngine() *PhysicsEngine

func (*PhysicsEngine) Update

func (pe *PhysicsEngine) Update(state *pb.WorldState, arenaConfig *pb.ArenaConfig, intents map[string]*pb.BotIntent) *pb.WorldState

UpdatePhysics simulates one tick of the world

type SimulationEngine

type SimulationEngine struct {
	MatchID     string
	ArenaConfig *pb.ArenaConfig
	Bots        map[string]*pb.BotState
	Intents     map[string]*pb.BotIntent

	Bullets     []*pb.BulletState
	Events      []*pb.SimulationEvent
	Zone        *pb.ZoneState
	CurrentTick int64
	Status      pb.MatchStatus
	Physics     *PhysicsEngine
	DB          *persistence.Database
	// contains filtered or unexported fields
}

func NewSimulationEngine

func NewSimulationEngine(width, height float32, db *persistence.Database) *SimulationEngine

func (*SimulationEngine) GetBotSlice

func (e *SimulationEngine) GetBotSlice() []*pb.BotState

func (*SimulationEngine) GetWorldState

func (e *SimulationEngine) GetWorldState() *pb.WorldState

func (*SimulationEngine) SetBot

func (e *SimulationEngine) SetBot(id string, state *pb.BotState)

func (*SimulationEngine) SetBotIntent

func (e *SimulationEngine) SetBotIntent(id string, intent *pb.BotIntent)

func (*SimulationEngine) Tick

func (e *SimulationEngine) Tick() *pb.WorldState

Tick executes a single simulation step

Jump to

Keyboard shortcuts

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