Nexus AI Script Conversion

For AI and campaign script related discussions and questions

Nexus AI Script Conversion

Postby Berserk Cyborg » 25 Jun 2018, 21:05

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.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 573
Joined: 26 Sep 2016, 19:56

Re: Nexus AI Script Conversion

Postby NoQ » 26 Jun 2018, 04:36

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.
User avatar
NoQ
Special
Special
 
Posts: 6146
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Nexus AI Script Conversion

Postby Per » 26 Jun 2018, 18:34

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3745
Joined: 03 Aug 2006, 19:39

Re: Nexus AI Script Conversion

Postby NoQ » 27 Jun 2018, 22:45

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).
User avatar
NoQ
Special
Special
 
Posts: 6146
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Nexus AI Script Conversion

Postby WZ2100ModsFAn » 30 Jun 2018, 17:58

This is a great idea

as long as it works the way the original one does this would be good
i'm going to post once a day.
User avatar
WZ2100ModsFAn
Trained
Trained
 
Posts: 162
Joined: 15 Apr 2018, 17:25
Location: Original Account http://forums.wz2100.net/memberlist.php?mode=viewprofile&u=10830

Re: Nexus AI Script Conversion

Postby Berserk Cyborg » 30 Jun 2018, 21:54

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.
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 573
Joined: 26 Sep 2016, 19:56

Re: Nexus AI Script Conversion

Postby WZ2100ModsFAn » 12 Jul 2018, 02:04

Any Progress?

Just checking to see if the script conversion is available yet.
i'm going to post once a day.
User avatar
WZ2100ModsFAn
Trained
Trained
 
Posts: 162
Joined: 15 Apr 2018, 17:25
Location: Original Account http://forums.wz2100.net/memberlist.php?mode=viewprofile&u=10830

Re: Nexus AI Script Conversion

Postby NoQ » 13 Jul 2018, 14:34

Spoiler:
User avatar
NoQ
Special
Special
 
Posts: 6146
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Nexus AI Script Conversion

Postby WZ2100ModsFAn » 13 Jul 2018, 15:29

Sorry for the impatience Berserk Cyborg is making some good progress on this
i'm going to post once a day.
User avatar
WZ2100ModsFAn
Trained
Trained
 
Posts: 162
Joined: 15 Apr 2018, 17:25
Location: Original Account http://forums.wz2100.net/memberlist.php?mode=viewprofile&u=10830

Re: Nexus AI Script Conversion

Postby Berserk Cyborg » 13 Jul 2018, 22:38

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).
User avatar
Berserk Cyborg
Code contributor
Code contributor
 
Posts: 573
Joined: 26 Sep 2016, 19:56

Re: Nexus AI Script Conversion

Postby MIH-XTC » 14 Jul 2018, 14:18

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.
MIH-XTC
Trained
Trained
 
Posts: 251
Joined: 31 Jan 2014, 07:06


Return to Scripting