EggPlant AI ramblings

For AI and campaign script related discussions and questions
User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: EggPlant AI ramblings

Post by Emdek »

aubergine, start with some simple examples, the real pain could be to read very complex ones...
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.
cue
Trained
Trained
Posts: 59
Joined: 06 Nov 2011, 00:12

Re: EggPlant AI ramblings

Post by cue »

Good to know, your "rambling" sound good :)
And like someone said, it would be fun to have more then one AI that does not cheat but would give us a different style of play.

I believe human players usually start by building defenses, it's simply in our nature to want our nests (homes) to be defended before we attack others, perhaps EggPlant could be more "human".

I wish I could help you with your programing problems, but alas.
User avatar
dak180
Trained
Trained
Posts: 288
Joined: 01 Nov 2009, 23:58
Location: Keeper of the Mac Builds

Re: EggPlant AI ramblings

Post by dak180 »

aubergine wrote:I'm completely befuddled when it comes to regex. :(
Try txt2re; it is always helpful for me when I have a tricky regex to work out.
User:dak180
Keeper of the Mac Builds
iap
Trained
Trained
Posts: 244
Joined: 26 Sep 2009, 16:08

Re: EggPlant AI ramblings

Post by iap »

I'm not a guru in reg ex but I know enough. If you have specific tasks, I can give it a try.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: EggPlant AI ramblings

Post by aubergine »

Ok, so the first stage would be to split this string (quotes used to indicate the start/end of the string for visual purposes):

"selector1, selector2"

There could be one or more "selector" bits. If there's more than 1 then each "selector" is separated by a comma. The space after a comma is optional. A "selector" string might contain commas within it, but they must be enclosed in brackets, for example:

selector1 = "bleh(bleh, bleh)"

After running a regex, I'd want an array containing two items: selector1 and selector2
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: EggPlant AI ramblings

Post by milo christiansen »

That one is trivial you just need something like:

Code: Select all

/[^,]+,[^,]+/
one or more of something not a ",", a ",", and one or more of something not a ","
I can't say for sure if that would work without trying it but it should (unless I made a dumb mistake :P)
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
iap
Trained
Trained
Posts: 244
Joined: 26 Sep 2009, 16:08

Re: EggPlant AI ramblings

Post by iap »

Why not using this:
http://www.w3schools.com/jsref/jsref_split.asp

(Sorry for being short, i'm typing from my phone )
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: EggPlant AI ramblings

Post by aubergine »

because it won't work on selectors like this:

"foo:bar(a,b), baz:boz(c,d)"

I'd want that split to an array like:
["foo:bar(a,b)", "baz:boz(c,d)"]
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
iap
Trained
Trained
Posts: 244
Joined: 26 Sep 2009, 16:08

Re: EggPlant AI ramblings

Post by iap »

The lazy syntax will be to try and split by ", " (with a space). But I guess this is not what you're looking for...

But I guess you meant something like this:

Code: Select all

\w*:\w*\([\w\d,]*\)
But this is specific to the pattern: "<word>:<word>(<item>,<more items>)" and will get this as a whole, without breaking it inside

Edit:
this:

Code: Select all

((\w*):(\w*)(\([\w\d,]*\)))
Will split each match to groups:
Group 0: the match itself (same as above)
Group 1: First word
Group 2: Second word
Group 3: What inside the ( ) including
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: EggPlant AI ramblings

Post by aubergine »

Been a while since I updated this post. I've been quietly working away on something called "The NEXUS Project" which in simple terms is a task-driven approach to AI scripting.

A task-driven system is actually very similar to an event-driven system. The key difference being that tasks are defined at runtime rather than being pre-defined and hard-coded like events.

As it's name suggests, the approach is inspired by the WZ entity known as NEXUS. It infiltrates systems (events) with an intruder program (tardis event handler) and then takes control of them (turns them in to tasks then perform actions associated with the tasks). NEXUS is highly modular, with various subroutines being used to handle different aspects of its consciousness.

More information can be found in the wiki, but bear in mind it's going to change considerably due to some architectural changes I'm making to enable multiple instances of NEXUS to be instantiated at runtime: The NEXUS Project
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
coolydudey60
Rookie
Rookie
Posts: 19
Joined: 30 May 2010, 18:36

Re: EggPlant AI ramblings

Post by coolydudey60 »

I didn't have the time to read through the whole thread, but you've got yourself one incredible framework there! The way the decisions are organized and assigned to the different AIs and the way you strive for adaptive play is very interesting to say the least. Do you know when this will be ready?
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: EggPlant AI ramblings

Post by aubergine »

Sooo.... After several 18 hour days of coding, I now have a API that lets me run "processes" (for want of a better name) over multiple game ticks :) Initial testing is proving so positive that it's likely all EggPlant code will be run in processes. Processes can be run on an interval (timer), triggered by events or run on an as-needed basis. Processes can also be chained, so when process A finishes it can start process B and C, etc.

