DyDoBP: New AI on MultiAIpack

For code related discussions and questions
User avatar
whippersnapper
Regular
Regular
Posts: 1183
Joined: 21 Feb 2007, 15:46

Re: DyDoBP: New AI on MultiAIpack

Post by whippersnapper »

Tenoh wrote:Hmm... i dont get it,just like BP thisAI also deletes its HQ and rebuilds it somewhere else, wth!
DylanDog wrote:This "feature" will be removed from the next version of DyDo-BP, I do not like it neither.
BP v.2.92 does NOT "just delete" it's HQ. There is a reasoned basis for this which was dubbed in 2001 as a "move base event" which is drawn from RL canny military tactics which if you're interested you can research for yourself under "Irregular or Asymmetric Warfare". I like and appreciate it's full scope so it will definitely remain in my own modified v.2.92 BP and if NiKer does go forward with enhancing his own BP to version 3.0 I hope he builds on this solid RL military tactical concept.

javierkaiser wrote:I just tried it last night, and I liked it :)
It even write something when it kills something or you destroy it's units/bases. First time I see something like that :D
Troman conceived and implemented that for the second major iteration of his totally original "Aivolution" some years ago now (the first major iteration being with "Unit Transport Drops", also very unique and, IMHO, should never have been removed. Actually Troman did have second thoughts about it and was considering re-inserting / integrating again a couple years ago..).

Hmmm... seems like my conditional inference of last week can now be affirmed. ;)

L8r, whip :ninja:
.
J.Vaughan
Trained
Trained
Posts: 101
Joined: 15 Mar 2007, 01:41
Location: Baltimore, MD

Re: DyDoBP: New AI on MultiAIpack

Post by J.Vaughan »

Sounds great, only thing I'm a little worried about is multiplayer. I'm not aware of how you can avoid having someone taking p2 spot (their color maybe?) It still seems a little more advanced than load up and click to play. Are there any other methods of mixing the two AI's ? I would personally be fine with just the Dydo-BP standalone however mixing two ai's is an interesting concept. Aivolution is becoming somewhat obsolete according to everyone elses suggestions... Maybe just mixing your version of BP and Nikers version of BP so that there is a difference between how the AI plays, just a very subtle one.
User avatar
whippersnapper
Regular
Regular
Posts: 1183
Joined: 21 Feb 2007, 15:46

Re: DyDoBP: New AI on MultiAIpack

Post by whippersnapper »

