Skip to content

When u want to add code for Mod

alexeik edited this page Sep 12, 2019 · 11 revisions

This info suits for those who wanted to make some addons or improvements for Mod or openRA itself. Plan:

1. When u get openRA first time , how to understand what to DO?

openRA programm structure

1. openRA is a framework for running plugins(MODs )

Plugin is just a mod for any game from westwood studios.

There are official and 3dparty plugins. Official placed in openRA repo. 3dparty placed as standalone repos.

Every MOD have common folder structure for resources from original WWS(WestWood Studios) games & self-crafted resources. U must know what is it type of resources to get in.

Example for getting and running Dune2 Mod.

Open this https://github.com/OpenRA and lookup "D2" then do git clone

After that u must command for fill out your cloned repo with:

  1. there is a command make.cmd- it will fill out repo folder with rest of the files like: 3dparty dlls,openRA source code

  2. exception: fetch-thirdparty-deps.ps1 this file has errors

    `./nuget.exe install SharpZipLib -Version 1.1.0 -ExcludeVersion -Verbosity quiet-Source nuget.org`
    

    If u got RED ERRORS while executing make.cmd this is it. Just remove -Source nuget.org from this file totally. Re-run make.cmd with clean , re-run with all.

  3. After make.cmd done , u must have compiled openRA project and compiled D2 project. Now u can run Debug in vs2019 or vs2017 and see as Dune2 getting alive. But maybe u want to delete some strings in *.csproj like this

 <!-- Disable code style analysis on Release builds to improve compile-time performance -->
   <ItemGroup>
      <Analyzer Remove="@(Analyzer)" />
    </ItemGroup>
  </Target>

to turn off code policy.

2. When u can run your Mod

Then you will want to get in details:)

Where are from all this nice graphics and music?

Its mixed from original games resources and new resources (png almost)


Original resources openRA gets though classes ISpriteLoader.

Task of a class maded with ISpriteLoader to fill array of ints with R,G,B values from original file format and this array of RGB will be drawn.


New resources openRA gets from png files with Texture Atlas format.(many pics in one)

using (var stream = modData.DefaultFileSystem.Open(info["Image"]))
{
 sheet = new Sheet(SheetType.BGRA, stream);
}

New resources use Sheet class for init Texture atlas(this is png image) then cuts subimages to Sprite class:

borderTop = new Sprite(sheet, new Rectangle(161, 128, 62, 33), TextureChannel.RGBA);

3. When u want to add code or improve

4. How openRA engine works (short and very important overview)

Clone this wiki locally
You can’t perform that action at this time.