Page 1 of 1

Nexus AI Script Conversion

Posted: 25 Jun 2018, 21:05
by Berserk Cyborg
I want to start the conversion process on Nexus AI and try to aim for a close conversion with previous behavior intact, where possible. I might do some more extensive behavior improvements later, but not immediately. The one exception is if I find it does something that is downright bad design (like only building one research lab or something else extreme like that).

Would anything break in the source if I replace the wzscript version?

Also, what are the notable differences between Nexus and Semperfi other than from Semperfi being a better rusher and having more truck tactics/logic? We could simply merge the two with this rewrite if there are not any big differences.

Re: Nexus AI Script Conversion

Posted: 26 Jun 2018, 04:36
by NoQ
If i was to work on that, i'd reimplement the necessary wzscript API in JS and then do a line-by-line translation. That's probably the easiest and safest way to preserve the legacy when we believe that the legacy is good enough as-is and we aren't planning to fix it.
The one exception is if I find it does something that is downright bad design (like only building one research lab or something else extreme like that).
If i was to fix one thing, i'd remove the VTOL sub-personality that randomly causes a specific AI instance to play terribly for the entire duration of the game.

Re: Nexus AI Script Conversion

Posted: 26 Jun 2018, 18:34
by Per
Not exactly sure why you would want to do such a thing, but feel free.

The old wzscript-based semperfi is basically my experimental improvements to Nexus. You can merge or discard the changes as you like.

Re: Nexus AI Script Conversion

Posted: 27 Jun 2018, 22:45
by NoQ
I guess the purpose is to kinda preserve the original game's skirmish experience for those who think it's a big deal (there always are some).

Re: Nexus AI Script Conversion

Posted: 30 Jun 2018, 17:58
by WZ2100ModsFAn
This is a great idea

as long as it works the way the original one does this would be good

Re: Nexus AI Script Conversion

Posted: 30 Jun 2018, 21:54
by Berserk Cyborg
NoQ wrote:If i was to work on that, i'd reimplement the necessary wzscript API in JS and then do a line-by-line translation. That's probably the easiest and safest way to preserve the legacy when we believe that the legacy is good enough as-is and we aren't planning to fix it.
Pretty much what I am doing. Finished shuffling everything off the .vlo file and got to the "arrived" trigger in the .slo file (builds defenses near enemy derrick if it was snatched by an enemy).
NoQ wrote:If i was to fix one thing, i'd remove the VTOL sub-personality that randomly causes a specific AI instance to play terribly for the entire duration of the game.
That personality is terrible and most likely unfinished. Worse yet, a linear function is calculated with the map width and height taken into account so that larger maps will use it more. Only, it seems fairly common on a small map like Rush (where it takes 11 minutes to produce the first MG tank). The concept is still achievable. Just needs to focus on other things before trying to rush towards VTOL factory... with one research lab.

Re: Nexus AI Script Conversion

Posted: 12 Jul 2018, 02:04
by WZ2100ModsFAn
Any Progress?

Just checking to see if the script conversion is available yet.

Re: Nexus AI Script Conversion

Posted: 13 Jul 2018, 14:34
by NoQ
Spoiler:

Re: Nexus AI Script Conversion

Posted: 13 Jul 2018, 15:29
by WZ2100ModsFAn
Sorry for the impatience Berserk Cyborg is making some good progress on this

Re: Nexus AI Script Conversion

Posted: 13 Jul 2018, 22:38
by Berserk Cyborg
About 1800 lines of the .slo file remain (including blank lines and comments). The manufacturing functionality is complete, and the build logic is like 99% complete. Currently at scouting and tactics.

Apparently, the wzscripts can access the stat and order location of a constructor droid. Does the JS API have access to those right now? Not that it matters much since the one function that uses it only scans one tile for nearby structure with trucks around it (enumRange can easily miss a large feature/structure if the scan radius does not reach the center of the object).

Re: Nexus AI Script Conversion

Posted: 14 Jul 2018, 14:18
by MIH-XTC
As others stated, I think you're wasting your time because Nexus doesn't play well and nobody cares about the sentimental value of a deprecated AI. You should focus your effort in making Nullbot better.

The language and AI API isn't as relevant as you might think because unit spam with whatever unit has the longest range at the time beats all other strategies. So basically you just need to tell an AI to stock up units and spam them in groups of 10 and that bot is unbeatable 90% of the time. Usually this is grenadiers and mortars.

You can make the most elaborate AI API in the world, but in the end the above strategy will win out. Well, you have to fix some super obvious flaws first that should only take a few hours.

For example:

Nexus researches random things. Solution: make a list of things to research (durrrrr)

Nexus produces random units. Solution: make a list of templates

Nexus does not spend excess power. Solution: check if Nexus has extra power and then spend it.

Nexus does not know how to build extra buildings. Solution: check if Nexus has enough oils to support extra buildings and build them

Nexus does not know how to prevent units from accumulating in the base. Solution: check if there are units accumulated in the base and if so attack.

These are obvious and easy checks to implement in any API. Once implemented you'll realize that AI gameplay can easily be optimized within the current limitations of both the WZscript and JS API's and that the real problem is that the stats don't allow for good strategies. The best strategy is long distance unit spam and that's easy to currently implement.


To summarize what I’m trying to say, we can think of a WZ game consisting of 4 components.

build strategy
research strategy
template/unit strategy
unit control

Given the current stats, the first 3 can be hardcoded (static arrays) for the most optimal values so AI behavior and API is somewhat irrelevant. Spam works pretty good for unit control and that’s basically all that’s needed to make the best AI.

Re: Nexus AI Script Conversion

Posted: 10 Aug 2018, 18:59
by WZ2100ModsFAn
Nexus AI conversion is a great work in progress.

hopefully it will make it before the release 3.3.0