Each process can contain one or more tasks. Data can be pumped in to it (not to mention internal data stores at process and task level) and it can be "run" to process the tasks. If there isn't enough processing time in the current game tick to get all it's tasks done, it will defer some until a later game tick. It keeps track of task runtimes so it can preemtively defer a big task to a later game tick. This lets me do some serious number crunching that would otherwise lead to terrible game lag and freezes -- now I can just do that work over a period of time without impairing game performance.

The Process API tracks all sorts of metrics such as runtime for each task, number of times each task and process has been run, process stall and overload detection, error handling & tracking, etc. Many of these things can be quickly output using diagnostic functions, eg. list the 5 slowest tasks, or the 10 processes that are used most, etc.

My current focus is on "seeing" the map. The JS API in the WZ 3.1 branch is somewhat limited in this respect, but with some ingenuity and the ability to process large amounts of data across multiple game ticks, I can do some pretty interesting stuff.

For example, one process I'm working on right now will cycle through every tile on the map (over 65,000 tiles on a big map) and work out if I can get there from my base by land (and later in the game, hover). Another process follows a random unit (until something happens to it) to determine paths between map sectors. In doing that I can also get the z-index (height) of each tile. In theory, this will let me calculate rough travel times / distances from A to B anywhere on the map -- it's still in early stages of development, but looks promising. Once finished, I hope to extend that process so it can follow enemy units to work out where they might be heading, but it's early days yet.

One of the key things I want to do is work out how to get my units in to positions whereby they can attack an enemy target from multiple directions. The logistics of this are non-trivial. For example, in some cases I might want to build a factory in a specific map sector so it can feed an attack group. Similarly, I might want to carefully place repair stations and rearming pads in particular sectors so that units going for repairs don't have to travel through an enemy base or other danger zone. And, for units that are being sent in from elsewhere, I need to find a way of making them go around dangerous sectors rather than through them.

Right, that's all for this update. Back to coding!
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
cue
Trained
Trained
Posts: 59
Joined: 06 Nov 2011, 00:12

Re: EggPlant AI ramblings

Post by cue »

:good:
Soooooo looking forward to trying out your AI! :)

Any ETA?
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: EggPlant AI ramblings

Post by aubergine »

There is much, much work to do before it see the light of day. With current rate of progress I expect Q1 2013 will see the first beta release. I started this project back in January, and it's only now, after quite literally hundreds of failed iterations, that I'm getting to a point where I have an underling framework and set of tools that can enable me to enact my vision for this AI...
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Andrie
Regular
Regular
Posts: 533
Joined: 20 Jun 2012, 14:11
Location: Suid Afrika

Re: EggPlant AI ramblings

Post by Andrie »

dak180 wrote:Try txt2re; it is always helpful for me when I have a tricky regex to work out.
I don't know where to download it. :augh:
"My IRC en multiplay naam is Andrie"

Groete Andrie
Post Reply