Page 10 of 12

Re: EggPlant AI ramblings

Posted: 17 Mar 2012, 11:02
by Emdek
aubergine, this is a way to go, just needs test for performance (like animating that way 100 units at once). ;-)
You can get some inspiration for API here (lots of material to analyze):
http://qt-project.org/doc/qt-4.8/animat ... rview.html

Re: EggPlant AI ramblings

Posted: 02 Apr 2012, 21:34
by Giani
How is the AI going?

Re: EggPlant AI ramblings

Posted: 03 Apr 2012, 20:13
by aubergine
The AI is going slow at the moment. I've hit a bit of a brick wall in terms of dynamic research - I can easily make it research random stuff, but I want it to research stuff in a more intelligent manner than that. I'm currently taking a brain distraction and doing some videos http://www.youtube.com/playlist?list=PL ... ature=plcp

Re: EggPlant AI ramblings

Posted: 03 Apr 2012, 20:52
by NoQ
May i have a word? Just some trivial thoughts.

Even though this nullbot thing of mine may be relatively strong, you shouldn't really bother with beating it in play strength. On the other hand, your focus on a transparent and well-designed code base is something i can't dream of (because of being a poor coder), but once the fundamental code is done, i could easily feed the existing well-tested data (strategy definitions) into it and thus make it as strong as i currently can. In this case, nullbot will die, having fulfilled its primary purpose of being a quick and dirty experimental proof-of-concept piece of code (hence the name), and i'll be really happy about that.

Am i right to understand the process going on here this way? (:
_________

About dynamic research ... when i added 5-way research adaptation to nullbot, the heart of the algorithm used is called the adaptation matrix. It could have been a matrix in your common mathematical sense (a linear operator transforms a vector of game situation describing numbers into a vector of decision priorities), but it turned out to be a non-linear operator at the end (but the word "matrix" still sounds cool, so i think i'd keep it).

For example, suppose we have two-dimensional adaptation: we take the number of enemy tanks and cyborgs on the board and want to find out how many AT and AP weapons we need. Let x be a vector (x1,x2), where x1 is the number of tanks and x2 is the number of cyborgs. Let y be a vector (y1,y2), representing our decision: we need to pick AP research in y1 cases and AT research in y2 cases out of y1+y2. Then if we pick a simple adaptation matrix

Code: Select all

    / 0   1 \
A = |       |
    \ 1   0 /
and let y=Ax, we will have an adaptation method: AP:AT research ratio will be equal to borg:tanks ratio. This might be suitable for MG/Rockets AI, but MG/Cannons AI (that uses cannons as AT weapons) might prefer another matrix:

Code: Select all

     / 0   2 \
A' = |       |
     \ 1   1 /
considering the fact that cannons work better against cyborgs than rockets do. That second adaptation matrix will make AI not stop researching cannons even when no tanks are present on the board. That's not really good. So there is certain freedom in picking the adaptation matrix, and it's not obvious which one is the best.

The same idea can be applied to adapting production ratios.

Well, i'm not saying anything non-trivial, that's just some sort of clarity that i'm relying on since recently.

Re: EggPlant AI ramblings

Posted: 03 Apr 2012, 21:28
by NoQ
The other idea is to make a priority queue of "research exceptions", which is a series of statements similar to the following:
- If we have seen an enemy cyborg for the first time, research TMG with prioirty 3;
- If we were just attacked by enemy nexus link turret, research nexus resistance with priority 2; /*we will still research tmg first*/
- If we were just attacked by an enemy VTOL or seen an enemy VTOL factory, research hurricane with priority OVER9000;
- If nothing in particular, research laser satellite with priority 1;
etc.

Maybe the whole AI could be made of exceptions?

Re: EggPlant AI ramblings

Posted: 04 Apr 2012, 02:37
by Giani
NoQ wrote: Maybe the whole AI could be made of exceptions?
That would make him better than many human players and nullbot :)

Re: EggPlant AI ramblings

Posted: 04 Apr 2012, 06:44
by NoQ
Giani wrote:
NoQ wrote: Maybe the whole AI could be made of exceptions?
That would make him better than many human players and nullbot :)
So certain are you =/ The real question is how much readable the code will be.

