sc2hs (hackage):   Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.  Package maintainers  For package maintainers and hackage trustees  Candidates    sc2hs is an Effect-based API for StarCraft II. Currently, the API is quite small, basically enough to get the worker rush bot working, but the framework is there.  A quick example of the API is in order!  Let's look at what this does:  I think that's it.  Nix is highly recommended. If not, then make sure you also have zlib headers available.  No idea. Someone let me know!  Due to a bug in proto-lens-protoc 0.4.0.1, enum generation is broken when there are underscores in names. Thus, you must apply the patch in sc2-proto to the s2client-proto submodule.  stack build  First, launch SC2 and create a game manually. Then, do stack run.  This should run the demo bot, which launches a game, chooses the 9th map in the available maps, and joins as a Protoss player against a random Medium Computer player.  sc2hs is split into several packages:  sc2-proto is an autogenerated wrapper library around the SC2 protobuf API description.  sc2-support contains basic SC2-related definitions, such as the various directories, as well as a Template Haskell module which generates data types and functions converting between the raw integers used to refer to units, abilities, upgrades, buffs and effects, into a more usable form. It does this by parsing stableid.json, which is only created after running SC2 using the API at least once. Therefore, it also includes a backup copy, which may be out of date; but it shouldn't change frequently.  Eventually, the goal is for sc2-support to augment this data with properties harvested from balance data extracted from the SC2 editor, but how to do that well when it changes with each patch is still to be worked out.  sc2-lowlevel handles launching the game, managing its process, connecting to it, and communicating at the protobuf API logical layer. It also has some higher level types used by sc2hs. The protocol state machine is modeled using an Effect.  sc2hs is centered on the Network.SC2.Agent module. This defines an Effect, Agent, which provides an abstraction over the low-level protocol. Currently it uses just the Raw interface, but the goal is to augment it with data from the feature-layer interface and UI.  The demo app shows how to create a basic bot and use it in a game.  Currently the focus is on expanding horizontally along the layers, by translating more of the protobuf protocol into Requestables in sc2-lowlevel, and into the Agent Effect. That would be a great place to contribute; however contributions anywhere else are more than welcome! 😻
Keywords: ffi|game|library|network|program|haskell|starcraft-ii