top of page
  • Join our Discord!
  • Join our Kickstarter!

A.I. part ONE

Hi everyone, Uveso here! and welcome to the Sanctuary AI devlog!

This devlog is aimed at players who like to play against an AI and modders who want to tinker with the AI or design their own AI.

What language does the AI speak?

The basic framework of the AI, where all decisions are made, will be programmed in Lua.

Here we made decisions about the current strategies of the AI, AI-supported player functions and scripts for missions are executed.

The operation of bases and extensions is also managed here.

After the AI has decided on a strategy, we slowly leave the Lua program area.

Unit movements, path finding, building units is initiated by Lua but realized by C# functions.

In this way we achieve an extensively moddable environment for the AI and can still control thousands of units.


How will the AI work?

(Attention, here we go into programming details. )

First, the AI strategy manager is started.

This means that we start an independent Lua program thread that does nothing else than run a table over and over again

and checks if certain conditions are true or false. If all conditions of a strategy are true, the name of the strategy is saved.

Several strategies can be active at the same time.

How exactly does it work?

First, let's take a look at what a strategy former looks like:



We have here StrategyName and StrategyDescription which are used in the user interface.

Now the AIDifficulty could come. In our example, the strategy would only be executed if the AI is on the Medium or higher difficulty.

All strategies are executed in order of priority. Priority 100 is executed before 50.

And the heart of the Strategy Former, the StrategyConditions. All the listed conditions must be true

for the strategy to be used. Here could be conditions for units number, opponents building or map conditions.

In our case we check if we generate less than 10 times the energy as resources. ( energy <= resource * x = true )

If this is true, this strategy will become active and will lead us to build more energy buildings.


What happens after that you will find out in the next AI devlog.

Thank you for your patience and I hope it was something interesting for you.


Best, Uveso.

1,482 views0 comments

Recent Posts

See All

Comments


bottom of page