Yes, I want to code a Skirmish AI in JS. Unfortunately, I'm short on time, and would like to find an easier approach to this in the form of a Editor that creates an AI in javascript, with nothing but the bare minimum of what Nullbot does. Similar to the old AI Editor but updated for Javascript with extras, even a built-in manual editor that can check for errors and/or orphaned functions/subroutines with a click of a button.
Is anyone willing to create a simple editor that can do the job? I don't have time to learn JS, too many conventions, syntax is complicated, debugging is a bastard, and I can't make heads or tails of what each line of code does in Nullbot.
On that note, did anyone have time to annotate the latest NullBot script? I won't know how an AI works unless every single line is annotated explaining what each one does. When I did M68K Assembly, I would be lost with out annotating every line rationalizing their purpose. It helps others find mistakes, makes debugging less frustrating, and provides clues that help coders make AIs to the extent, that they formulate a unified recipe that every Skirmish AI should follow.
Long story short, I want to take the hassle out of coding.
A Skirmish AI Toolkit for JS or Commented Nullbot
-
CDR Manuel
- Rookie

- Posts: 24
- Joined: 09 Nov 2012, 14:37
-
aubergine
- Professional

- Posts: 3462
- Joined: 10 Oct 2010, 00:58
Re: A Skirmish AI Toolkit for JS or Commented Nullbot
I'm working on something that could potentially be used as a toolkit, but it's not going to be ready until next year. It's basically a set of APIs I'm using for my EggPlant AI -- it would allow you, for example, to define custom build orders, and so on.
Here's a very early prototype of a build order definition:
But using things like this are only going to allow you to change basic configurations, in a similar way to what the old DyDo AI used to facilitate. You can already do this to some extent with NullBot, by editing it's files to change research paths, build orders and other things. But ultimately if you want a decent AI you're going to have to put more effort in than just wanting to change a few config files.
Here's a very early prototype of a build order definition:
But using things like this are only going to allow you to change basic configurations, in a similar way to what the old DyDo AI used to facilitate. You can already do this to some extent with NullBot, by editing it's files to change research paths, build orders and other things. But ultimately if you want a decent AI you're going to have to put more effort in than just wanting to change a few config files.
You do not have the required permissions to view the files attached to this post.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
-
CDR Manuel
- Rookie

- Posts: 24
- Joined: 09 Nov 2012, 14:37
Re: A Skirmish AI Toolkit for JS or Commented Nullbot
Hmm, there is one way I can learn the API, someone do a video tutorial on JS AI Editing. I'll also need a program or NPP plugin to check the consistency of the code. One small problem, how do I get JSLint to follow the API?
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: A Skirmish AI Toolkit for JS or Commented Nullbot
To quickly learn the API, see the "Semperfi-JS" AI available in warzone2100-git master. It's a very simple JS AI, with almost all parts of it obvious (and it doesn't play very well). That's what i was using as an example when making NullBot.
NullBot's code is very ugly, mostly because i'm not a good coder, and also because it has undergone a huge lot of testing. In its regroupWarriors, attackStuff eventAttacked functions almost every line should have a whole page of comments for it, describing many variants that proved wrong. Also it has a lot of code for optimizing cpu usage (different sorts of caching and throttling), which is not very beautifully done either. In any case, if you still want to understand how it works, a bit more explanation by me is present in its wiki on sourceforge.
NullBot's code is very ugly, mostly because i'm not a good coder, and also because it has undergone a huge lot of testing. In its regroupWarriors, attackStuff eventAttacked functions almost every line should have a whole page of comments for it, describing many variants that proved wrong. Also it has a lot of code for optimizing cpu usage (different sorts of caching and throttling), which is not very beautifully done either. In any case, if you still want to understand how it works, a bit more explanation by me is present in its wiki on sourceforge.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
aubergine
- Professional

- Posts: 3462
- Joined: 10 Oct 2010, 00:58
Re: A Skirmish AI Toolkit for JS or Commented Nullbot
@NoQ: Link to include() docu on this page: http://sourceforge.net/p/nullbot2100/wi ... 0includes/ -- should be https://warzone.atlassian.net/wiki/page ... eId=360541
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
-
NoQ
- Special

- Posts: 6226
- Joined: 24 Dec 2009, 11:35
- Location: /var/zone
Re: A Skirmish AI Toolkit for JS or Commented Nullbot
fxd tx (:
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
-
Shadow Wolf TJC
- Regular

- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: A Skirmish AI Toolkit for JS or Commented Nullbot
@ CDR Manuel: I'm personally developing a new AI myself, though I'm currently inexperienced at developing one. Still, I at least managed to program my AI to order my starting trucks to build a few base buildings, as well as order the 1st factory that it builds to produce another truck.
I find that, when developing your 1st AI, it helps to set a few goals for your AI, such as:
- Have one of your starting trucks build a factory or research lab.
- Have all of your trucks build the same building.
- Have your starting trucks build another base building upon finishing your 1st building.
- Have your 1st factory or research lab start producing or researching something.
- Have your factories or research labs start producing another thing upon finishing production/research.
- Have your 1st produced truck start hunting for oil.
- Have one of your produced trucks help your starting trucks build the rest of your starting base.
- Have your factories shift production to new units (such as Machinegun Viper Wheels) once research is finished.
- Have your starting trucks, plus a few others, build Power, Research, and Factory Modules, as well as Cyborg and VTOL Factories, upon being researched.
- Have your AI amass a few attacking units, then send them out to a certain location (such as the enemy's spawn point).
- Have your AI do something when one of its units or structures comes under attack (such as ordering its attack forces to repel the attackers).
- Have your AI do something when one of its units or structures is destroyed (such as attempt to rebuild said structure).
- Control how your AI spends its power so that it can save some for an emergency.
There may be more goals that your AI needs to meet, though these are just the ones that I can think of from the top of my head.
I find that, when developing your 1st AI, it helps to set a few goals for your AI, such as:
- Have one of your starting trucks build a factory or research lab.
- Have all of your trucks build the same building.
- Have your starting trucks build another base building upon finishing your 1st building.
- Have your 1st factory or research lab start producing or researching something.
- Have your factories or research labs start producing another thing upon finishing production/research.
- Have your 1st produced truck start hunting for oil.
- Have one of your produced trucks help your starting trucks build the rest of your starting base.
- Have your factories shift production to new units (such as Machinegun Viper Wheels) once research is finished.
- Have your starting trucks, plus a few others, build Power, Research, and Factory Modules, as well as Cyborg and VTOL Factories, upon being researched.
- Have your AI amass a few attacking units, then send them out to a certain location (such as the enemy's spawn point).
- Have your AI do something when one of its units or structures comes under attack (such as ordering its attack forces to repel the attackers).
- Have your AI do something when one of its units or structures is destroyed (such as attempt to rebuild said structure).
- Control how your AI spends its power so that it can save some for an emergency.
There may be more goals that your AI needs to meet, though these are just the ones that I can think of from the top of my head.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
-
aubergine
- Professional

- Posts: 3462
- Joined: 10 Oct 2010, 00:58
Re: A Skirmish AI Toolkit for JS or Commented Nullbot
I'm in the very early stages of writing a guide to building AIs, but there's hardly anything written there yet... https://warzone.atlassian.net/wiki/display/mod/AI+Guide ...Currently busy coding APIs for my own AI so progress has been slow.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO