46
Suggestions / xpos, ypos, angle and dist
« on: December 15, 2007, 06:16:50 PM »
I think most everyone knows that xpos and ypos don't work for larger fields with dimensions >32000 (they get capped in current versions at 32000). Similarly for refxpos, refypos, trefxpos and trefypos.
What people may not know is that angle and dist are also similarly broken.
There are valid arguments both for and against making global information such as exact position available to bots. Personally, I am more inclined to provide only local, bot-relative information and let bots operate exclusivly from what they can "see" around them, but I hesitate to take action which would break backward compatability without some discussion and consensus.
There are two possible choices I see. The first is to do away with xpos and ypos completly and make the related refvars and trefvars as well as the semantics of angle and dist bot-relative. They would return or take relative coordinates.
The refvars would return the position of the viewed or tied bot relative to the viewing or tying bot.
'angle' and 'dist' would similary take relative positions instead of absolute positions as they do today. This has the effect of bascially making dist equivalent to pyth.
The second chocie is to retain xpos and ypos and the refvars and institute a grid system, where the field is made up of 32000 X 32000 grids. xpos and ypos would be mod 32000, thus indicating a bot's absolute position on a particular grid. Angle and dist would work as today, but using the absolute coordinates of the particular grid the bot was on and would work as long as the position the bot was using to dertermine an angle or distance was on the same grid. The result of a dist or angle would be nonsensical when the position was from another grid, say when using the xpos ypos or refvars of a bot across a grid boundary. Adding the sysvars .gridx and .gridy (along with refgridx, refgridy, trefgridx, trefgridy) would help a bot to know when this was the case. Unfortunatly I don't see a clean way to avoid bots having to deal with grid boundaries without moving to a bot-relative scheme and thus breaking backward compatability.
As above, I prefer the first option even though it breaks backward compatability. It's local rather than global, removes the need for bots to deal with grid boundaries and handles any field size. Bots will be able to do things such as
.refxpos, .refypos angle .setaim store
and have it work on any size field.
The downside is backward compatability and the fact that ant bots and such will need to find some other means of global positioning coordination.
Comments appreceiated.
What people may not know is that angle and dist are also similarly broken.
There are valid arguments both for and against making global information such as exact position available to bots. Personally, I am more inclined to provide only local, bot-relative information and let bots operate exclusivly from what they can "see" around them, but I hesitate to take action which would break backward compatability without some discussion and consensus.
There are two possible choices I see. The first is to do away with xpos and ypos completly and make the related refvars and trefvars as well as the semantics of angle and dist bot-relative. They would return or take relative coordinates.
The refvars would return the position of the viewed or tied bot relative to the viewing or tying bot.
'angle' and 'dist' would similary take relative positions instead of absolute positions as they do today. This has the effect of bascially making dist equivalent to pyth.
The second chocie is to retain xpos and ypos and the refvars and institute a grid system, where the field is made up of 32000 X 32000 grids. xpos and ypos would be mod 32000, thus indicating a bot's absolute position on a particular grid. Angle and dist would work as today, but using the absolute coordinates of the particular grid the bot was on and would work as long as the position the bot was using to dertermine an angle or distance was on the same grid. The result of a dist or angle would be nonsensical when the position was from another grid, say when using the xpos ypos or refvars of a bot across a grid boundary. Adding the sysvars .gridx and .gridy (along with refgridx, refgridy, trefgridx, trefgridy) would help a bot to know when this was the case. Unfortunatly I don't see a clean way to avoid bots having to deal with grid boundaries without moving to a bot-relative scheme and thus breaking backward compatability.
As above, I prefer the first option even though it breaks backward compatability. It's local rather than global, removes the need for bots to deal with grid boundaries and handles any field size. Bots will be able to do things such as
.refxpos, .refypos angle .setaim store
and have it work on any size field.
The downside is backward compatability and the fact that ant bots and such will need to find some other means of global positioning coordination.
Comments appreceiated.