rvglutils

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 12 Imported by: 0

README

rvgl-utils CI godoc goreportcard

Tools for tracking scores in RVGL sessions.

Install

From a release.

Using brew:

brew install frantjc/tap/forge

Using go:

go install github.com/frantjc/forge/cmd/forge

From source:

git clone https://github.com/frantjc/rvgl-utils
cd rvgl-utils
go install ./cmd/rvglsm

Use

Launch rvgl with the -sessionlog parameter.

Example

Start or join a multiplayer game in RVGL. This begins a session.

Now, run rvglsm:

rvglsm

This will watch for updates to the session from RVGL and write them to the "sink," which is stdout by default. RVGL seems to update the session when a new race is selected after the previous one is finished.

rvglsm can write updates to different destinations. As of writing, Discord is the only additional supported sink:

rvglsm --sink discord://{webhook_token}@{webhook_id}

Where {webhook_token} is the last path parameter in the Webhook URL and {webhook_id} is the second to last.

Documentation

Index

Constants

View Source
const (
	EnvVarRVGLDataDir = "RVGL_DATA_DIR"
)

Variables

This section is empty.

Functions

func DataDir

func DataDir() (string, error)

func RegisterSink

func RegisterSink(o SinkOpener, scheme string, schemes ...string)

func ResolveSessionCSV

func ResolveSessionCSV(opts ...ResolveSessionCSVOpt) (string, error)

Types

type Race

type Race struct {
	Track   string
	Results []Result
}

type ResolveSessionCSVOpt

type ResolveSessionCSVOpt interface {
	Apply(*ResolveSessionCSVOpts)
}

type ResolveSessionCSVOpts

type ResolveSessionCSVOpts struct {
	Time time.Time
	Name string
	Path string
}

func (*ResolveSessionCSVOpts) Apply

type Result

type Result struct {
	Position int
	Player   string
	Car      string
	Time     time.Duration
	BestLap  time.Duration
	Finished bool
	Cheating bool
}

type Score

type Score struct {
	Player string
	Points int
}

func ScoreSession

func ScoreSession(session *Session, opts ...ScoreSessionOpt) []Score

type ScoreSessionOpt

type ScoreSessionOpt interface {
	Apply(*ScoreSessionOpts)
}

type ScoreSessionOpts

type ScoreSessionOpts struct {
	IncludeAI    bool
	ExcludeRaces int
	Handicap     map[string]int
}

func (*ScoreSessionOpts) Apply

func (o *ScoreSessionOpts) Apply(opts *ScoreSessionOpts)

type Session

type Session struct {
	Version string
	Date    time.Time
	Host    string
	Mode    string
	Laps    int
	AI      bool
	Races   []Race
}

func DecodeSessionCSV

func DecodeSessionCSV(r io.Reader) (*Session, error)

type Sink

type Sink interface {
	UpdateSession(context.Context, *Session, ...UpdateSessionOpt) error
}

func OpenSink

func OpenSink(ctx context.Context, s string) (Sink, error)

type SinkOpener

type SinkOpener interface {
	Open(context.Context, *url.URL) (Sink, error)
}

type UpdateSessionOpt added in v0.2.0

type UpdateSessionOpt interface {
	Apply(*UpdateSessionOpts)
}

type UpdateSessionOpts added in v0.2.0

type UpdateSessionOpts struct {
	Final            bool
	ScoreSessionOpts *ScoreSessionOpts
}

func (*UpdateSessionOpts) Apply added in v0.2.0

func (o *UpdateSessionOpts) Apply(opts *UpdateSessionOpts)

Directories

Path Synopsis
cmd
rvglsm command
sinks

Jump to

Keyboard shortcuts

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