Skip to content

mrlm-net/simconnect

mrlm-net/simconnect

Go Reference Documentation

Go wrapper for SimConnect.dll — build Microsoft Flight Simulator 2020/2024 add-ons with type-safe, zero-dependency Go code.

Features

Engine — Direct SimConnect Access

  • Full SimConnect DLL binding via syscalls — zero CGo, Windows-only
  • Typed message stream via Go channels with callback handlers
  • Manual and pre-built dataset definitions across 6 domains (aircraft, environment, facilities, objects, simulator, traffic)
  • AI traffic management — create, remove, and control parked, enroute, and non-ATC aircraft with livery selection
  • Facility data queries — airports, runways, parking, frequencies, VOR, NDB, waypoints, jetways, helipads, and 14 facility types total
  • SimConnect.dll auto-detection via environment variables, SDK paths, and common installation locations

Manager — Production Lifecycle

  • Automatic connection lifecycle with reconnection and health monitoring
  • 60+ SimVar state tracking via SimState — camera, position, speed, weather, VR, environment, realism settings
  • Channel-based and callback-based subscriptions with message type filtering
  • 12 typed system event handlers — Pause, Sim, Crashed, CrashReset, Sound, View, FlightLoaded, AircraftLoaded, FlightPlanActivated, FlightPlanDeactivated, ObjectAdded, ObjectRemoved

Utilities

  • Great-circle distance (haversine), altitude/distance/speed conversions, ICAO validation, WGS84 coordinate offsets
  • Tiered buffer pooling and pre-allocated handler buffers for zero-allocation dispatching

Zero external dependencies — standard library only.

Quick Start

package main

import (
    "github.com/mrlm-net/simconnect"
)

func main() {
    client := simconnect.NewClient("MyApp", simconnect.ClientWithHeartbeat(simconnect.HEARTBEAT_6HZ))
    if err := client.Connect(); err != nil {
        panic(err)
    }
    defer client.Disconnect()
    // … interact with the simulator
}

Examples

All examples include standalone main packages with individual READMEs. Browse the examples folder or run any example directly:

go run ./examples/<name>

CLI Tools

simvar-cli

simvar-cli is a Windows command-line tool for reading, writing, and streaming MSFS SimVars directly from a terminal. It connects to a running simulator via SimConnect and supports JSON, CSV, and table output formats.

# Build from source
cd cmd/simvar-cli
go build -o simvar-cli.exe .

# Read a SimVar
simvar-cli get "PLANE ALTITUDE" feet float64

# Stream continuously as NDJSON
simvar-cli --format json watch "PLANE ALTITUDE" feet float64

# Interactive REPL
simvar-cli repl

See cmd/simvar-cli for the full README and docs/simvar-cli.md for the complete reference.

Documentation

simconnect.mrlm.net — Full documentation website with getting started guide, configuration reference, and usage guides.

Packages

  • simconnect — Main entry point — New() for managed connection, NewClient() for direct engine access
  • pkg/engine — High-level client, session lifecycle, message dispatching
  • pkg/manager — Connection manager with auto-reconnect and state tracking
  • pkg/types — Typed data structures, enums, events
  • pkg/datasets — Pre-built dataset definitions (aircraft, environment, facilities, objects, simulator, traffic)
  • pkg/convert — Unit conversions, ICAO validation, WGS84 coordinate offsets
  • pkg/calc — Calculation helpers (haversine great-circle distance)
  • pkg/registry — Cross-platform typed SimVar metadata catalogue (104 entries, no build tags)
  • cmd/simvar-cli — Interactive CLI tool for reading, writing, and streaming SimVars

Installation

go get github.com/mrlm-net/simconnect

Requirements

Requirement Version
Go 1.25+
Operating system Windows
Microsoft Flight Simulator 2020 / 2024
SimConnect SDK Bundled with MSFS

Contributing

Contributions are welcomed and must follow the Code of Conduct and common Contribution guidelines.

If you'd like to report a security issue please follow the security guidelines.

Sponsoring

This library is developed and maintained in personal time. Sponsorship helps cover the direct costs of keeping it accurate and active:

  • MSFS 2024 license — required to test against the current simulator version
  • Windows development environment — the only supported platform; ongoing hardware and OS costs
  • Documentation hosting — simconnect.mrlm.net is served from a paid static hosting account
  • Development time — research against undocumented SimConnect behaviors, writing typed wrappers, and reviewing contributions

If this library has saved you time, a one-time or recurring contribution via Revolut is appreciated. There is no obligation.

License

This project is licensed under the terms specified in the LICENSE file.


All rights reserved © Martin Hrášek <@mrlm-xyz> and WANTED.solutions s.r.o. <@wanted-solutions>

About

GoLang wrapper over SimConnect.dll SDK — build Microsoft Flight Simulator add-ons with ease.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Contributors