Skip to content
forked from Orden4/WCSharp

A set of systems to simplify the process of programming maps for WarCraft 3 in C#.

License

Notifications You must be signed in to change notification settings

mdlsvensson/WCSharp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WCSharp

WCSharp is a collection of libraries for C# development of custom maps and mods for Warcraft III. With these libraries you can write map logic in C# and transpile it into Lua code that the game engine can understand.

Why C# over of Lua?

  • Better Code: C# is natively object-oriented, enabling cleaner, more maintainable code.
  • Type Safety: Static typing prevents bugs during development, without the need for EmmyLua annotations.
  • IDE: Write Warcraft III map logic in Visual Studio.
  • Built in Systems: WCSharp has several built in features for common systems.

Getting Started

These are quickstart instructions. For newcomers to C# or Warcraft III mapmaking we recommend following these more detailed instructions.

Requirements

C# development environment (like Visual Studio):

  • When installing Visual Studio, make sure you select Desktop & Mobile > .NET Desktop Development.
  • If you've installed Visual Studio previously you can launch the Visual Studio Installer and Modify your installation instead.
  • WCSharp is built for .NET 6 and requires Visual Studio 17.0 or higher.

Installation

  1. Download the WCSharp template.
  2. Open WCSharpTemplate.sln with Visual Studio and right click the Launcher project and select Set as Startup Project.
  3. Right click the Launcher project and click Manage NuGet Packages. Update all NuGet packages.
  4. Set the path to your Warcraft III executable in Launcher/app.config.
  5. Set the BASE_MAP_PATH in Launcher/Program.cs to the path of your saved map-folder.
  6. Move the included Blizzard.j and common.j files to C:\Users\[Username]\My Documents\Warcraft III\JassHelper.
  7. Run the Launcher project in Visual Studio.

Map Setup

  1. Drag-and-drop the source.w3x folder onto an open World Editor window to open the template map.
  2. Go to the Object Editor and copy the Dummy unit.
  3. Create a new map (or open an existing map) and paste the Dummy unit into the Object Editor.
  4. Go to Scenario > Map Options and set the Script Language to Lua.
  5. Save your map as Warcraft III Scenario Folder - Expansion.

WCSharp.API

WCSharp features a dedicated API, serving as a replacement for War3Api. It provides an intuitive way of interacting with Warcraft III handles.

// War3Api
var unit = CreateUnit("hfoo", Player(0), 0, 0, 270); // Create a unit
SetUnitState(unit, UNIT_STATE_MANA, GetUnitState(unit, UNIT_STATE_MANA) + 50); // Increase its mana by 50
KillUnit(unit); // Kill the unit

// WCSharp.Api
var unit = unit.Create("hfoo", Player(0), 0, 0, 270); // constructor support will be added in the future, there's a bug with CSharpLua for the time being
unit.Mana += 50;
unit.Kill();

Documentation

Each individual system is documented in the wiki. The code includes Visual Studio XML documentation comments, allowing quick access by hovering code elements in your IDE.

Contribute

We welcome contributions from the community to help improve WCSharp. If you encounter any bugs, have suggestions for new features, or want to help improve the code, feel free to open a new issue or submit a pull request.

About

A set of systems to simplify the process of programming maps for WarCraft 3 in C#.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 83.3%
  • Objective-J 14.7%
  • Lua 1.9%
  • Batchfile 0.1%