Giter Site home page Giter Site logo

go-dota2's Introduction

Dota2

Go Reference Go Report Card Widget DOI

Introduction

go-dota2 is a DOTA 2 client plugin for go-steam.

Games implemented:

Also see: the old C#/SteamKit Implementation.

This project makes use of a dynamic API generator (apigen) designed to automatically interpret Valve's various naming conventions into a intermediate API scheme representation, which is then converted into Go code.

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.

go-dota2's People

Contributors

paralin avatar renovate[bot] avatar mrjosh avatar macnibblet avatar 13k avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.