2. API Example

This start guide assumes you know how GitHub and Git work and have some basic programming knowledge. Additionally, you have some knowledge of how the game works.

To begin, clone the repository from GitHub on your computer; this hello world starter code can be a single-player or a PVP one; they work mostly the same but with a few differences.

Singleplayer

In the singleplayer, which is a turn-based RTS variant of IAH: INTERNET WAR, you write AI to defeat Game AI, and you fight against local AI that comes preloaded with the game.

GITHUB - Singleplayer C# AI - Hello World Example

Multiplayer PvP

In the multiplayer PvP, your goal is to defeat another player; this mode has no turn-based elements; it is a round-based RTS; defeat another player or complete the objective, and you will win the round.

GITHUB - PvP Multiplayer C# AI - Hello World Example

static async Task RunAI(string apiHttp, int port)
{
    ApiConnector apiConnector = new ApiConnector(apiHttp + ":" + port);

    using (HttpClient httpClient = apiConnector.GetHttpClient())
    {
        Debugger.WriteLog("Starting PvP (HelloWorldAI) Template...");

        MatchInstance instance = new MatchInstance(httpClient);
        instance.AssignAI<HelloWorldAI>();
        instance.AssignRequests();

        await instance.LoopMatchInstance();
    }
}

How it works?

Writing your own AI for IAH: INTERNET WAR happens through an API interface; you can do this in any way you want, either by having precompiled code or real-time reactive AI, and you can even create your own game client.

The idea is that you send API calls, and then the client performs actions.

Last updated