Re: EggPlant AI ramblings

Posted: 04 Apr 2012, 08:15
by aubergine
Priority based research / building / etc., is certainly a key design factor in EggPlant - almost everything uses prioritised lists.

The big problem I have with research is that currently it's not possible to write code that works out what to research based on game state without ending up with very crufty code.

It's why I started the project to try and find a way of representing the tech tree in a big spreadsheet which would define more detailed info and categorisation for each research item. If I ever manage to finish that task and then convert the data in to JSON format, so it can easily be included in to an AI, then the code that interfaces with it will be very clean and readable, although perhaps non-transparent because it won't be clear from reading the code what it will research (because that is actually defined in-game by the actions of your opponents).

Re: EggPlant AI ramblings

Posted: 05 Apr 2012, 01:06
by dak180
aubergine wrote:It's why I started the project to try and find a way of representing the tech tree in a big spreadsheet which would define more detailed info and categorisation for each research item. If I ever manage to finish that task and then convert the data in to JSON format, so it can easily be included in to an AI, then the code that interfaces with it will be very clean and readable, although perhaps non-transparent because it won't be clear from reading the code what it will research (because that is actually defined in-game by the actions of your opponents).
I am not sure if this will help you any but my understanding is that the stats for wz were (when being originally developed by pumpkin) represented as a full on database for the purpose of editing and were subsequently exported to text files in order to allow for easier modding and reading at run time.

Re: EggPlant AI ramblings

Posted: 05 Apr 2012, 01:40
by Rman Virgil
aubergine wrote:It's why I started the project to try and find a way of representing the tech tree in a big spreadsheet which would define more detailed info and categorisation for each research item. If I ever manage to finish that task and then convert the data in to JSON format, so it can easily be included in to an AI, then the code that interfaces with it will be very clean and readable, although perhaps non-transparent because it won't be clear from reading the code what it will research (because that is actually defined in-game by the actions of your opponents).
dak180 wrote:I am not sure if this will help you any but my understanding is that the stats for wz were (when being originally developed by pumpkin) represented as a full on database for the purpose of editing and were subsequently exported to text files in order to allow for easier modding and reading at run time.
That is correct. It was built in MS Access db. The lead software engineer / designer burned a copy on CD and mailed it to us from their game dev studio in Bathe, England, in October 1999..

The running joke back then was that they got it to us (with a bunch of other useful stuff) just in time for us to carve up pumpkins for Halloween. ;)
.

Re: EggPlant AI ramblings

Posted: 07 Apr 2012, 14:48
by cue
Good work!

Looking forward to bashing the life out of your EggPlant AI with my friends :twisted:

Re: EggPlant AI ramblings

Posted: 11 Apr 2012, 19:14
by cue
@aubergine are you stopping this one?
I see you are busy with NullBot.

Re: EggPlant AI ramblings

Posted: 11 Apr 2012, 21:30
by aubergine
I'm learning a lot looking at the NullBot code and it's making me think a lot about the best approach for EggPlant.

I think the first part of EggPlant that I'm going to try and get finished in the VAULT module that keeps track of game objects. If that works OK then the rest should be relatively straightforward to implement. Main blocker on VAULT is my complete lack of RegEx knowledge so if there are any RegEx gurus around please let me know :)

Re: EggPlant AI ramblings

Posted: 11 Apr 2012, 21:36
by Emdek
Regular expressions?
Maybe this documentation will help you (pattern rules in JS should be at least very similar):
http://qt-project.org/doc/qt-4.8/QRegEx ... troduction

Though I see that they are very limited there...
http://www.regular-expressions.info/javascript.html

Re: EggPlant AI ramblings

Posted: 11 Apr 2012, 23:07
by aubergine
I'm completely befuddled when it comes to regex. :(