BWAPI.NET 0.1.7

dotnet add package BWAPI.NET --version 0.1.7
NuGet\Install-Package BWAPI.NET -Version 0.1.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BWAPI.NET" Version="0.1.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BWAPI.NET --version 0.1.7
#r "nuget: BWAPI.NET, 0.1.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BWAPI.NET as a Cake Addin
#addin nuget:?package=BWAPI.NET&version=0.1.7

// Install BWAPI.NET as a Cake Tool
#tool nuget:?package=BWAPI.NET&version=0.1.7

BWAPI.NET

A pure .NET BWAPI 4.4.0 client implementation. It follows the idea of using memory mapped files to communicate with Starcraft launched by BWAPI.

This project is a port to .NET of JBWAPI which is a pure Java BWAPI 4.4.0 client implementation.

Capabilities

  • Write AIs for Starcraft: Broodwar by controlling individual units.
  • Read all relevant aspects of the game state.
  • Get comprehensive information on the unit types, upgrades, technologies, weapons, and more.
  • Study and research real-time AI algorithms in a robust commercial RTS environment.
  • Use additional libraries such as BWEM.NET to create more intelligent bots by analyzing the map.

Quick Start

  1. Installation
    • Install .NET SDK
    • Install StarCraft: Brood War
    • Update StarCraft: Brood War to 1.16.1
    • Install BWAPI
  2. Create a bot project
    • Run dotnet new console -o MyBot
    • Run cd MyBot to change directy into MyBot folder
    • Run dotnet add MyBot.csproj package BWAPI.NET to add the reference to the nuget package generated from this repository
    • Copy and paste example bot below into Program.cs or develop your own bot
    • Run dotnet run (At this point you should see "Game table mapping not found." printed each second)
  3. Run StarCraft through Chaoslauncher
    • Run Chaoslauncher.exe as administrator
      • Chaoslauncher is found in Chaoslauncher directory of BWAPI install directory
    • Check the BWAPI Injector x.x.x [RELEASE]
    • Click Start
      • Make sure the version is set to Starcraft 1.16.1, not ICCup 1.16.1
  4. Run a game against Blizzard's AI
    • Go to Single PlayerExpansion
    • Select any user and click OK
    • Click Play Custom, select a map, and start a game
  5. Run a game against yourself
    • Run Chaoslauncher - MultiInstance.exe as administrator
    • Start
      • Go to MultiplayerExpansionLocal PC
      • Select any user and click OK
      • Click Create Game, select a map, and click OK
    • Start – Uncheck BWAPI Injector x.x.x [RELEASE] to let a human play, leave alone to make AI play itself
      • Go to MultiplayerExpansionLocal PC
      • Select any user and click OK
      • Join the existing game created by the other client

Bot Example

using BWAPI.NET;

namespace ExampleBot
{
    public class ExampleBot : DefaultBWListener
    {
        private BWClient _bwClient;
        private Game _game;

        public void Run()
        {
            _bwClient = new BWClient(this);
            _bwClient.StartGame();
        }

        public override void OnStart()
        {
            _game = _bwClient.Game;
        }

        public override void OnFrame()
        {
            _game.DrawTextScreen(100, 100, "Hello Bot!");
        }

        public override void OnUnitComplete(Unit unit)
        {
            if (unit.GetUnitType().IsWorker())
            {
                Unit closestMineral = null;
                int closestDistance = int.MaxValue;
                foreach (Unit mineral in _game.GetMinerals())
                {
                    int distance = unit.GetDistance(mineral);
                    if (distance < closestDistance)
                    {
                        closestMineral = mineral;
                        closestDistance = distance;
                    }
                }

                unit.Gather(closestMineral);
            }
        }

        public static void Main()
        {
            var bot = new ExampleBot();
            bot.Run();
        }
    }
}

Starcraft and Starcraft: Broodwar are trademarks of Blizzard Entertainment. BWAPI.NET through BWAPI is a third party "hack" that violates the End User License Agreement (EULA). It is strongly recommended to purchase a legitimate copy of Starcraft: Broodwar from Blizzard Entertainment before using BWAPI.NET and/or BWAPI.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BWAPI.NET:

Package Downloads
BWEM.NET

A port of BWEM to .NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.7 414 1/25/2023
0.1.6 251 1/24/2023
0.1.5 405 1/21/2023
0.1.4 275 1/18/2023
0.1.3 271 1/16/2023
0.1.2 258 1/13/2023
0.1.1 268 1/13/2023
0.1.0 267 1/13/2023