J.Vaughan wrote:Aivolution is becoming somewhat obsolete according to everyone elses suggestions...
As long as "stats" are being tweaked and are in on-going flux (for the essential re-balancing effort) ALL A.I.s will tend to technical obsolesce unless constantly reconstituted to reflect those changes or if they are "packaged" (like NiKer's KMS) to only run with their own stable "base stats". (BTW - In earlier incarnations of Become Prey, NiKer scripted BP to assume aspects of other A.I. personalities dynamically in a game. If memory serves me, he did this back around 2003. That was quite an interesting version of BP.)

From the summer of 1999 forward we always played with more than one WZ AI simultaneously. We called them "personalities" and one of the first IRC discussions we had with Pumpkin's A.I. guru Alex Lee in June '99 (who now works with Will Wright's team on "Spore" A.I,) was about implementing multiple WZ A.I. Personalities in a single game. The first 3rd party utility we invested to do this was called "WZ Mod Switcher" and was coded by Sputnick. Later, WSMS was obsolesced by Troman designing and coding "WZ Starter" which did multiple A.I. personalities as well as Mods and a bunch of other stuff including running compatible checks to avoid CTDs caused by trying to run simultaneously incompatible mods-A.I.s (this last was a long journey to accomplish). Speedy's A.I. work was also pivotal in this successful mix of multiple A.I personalities in a single game.

Regards, whip :ninja:
.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: DyDoBP: New AI on MultiAIpack

Post by Per »

By the way, I am rummaging around in the script code at the moment, so if you see any script functions that you really would want to have added, then let me know. The first script function scheduled to go in is droidCanReach(droid, x, y) to see if a droid could possibly go to a location, given its type of propulsion (see http://developer.wz2100.net/ticket/838).
User avatar
whippersnapper
Regular
Regular
Posts: 1183
Joined: 21 Feb 2007, 15:46

Re: DyDoBP: New AI on MultiAIpack

Post by whippersnapper »

Per wrote:By the way, I am rummaging around in the script code at the moment, so if you see any script functions that you really would want to have added, then let me know. The first script function scheduled to go in is droidCanReach(droid, x, y) to see if a droid could possibly go to a location, given its type of propulsion (see http://developer.wz2100.net/ticket/838).
THAT will help a whole bunch with all the poorly designed maps wherein constructor droids leave base platforms at start of game and first range on up for grabs oil resources but they themselves are "out of range" of the nearest available passable way to the resource and end-up uselessly fixated on the "out-of-reach" resource. This alone monumentally screws-up the optimal scripting roll-out of ALL Ski A.I.s and reminds me of the property of non-linearity captured in the basic logistic map equation of dynamical systems (a cornerstone of Chaos / Complexity science. T'is also lookin' like this year-long meme dissemination may finally go viral. Cool.)

- whip :ninja:
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: DyDoBP: New AI on MultiAIpack

Post by DylanDog »

Per wrote:By the way, I am rummaging around in the script code at the moment, so if you see any script functions that you really would want to have added, then let me know. The first script function scheduled to go in is droidCanReach(droid, x, y) to see if a droid could possibly go to a location, given its type of propulsion (see http://developer.wz2100.net/ticket/838).
droidCanReach() will be very useful!

I have some more questions about the script code:

- Documentation : I am using this one and this one as reference, is it the most update one? i am asking this because looking at AIvolution script, I noticed following functions which are not listed in the documentation above, they are:
recallOilDefendLoc(); dbg(); circlePerimPoint(); getStructureVis(); closestDamagedGroupDroid();

- New function: it would be nice to have a function which would help to recognize the type of terrain, at least if it is water or not. This would help AI to choose the right templates when playing.

- New function: it would be nice to have a function to check for gateways position and get their position. I think the one mentioned in the documentation is not working (none of the AIs uses it and when I added it to DyDo-BPO it stopped the script running):

Code: Select all

BOOL getNearestGateway(INT x, INT y, ref rX, ref rY)
Puts the coordinates of the nearest gateway into reference variables rX and rY. It might not though if there are no gateways on the present map. So make sure you look at the return value. If it's FALSE, then the values in rX and rY will be meaningless - unchanged actually, assuming the scripting works this way. Otherwise, they'll be the coordinates of the midpoint of the nearest gateway
J.Vaughan wrote:Maybe just mixing your version of BP and Nikers version of BP so that there is a difference between how the AI plays
no problem for this, actually I would like to build 3-4 wz packages mixing DyDo-BP at least with : AIvolution, BP2.92 and the standard WZ AI. I just need to test them and see which combinations are "stable". Also now DyDo-BP and BP2.92 are still too similar, I need some more time to differentiate DyDo-BP but I am working on it.

Cheers
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
User avatar
whippersnapper
Regular
Regular
Posts: 1183
Joined: 21 Feb 2007, 15:46

Re: DyDoBP: New AI on MultiAIpack

Post by whippersnapper »

DylanDog wrote:
- Documentation : I am using this one and this one as reference, is it the most update one? i am asking this because looking at AIvolution script, I noticed following functions which are not listed in the documentation above, they are:
recallOilDefendLoc(); dbg(); circlePerimPoint(); getStructureVis(); closestDamagedGroupDroid();

http://developer.wz2100.net/wiki/ScriptingManual

http://developer.wz2100.net/wiki/Script ... _callbacks

http://developer.wz2100.net/wiki/Script ... _constants

http://developer.wz2100.net/wiki/Script ... _externals

http://developer.wz2100.net/wiki/Script_functions

http://developer.wz2100.net/wiki/ScriptingDataTypes

Stark, with bona fide vim. - whip :ninja:
.
Last edited by whippersnapper on 31 Aug 2009, 14:02, edited 1 time in total.
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: DyDoBP: New AI on MultiAIpack

Post by DylanDog »

thanks!
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
User avatar
Tenoh
Trained
Trained
Posts: 359
Joined: 18 Nov 2008, 15:06

Re: DyDoBP: New AI on MultiAIpack

Post by Tenoh »

whippersnapper wrote:
BP v.2.92 does NOT "just delete" it's HQ. There is a reasoned basis for this which was dubbed in 2001 as a "move base event" which is drawn from RL canny military tactics which if you're interested you can research for yourself under "Irregular or Asymmetric Warfare". I like and appreciate it's full scope so it will definitely remain in my own modified v.2.92 BP and if NiKer does go forward with enhancing his own BP to version 3.0 I hope he builds on this solid RL military tactical concept.

:
.
Have to disagree with you.Real life tactics have no place in WZ.You only have small map and not endless continent.I see no logical or strategic reason to relocate main structures outside of very well defended base,it does not give AI any advantage just make it waste trucks ,resources and time.i would only use it when the base is doomed and you have to rush your last trucks to allies base.
"No, you don't want to buy this Sh[beep]t from me. It shoots sideways, it was built by retard zombies in some f[beep]king outreach program." HL:G
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: DyDoBP: New AI on MultiAIpack

Post by Per »

DylanDog wrote: droidCanReach() will be very useful!
It is now in trunk. It won't work on 2.2 because the required support code is not backported (yet), but I can add a dummy function call for it that always returns true so that scripts won't fail if they try to use it.
DylanDog wrote: - New function: it would be nice to have a function which would help to recognize the type of terrain, at least if it is water or not. This would help AI to choose the right templates when playing.
I am planning to add a function bool mapHint(string) that would allow a map maker to add any string as a hint to AIs playing on it, eg "water" for a water map, once the new savegame format hits the streets.
DylanDog wrote: it would be nice to have a function to check for gateways position and get their position. I think the one mentioned in the documentation is not working (none of the AIs uses it and when I added it to DyDo-BPO it stopped the script running):

Code: Select all

BOOL getNearestGateway(INT x, INT y, ref rX, ref rY)
Puts the coordinates of the nearest gateway into reference variables rX and rY. It might not though if there are no gateways on the present map. So make sure you look at the return value. If it's FALSE, then the values in rX and rY will be meaningless - unchanged actually, assuming the scripting works this way. Otherwise, they'll be the coordinates of the midpoint of the nearest gateway
If you give me an easy way to reproduce the problem with it, I can see if I can figure it out.
User avatar
whippersnapper
Regular
Regular
Posts: 1183
Joined: 21 Feb 2007, 15:46

Re: DyDoBP: New AI on MultiAIpack

Post by whippersnapper »

whippersnapper wrote:
BP v.2.92 does NOT "just delete" it's HQ. There is a reasoned basis for this which was dubbed in 2001 as a "move base event" which is drawn from RL canny military tactics which if you're interested you can research for yourself under "Irregular or Asymmetric Warfare". I like and appreciate it's full scope so it will definitely remain in my own modified v.2.92 BP and if NiKer does go forward with enhancing his own BP to version 3.0 I hope he builds on this solid RL military tactical concept.
.
Tenoh wrote:Have to disagree with you.Real life tactics have no place in WZ.You only have small map and not endless continent.I see no logical or strategic reason to relocate main structures outside of very well defended base,it does not give AI any advantage just make it waste trucks ,resources and time.i would only use it when the base is doomed and you have to rush your last trucks to allies base.
To each his own. I could debate my points quite well - not only in theory but with pragmatics, extensive experience and even a mass of data. But based on past experience I would only be wasting both our time and shanghaing this thread were it's quite obvious that even any specifically relevant experience and information expressed by yours truly is of minimal visible interest - at least for appearances sake - though likely it will manifest in something down the road and professed as an aha! thought or act. A pattern seen ad nauseum. Perhaps best to stick to the naturally "sympatico" from the get go. Having values in common like candor, grace, empathy, fidelity and wit comes through immediately & makes for this very experience of posting having a lasting value too. Metaphorically akin the bright beckon of a lighthouse on an otherwise pitch black, rip-tide, reef-riddled, coast.

Anyway, I can pretty much do whatever I need and want to do to actualize my evolving vision of WZ GPMs in all 3 modes and do indeed - and have for well nigh a decade now.. I enjoy the process of doing, the results of course are thoroughly to my liking at the end of the long, working, journey and my MP buds have fun with it all too as have many in the community over the years with past creations released and recycled to this day. Sharing practical know-how can also be very rewarding with like minded folk. So, hoping not to come across as ungracious or brusque - why would any stranger's disapproval, sans even a modest portfolio of accomplishment to back them up (not that even that would make a real difference, however impressive), be anything but moot and factor not a whit in what I enjoy and have a passion to implement ? A rhetorical question that, like - "Does a bear chit in the woods ?" - which will constitute my arrivederci ! to engaging your PoV, or this topic thread, any further. :stare:

- whip :ninja:
.
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: DyDoBP: New AI on MultiAIpack

Post by DylanDog »

Per wrote:It is now in trunk. It won't work on 2.2 because the required support code is not backported (yet), but I can add a dummy function call for it that always returns true so that scripts won't fail if they try to use it.
yep, that would be very useful!
Per wrote:If you give me an easy way to reproduce the problem with it, I can see if I can figure it out.
Hi Per
In this wz package tested on WZ2.2.1 you will see that the event defendBaseDyDo(every,30) is executed only once, after the function getNearestGateway() is called the event stops and it is never executed again.

Code: Select all

event defendBaseDyDo(every,30)
{
	local int _x,_y;
	local DROID _defTruck;
	local bool _testGateway;
	
	_x= 0;_y=0;
	
  if(LIFE)        
  {
		if(( (player == selectedPlayer) or (not myResponsibility(player)) ) and (AIControl == false))
		{
			setEventTrigger(defendBaseDyDo, inactive);
		}
		else
		{
			displayMsg("getNearestGateway -------------- before calling the function getNearestGateway() coord("& _x &")("& _y &")------------------------ ");
			_testGateway = getNearestGateway(baseX, baseY, ref _x, ref _y);
			displayMsg("getNearestGateway: -------------- after the function ( "& _testGateway &" )------------------------ ");
			
you will see only the fist message on the screen

Code: Select all

displayMsg("getNearestGateway -------------- before calling the function getNearestGateway() coord("& _x &")("& _y &")------------------------ ");
and the second message after getNearestGateway() never appears

Code: Select all

displayMsg("getNearestGateway: -------------- after the function ( "& _testGateway &" )------------------------ ");
you can download the AI here: www.obooma.net/files/testing_gateway.wz

I have tested it in 4 maps (T1-4players), all with the same result, I have chosen player 0 and created an alliance with player 2 (DyDo-BO) to be able to see the messagews.
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: DyDoBP: New AI on MultiAIpack

Post by Per »

Can you please put this in a ticket so I do not forget about it. There are some other issues I need to address first.
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: DyDoBP: New AI on MultiAIpack

Post by DylanDog »

Per wrote:Can you please put this in a ticket so I do not forget about it. There are some other issues I need to address first.
done:Ticket #877 (new defect)

This is my first ticked opened therefore apologies if I did something wrong. :)
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: DyDoBP: New AI on MultiAIpack

Post by Per »

I think I found the issue. Some functions take world coordinates, others map (tile) coordinates. If you use the wrong coordinate system, the call will fail. This one wants map coordinates, so if you divide the input coordinates you are using by 128, it should work.

(As an aside, I think this dual coordinate system stuff is really too confusing to expose to the scripting world. We should probably make sure only world coordinates are used in scripts some day.)
Post Reply