Skip to content
forked from paralin/go-dota2

Go implementation of the DOTA2 game-coordinator client.

License

Notifications You must be signed in to change notification settings

mrjosh/go-dota2

 
 

Repository files navigation

Dota2

GoDoc Widget Go Report Card Widget

Introduction

go-dota2 is a DOTA 2 client plugin for go-steam. The intent is to replicate as much of the client functionality as possible.

Also see: the C#/SteamKit Implementation.

Implementation Progress

Complete.

  • GC session state management
  • Player profile fetching / call tracking
  • SOCache tracking / state management
  • Basic chat interaction
  • Lobby tracking / state management
    • Read lobby state correctly
    • Implement normal lobby operations
  • Party tracking / state management
    • Read party and invite state correctly
    • Implement normal party operations
  • Code generation for API
  • Code generation for events

SOCache Mechanism

The caching mechanism makes it easy to watch for changes to common objects, like Lobby, LobbyInvite, Party, PartyInvite.

This mechanism is used everywhere, these objects are not exposed in their own events.

import (
	gcmm "github.com/paralin/go-dota2/protocol"
	"github.com/paralin/go-dota2/cso"
)

eventCh, eventCancel, err := dota.GetCache().SubscribeType(cso.Lobby)
if err != nil {
    return err
}

defer eventCancel()

lobbyEvent := <-eventCh
lobby := lobbyEvent.Object.(*gcmm.CSODOTALobby)

Events for the object type are emitted on the eventCh. Be sure to call eventCancel once you are done with the channel to prevent resource leaks.

The cache object also adds interfaces to get and list the current objects in the cache.

Implementation Generation

The base API implementation is generated by the apigen code. Using heuristics, request IDs are matched to response IDs, and events and action-only requests are identified. Some manual tweaking is done in the overrides file.

Next, the API information is used to build a Go code-gen set of implementations around the MakeRequest request tracking mechanism.

This means that ALL of the Dota API will be available in this codebase, although only some of it is documented.

go-steam Dependency

This library depends on go-steam. Currently we are using the FACEIT fork.

About

Go implementation of the DOTA2 game-coordinator client.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.5%
  • Shell 0.5%