DO while

AIFrame
Hello World
Hello World
Posts: 3

DO while

Post#1 » 01 Jan 2017, 15:32

It might be asked before, but still.
Then there is a target you want to kill first (carries resource as an example) you set an action to attack it in efficient range (short, medium), but this target moves away from you, so once it goes out of filtered range - you start to move after it. You get into attack range, starts to targeting and while you aiming - target goes away. And so on till it drops resource at base.

Here is an example of "approach enemy till short range, carring resource if it's in long range, then attack till it again in long range"
Image

It simply taggin it with bottag, then rushes to it till needed range and untag it.

But if we have DO WHILE NOT and DO WHILE (as a action modifier) it might be reached easier.
Image
To make this thing working we will need an addinional variable which will store "last executed action".
So if last executed action was "move to enemy" - cycle keeps going UNTIL it meets the condition below that action.
Once the condition is fulfilled - cycle will be interpret as a "pass-through" node and instead of doing action above cycle, it will do action below cycle (attack enemy).
Until executed root will change (any other action took place) this cycle will remain marked as "pass through me".

User avatar
J7Luke
Script
Script
Posts: 26

Re: DO while

Post#2 » 01 Jan 2017, 18:20

+1 to this. I have been trying to figure out how to do this in my AIs, and I just figured I didn't know how to do it yet. This would be really helpful for the exact chase scenario described above.

pier4r
Skynet
Skynet
Posts: 3390

Re: DO while

Post#3 » 01 Jan 2017, 18:31

The point is that the entire tree is repeated as loop, therefore internally one has only nested if.

If you solved it with tags should be good. I also think that the game should not become necessarily turing complete because then newcomers may find it harder and harder.

But anyway if we are going to have functions with arguments we may have loops as well.
http://www.reddit.com/r/Gladiabots/wiki/players/pier4r_nvidia_shield_k1 -> Gladiabots CHAT, stats, insights and more ;

User avatar
NullPointer
Autonomous Entity
Autonomous Entity
Posts: 539

Re: DO while

Post#4 » 01 Jan 2017, 18:51

I agree with pier4r.

A "while" inside another "while" will make the iterations more complex (like having to keep the "last executed action"), will need a "break" action and in the end won't really let us do anything we can't already.

But I do agree with AIFrame what we could use a better solution for scenarios like this, where enemies dance between ranges or just flee. In my opinion, the bot should always fire after it starts loading the shot and the accuracy should be calculated when the loading starts.

User avatar
HBomb
Algorithm
Algorithm
Posts: 93

Re: DO while

Post#5 » 01 Jan 2017, 20:22

I respectfully disagree that there should be loops in this game. The tags already allow you to mimic assembly language and that should be all you need to do anything that the conditions allow.

User avatar
J7Luke
Script
Script
Posts: 26

Re: DO while

Post#6 » 01 Jan 2017, 20:44

I thought that might be the case. Can someone give me an example of how you do the "if closest enemy bot is low health and low shields, move to short range, then attack while closest enemy bot is in short or medium range (once bot leaves medium range, start over)". Thanks!

User avatar
HBomb
Algorithm
Algorithm
Posts: 93

Re: DO while

Post#7 » 01 Jan 2017, 22:16

J7Luke wrote: Can someone give me an example of how you do the "if closest enemy bot is low health and low shields, move to short range, then attack while closest enemy bot is in short or medium range (once bot leaves medium range, start over)". Thanks!


1. RemoveTag1 any long or out of range enemy.
2. Shoot at closest short or medium range BotTagged1 enemy.
3. ExclusiveTag1 any short range, low health, low shield enemy.
4. Move towards closest short range, low health, low shield enemy.

Add any other precautionary checks as you wish. (other nearby enemies, own health etc)

pier4r
Skynet
Skynet
Posts: 3390

Re: DO while

Post#8 » 01 Jan 2017, 22:40

HBomb wrote:I respectfully disagree that there should be loops in this game. The tags already allow you to mimic assembly language and that should be all you need to do anything that the conditions allow.

Well actually tags are more like boolean variables assigned to items, a feature not only of assembly.
http://www.reddit.com/r/Gladiabots/wiki/players/pier4r_nvidia_shield_k1 -> Gladiabots CHAT, stats, insights and more ;

User avatar
HBomb
Algorithm
Algorithm
Posts: 93

Re: DO while

Post#9 » 01 Jan 2017, 23:08

pier4r wrote:
HBomb wrote:I respectfully disagree that there should be loops in this game. The tags already allow you to mimic assembly language and that should be all you need to do anything that the conditions allow.

Well actually tags are more like boolean variables assigned to items, a feature not only of assembly.


If you can write assembly language (aka machine code) then you can write any higher level language and execute any possible program provided you have the variables.

In fact, once you can AND tags (in actions) I think that the bots may be Turing complete. Each one has a memory of up to five bits (debatably more depending on reuse of tags on different objects) and the team has a shared memory of another five bits. All boolean operators (not, or, and, xor) are possible. If statements are simple. And since the whole program is on loop, we can manipulate that through the use of tags. Memory size would be the issue, not functionality. But relevant to the game is that our only limitation is what states of the battlefield can be read, such as enemy health (readablr), is enemy aiming at me (not readable yet)

User avatar
J7Luke
Script
Script
Posts: 26

Re: DO while

Post#10 » 02 Jan 2017, 01:26

HBomb wrote:1. RemoveTag1 any long or out of range enemy.
2. Shoot at closest short or medium range BotTagged1 enemy.
3. ExclusiveTag1 any short range, low health, low shield enemy.
4. Move towards closest short range, low health, low shield enemy.
Add any other precautionary checks as you wish. (other nearby enemies, own health etc.)



I thought it would probably involve tags. Thanks! :D

pier4r
Skynet
Skynet
Posts: 3390

Re: DO while

Post#11 » 02 Jan 2017, 09:16

HBomb wrote:cut


You have a point
http://www.reddit.com/r/Gladiabots/wiki/players/pier4r_nvidia_shield_k1 -> Gladiabots CHAT, stats, insights and more ;

Return to “Feature Requests”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest