You do not; it is (as far as I know) an online resource only.Andrie wrote:I don't know where to download it.dak180 wrote:Try txt2re; it is always helpful for me when I have a tricky regex to work out.
EggPlant AI ramblings
Re: EggPlant AI ramblings
User:dak180
Keeper of the Mac Builds
Keeper of the Mac Builds
Re: EggPlant AI ramblings
I can`t find from begining of regexpr thread.aubergine wrote: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)"]
Where you get this? Can it be formated as json? Do you have real examples?
PS. I like regexpr because they are allow to solve problem fast. But they are doing it slow.Some people, when confronted with a problem, think
“I know, I'll use regular expressions.” Now they have two problems.
http://addons.wz2100.net/ developer
Re: EggPlant AI ramblings
I've put the regex stuff on hold for now as it was causing too many delays (despite many years of trying, I still can't get my head around regex, and the WZ JS env is not a good place to overcome that shortcoming).
I have, however, spent a fair bit of time working with ways to classify objects while I was trying to get the regex stuff working, and the classification stuff itself developed in to it's own API (see links to my Nexus project earlier in this thread).
For now, my main process is on the Process API which, despite some limits on the amount of introspection I want to use, is performing very well indeed.
I now have a fairly robust Map API which really will form the basis of a lot of the decision making within my AI. It uses processes and tasks to:
* Split the map in to 20x20 sectors
* Reference those sectors by id, or sector grid (eg. for traversing sectors)
* Simple functions to convert tile x,y refs in to a sector
* The beginnings of a 2D tile grid that will provide comprehensive info about each map tile
I'm also working on a tile grid. By the end of next week I'm hoping to be in a position where I can finally start to "see" the map from within my script.
In particular, the tile grid will tell me things like:
* what height is the tile
* terrain type - land, water, cliff
* for a given tile:
** can units go on it: land/hover/air
** can units go on the adjacent tiles
* what is on the tile - eg. feature, droid, structure
* tactical info about the tile, including:
** who "owns" it - me, ally, enemy, neutral
** is it "lit" by sensors: me, ally, enemy, unlit
** what can see/hit the tile - eg. can an enemy arty defence structure hit the tile, can an enemy sensor droid see the tile, etc.
The main thing I'm working on at present is the ability to "blur" tactical data. For example, if I know that an enemy hellstorm structure is at x,y, and I've determined it's range (based on being attacked by it on some other tile nearby), I can "blur" the danger of the arty from it's source tile (where it is placed) so that all tiles in the known range of the arty will know that that specific arty can hit them. When combined with blurred data about enemy sensors, I can add the two numbers to get a fairly accurate arty threat level for a given tile. Armed with that sort of tactical info, I can build a CB turret (or place a CB droid) on a tile just outside the enemy arty range.
The blurring effect takes a given tile metric and then spreads it out over a certain radius. It can "fade out" the metric in various ways: don't fade, fade linearly, fade linearly after a certain range. Because of the way the data is stored, I'm hoping to be able to also apply this sort of thing to *moving* land units and possibly even vtols. Thus, as an enemy unit moves across the map, assuming I can see it via sensors or satellite, etc., I'll be able to move it's blurred threat footprint with it in near-realtime. If I'm able to stomach the math of working out it's trajectory (taking in to account what obstacles it might have to avoid), I might even get to a point where I pre-emptively blur it's threat so I can sort of say "this group of tiles is going to be dangerous in X seconds". If I accomplish that I'm literally going to do a victory dance in front of my laptop, because it will mean that when my AI is making decisions, it can determine roughly when they will be enacted, and then have a look what the map will be like at that point in the future before committing to the decision.
I have, however, spent a fair bit of time working with ways to classify objects while I was trying to get the regex stuff working, and the classification stuff itself developed in to it's own API (see links to my Nexus project earlier in this thread).
For now, my main process is on the Process API which, despite some limits on the amount of introspection I want to use, is performing very well indeed.
I now have a fairly robust Map API which really will form the basis of a lot of the decision making within my AI. It uses processes and tasks to:
* Split the map in to 20x20 sectors
* Reference those sectors by id, or sector grid (eg. for traversing sectors)
* Simple functions to convert tile x,y refs in to a sector
* The beginnings of a 2D tile grid that will provide comprehensive info about each map tile
I'm also working on a tile grid. By the end of next week I'm hoping to be in a position where I can finally start to "see" the map from within my script.
In particular, the tile grid will tell me things like:
* what height is the tile
* terrain type - land, water, cliff
* for a given tile:
** can units go on it: land/hover/air
** can units go on the adjacent tiles
* what is on the tile - eg. feature, droid, structure
* tactical info about the tile, including:
** who "owns" it - me, ally, enemy, neutral
** is it "lit" by sensors: me, ally, enemy, unlit
** what can see/hit the tile - eg. can an enemy arty defence structure hit the tile, can an enemy sensor droid see the tile, etc.
The main thing I'm working on at present is the ability to "blur" tactical data. For example, if I know that an enemy hellstorm structure is at x,y, and I've determined it's range (based on being attacked by it on some other tile nearby), I can "blur" the danger of the arty from it's source tile (where it is placed) so that all tiles in the known range of the arty will know that that specific arty can hit them. When combined with blurred data about enemy sensors, I can add the two numbers to get a fairly accurate arty threat level for a given tile. Armed with that sort of tactical info, I can build a CB turret (or place a CB droid) on a tile just outside the enemy arty range.
The blurring effect takes a given tile metric and then spreads it out over a certain radius. It can "fade out" the metric in various ways: don't fade, fade linearly, fade linearly after a certain range. Because of the way the data is stored, I'm hoping to be able to also apply this sort of thing to *moving* land units and possibly even vtols. Thus, as an enemy unit moves across the map, assuming I can see it via sensors or satellite, etc., I'll be able to move it's blurred threat footprint with it in near-realtime. If I'm able to stomach the math of working out it's trajectory (taking in to account what obstacles it might have to avoid), I might even get to a point where I pre-emptively blur it's threat so I can sort of say "this group of tiles is going to be dangerous in X seconds". If I accomplish that I'm literally going to do a victory dance in front of my laptop, because it will mean that when my AI is making decisions, it can determine roughly when they will be enacted, and then have a look what the map will be like at that point in the future before committing to the decision.
"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
Re: EggPlant AI ramblings
You might want to do this in C++ instead of JavaScript (the ugliest language ever!). And in fact, the pathfinding code already does some of that. It keeps track of known enemies and their ranges (although afaict it will not take artillery-sensor combination into account, but just consider sensor visibility). When doing pathfinding, it tries to find paths with a low threat level. IIRC the cost multiplier is 5x for tiles that are threatened, so the units should be willing to do a detour sometimes.
Anyway, I believe that this "tactical map" that is used by the path finding has a lot in common with what you are trying to (re-) create. Maybe it would be better to do this in the C++ layer, to use it in both pathfinding and for the AI.
Anyway, I believe that this "tactical map" that is used by the path finding has a lot in common with what you are trying to (re-) create. Maybe it would be better to do this in the C++ layer, to use it in both pathfinding and for the AI.
Re: EggPlant AI ramblings
I think C++ is the ugliest language ever
By doing this in JS I can quickly try lots of approaches without needing to recompile WZ. In particular, I want to work out what info is most useful to AIs to remove some of the current guesswork that might be required for future direction of JS API. If an approach turns out to be good, it can be ported to the game engine if desired.
By doing this in JS I can quickly try lots of approaches without needing to recompile WZ. In particular, I want to work out what info is most useful to AIs to remove some of the current guesswork that might be required for future direction of JS API. If an approach turns out to be good, it can be ported to the game engine if desired.
"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
Re: EggPlant AI ramblings
Recompiling warzone2100 after changing e.g. "astar.cpp" takes 13 seconds on my fairly old system, even without using any tricks such as ccache. So that cost is neglibile. Plus, chances are that the compile will already detect an error that Javascript would only tell you about within the game.
Re: EggPlant AI ramblings
Learning C++ would take me several months on my fairly old brain.
"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
Re: EggPlant AI ramblings
That may be true - developing in a language that you know well is always a lot easier and faster than in one that you don't. Yet it may pay off to do otherwise, in particular with C/C++ because these can be just incredibly fast when used right.
JavaScript is generally heavily overrated. A lot of the hard core JS fans just never learned any other language right, though. They focus on the web, and there is no other choice for the browser side, so they have to do a lot in JS anyway. Yet, the language is a much larger mess of quirks and hacks than C++ ever was, even the old C++ versions that really sucked.
However, if you have a good C++ toolchain set up - debuggers, memory analyzers, code checkers, libraries libraries libraries - then it is really good. Much better than JavaScript, which has very little support for finding bugs early. Or debugging. Or profiling. Ever tried to profile a slow jQuery application in a web browser? Yet, this is pretty much the best JS toolchain you can find. I doubt that javascript in warzone has a profiler function to help you make your AI faster.
C++ is the nerd that everybody bullies, JS is the football star that everybody tries to befriend. That doesn't make JS smarter than the nerd though.
JavaScript is generally heavily overrated. A lot of the hard core JS fans just never learned any other language right, though. They focus on the web, and there is no other choice for the browser side, so they have to do a lot in JS anyway. Yet, the language is a much larger mess of quirks and hacks than C++ ever was, even the old C++ versions that really sucked.
However, if you have a good C++ toolchain set up - debuggers, memory analyzers, code checkers, libraries libraries libraries - then it is really good. Much better than JavaScript, which has very little support for finding bugs early. Or debugging. Or profiling. Ever tried to profile a slow jQuery application in a web browser? Yet, this is pretty much the best JS toolchain you can find. I doubt that javascript in warzone has a profiler function to help you make your AI faster.
C++ is the nerd that everybody bullies, JS is the football star that everybody tries to befriend. That doesn't make JS smarter than the nerd though.
Re: EggPlant AI ramblings
javascript is ugly too It has a lot of WAT and other magic (https://www.destroyallsoftware.com/talks/wat)aubergine wrote:I think C++ is the ugliest language ever
And C-style syntax. Braces, braces evrywhere!
James Iry. A Brief, Incomplete, and Mostly Wrong History of Programming Languages http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html wrote:1995 - Brendan Eich reads up on every mistake ever made in designing a programming language, invents a few more, and creates LiveScript. Later, in an effort to cash in on the popularity of Java the language is renamed JavaScript. Later still, in an effort to cash in on the popularity of skin diseases the language is renamed ECMAScript.
I like python
Code: Select all
>>> from __future__ import braces
SyntaxError: not a chance
http://addons.wz2100.net/ developer
Re: EggPlant AI ramblings
Ah, that WAT talk, not seen that for a while, always makes me chuckle. I think its those WAT things with JS that make it so endearing It's my language of choice, I love it like an old pair of slippers.
"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
Re: EggPlant AI ramblings
I've finally got round to setting up a wiki space to document EggPlant - still very early stages so not much there at the moment, my main focus is on getting some of the APIs documented first: https://warzone.atlassian.net/wiki/display/EGG
I've also started jotting down a list of potential chat commands which will allow other players to interact with EP: https://warzone.atlassian.net/wiki/disp ... t+Commands
I've also started jotting down a list of potential chat commands which will allow other players to interact with EP: https://warzone.atlassian.net/wiki/disp ... t+Commands
"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