DyDoBP: New AI on MultiAIpack

For code related discussions and questions
User avatar
Zarel
Elite
Elite
Posts: 5770
Joined: 03 Jan 2008, 23:35
Location: Minnesota, USA
Contact:

Re: DyDoBP: New AI on MultiAIpack

Post by Zarel »

Per wrote: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.)
What's the difference between world and map coordinates? If world coordinates are in units of 1/128 tiles, then maybe it would be better to make sure only map coordinates are used.
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 »

Map coordinates are by tiles, each increment is one tile. World coordinates are 128 points per tile. So you can convert from one to the other by multiplying or dividing by 128. However, when calculating new positions in world coordinates, you should also add half a tile so that the new position is at the center of the tile, not at its edge.

I do not really have much of an opinion as to which coordinate system scripts should use, but I do think they should only use one of them.
User avatar
Zarel
Elite
Elite
Posts: 5770
Joined: 03 Jan 2008, 23:35
Location: Minnesota, USA
Contact:

Re: DyDoBP: New AI on MultiAIpack

Post by Zarel »

I dunno; I can think of situations where one would be better, and situations where the other would be better.

It's your call, I guess.
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: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.
You are right it works! I tested it with DyDo-BP 1.04 and WZ2.2.2.

Code: Select all

    local float basecoordX ,basecoordY ;
    local int _x,_y;
    basecoordX = (float)baseX/(float)TILE;
    basecoordY = (float)baseY/(float)TILE;
    _x = 0;
    _y = 0;
   if ( getNearestGateway( (int)basecoordX, (int)basecoordY, ref _x, ref _y ) )
...do something
An update on DyDo-BP.
I have set up a very very simple webpage to keep track of the various versions, for bug reportings and so on...I think such things can be better managed outside this forum.The link to the webpage will follow in another new post at some point next week I think.

I have spent at least 4-5 hours a day until now to develop and test it. I think I am starting to reach a good point where I can say "I have improved a bit BP" (and fixed some bugs!).

I have soooo many ideas on new features but developing an AI requires a lot of testing and takes much much time...be patience.

I hope Nikers will continue to develop BP too...at the end both AIs should have very different personalities to better enjoy skirmish games.
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 »

.

When you write Campaign A.I. scripts you NEED to use "map coordinates" from 32EW because you are writing A.I. triggers to a SPECIFIC, already created, map's locations to serve ends defined to that particular maps matrix of GOALs aka Mission Imperatives or victory conditions.

When you are writing Skirmish A.I. scripts you are writing to ANY maps relative position within the proactive-reactive telos construct (sans player defined imperatives or a specific map) of the Skirmish A.I. as it may unfold on any WZ map in existence at present or yet to be made in the future - ergo "world coordinates"

This also accounts for the functions relative to the diffs between Campaign A.I. and Skirmish A.I.

There are very good reasons for the 2 coordinate systems. Can't stand to see peeps "spinning their wheels".

- whip :ninja:
.
guciomir
Trained
Trained
Posts: 133
Joined: 05 May 2009, 22:27

Re: DyDoBP: New AI on MultiAIpack

Post by guciomir »

what is the current status for the AI?
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 »

guciomir wrote:what is the current status for the AI?
You can download it since yesterday here:
viewtopic.php?f=10&t=4037
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).
Post Reply