Author Topic: Newbie's presentation and questions.  (Read 3229 times)

Offline Vortex

  • Bot Neophyte
  • *
  • Posts: 5
    • View Profile
Newbie's presentation and questions.
« on: November 09, 2009, 01:55:34 PM »
Hi everybody, here's Vortex from Italy  

First of all I'll say that I found DarwinBots while looking for alife games. I was looking for something that could let me do a bunch of things directly to the creatures, not like Spore, that is, in my opinion, too much "arcade". So the reason I play is only for gaming purpose, I'm not a programmer nor a biologist or a scientist whatsoever (I'm law student, to be honest  ).

Since I'm not a programmer (I've done a few things with php, nothing special), I'm finding some concepts quite difficult to understand and use properly, but I'm sorting most of them out by myself and with some patience I'm sure I'll have fun.



Now the noob questions:

1. I saw that in the forum there are a lot of topic with the last reply going back by months... I'm sure the project is still alive but how much? Can you estimate how many of you are regularly following the community? Just to have an idea.


About the DNA coding, I'm trying to figure out things mostly by myself and the wiki, but there are some things a wasn't able to find:

2. How does the .eyeX distance work? The wiki says that the value is proportional... proportional to what? "*.eye5 40 <" means the the eye5 (main front eye, as I understood) should be minor than 40. But how do I use this value to calculate and define the distance at which the bot should shoot?

3. Following tutorials, I found this two genes (simplebot1.txt of PY)

[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']'Gene1. Simple search pattern.
cond
  *.eye3 *.eye5 >
start
  -70 .aimdx store
stop

' Gene2. Simple search pattern part 2
cond
  *.eye7 *.eye5 >
start
 70 .aimdx store
stop


I think this is related to the previous question. I understand that the first gene means something like "If eye3 value is major than eye5 value, than turn left by 70" and the second gene is "if eye7 is major than eye5 turn right". But why? I don't get what should be in the eyeX slot and how to deal with it. (at the moment I'm just making my bots dancing around with *.eye5 0 = X .aimdx store )





Thank you in advance for your patience and help.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Newbie's presentation and questions.
« Reply #1 on: November 09, 2009, 03:35:24 PM »
Quote from: Vortex
1. I saw that in the forum there are a lot of topic with the last reply going back by months... I'm sure the project is still alive but how much? Can you estimate how many of you are regularly following the community? Just to have an idea.

Maybe a dozen or so active in the forums.  It goes through waves.  Right now there's no one really bug fixing the current program, and Darwinbots3 is still in development, so I get the impression that most people are sort of taking a wait-and-see approach.  But we're a pretty reactive community so if you have a cool new bot/evo sim/ whatever and post about it you should get some posts from different prople.

Quote
About the DNA coding, I'm trying to figure out things mostly by myself and the wiki, but there are some things a wasn't able to find:

2. How does the .eyeX distance work? The wiki says that the value is proportional... proportional to what? "*.eye5 40 <" means the the eye5 (main front eye, as I understood) should be minor than 40. But how do I use this value to calculate and define the distance at which the bot should shoot?

The closer you are to your target, the larger the value will be.  There's an exact formula if you're interested.  You can probably dig it up in the source code.  Most of the numbers, like 40, are just magically picked by people because they seem to work.  Not much science involved.

Quote
I think this is related to the previous question. I understand that the first gene means something like "If eye3 value is major than eye5 value, than turn left by 70" and the second gene is "if eye7 is major than eye5 turn right". But why? I don't get what should be in the eyeX slot and how to deal with it. (at the moment I'm just making my bots dancing around with *.eye5 0 = X .aimdx store )

Turning genes are a whole kettle of worms, and everyone has a different flavor.  Basically, eye5 is in the center, with the eye1-4 to the left of eye5, and eye6-9.  So the turning genes ala PY work by checking the peripheral version for stuff, and then tentatively queing up a turn, then potentially overriding it if the more central vision has stuff in it.  There's a bit of magic going on...

Offline Vortex

  • Bot Neophyte
  • *
  • Posts: 5
    • View Profile
Newbie's presentation and questions.
« Reply #2 on: November 09, 2009, 04:56:31 PM »
Quote from: Numsgil
The closer you are to your target, the larger the value will be.  There's an exact formula if you're interested.  You can probably dig it up in the source code.  Most of the numbers, like 40, are just magically picked by people because they seem to work.  Not much science involved.

I saw that the food shot is around 40/50... I'll just stick to it to get started. Anyways, it should be that I have to put a lower value if I want my little beast to shoot from further away, right? Do you know which is the range? (max_closest_to_me_value - max_far_away_value)


Quote
Turning genes are a whole kettle of worms, and everyone has a different flavor.  Basically, eye5 is in the center, with the eye1-4 to the left of eye5, and eye6-9.  So the turning genes ala PY work by checking the peripheral version for stuff, and then tentatively queing up a turn, then potentially overriding it if the more central vision has stuff in it.  There's a bit of magic going on...

So, if I got it straight: the value is larger the closer is the enemy. So " *.eye3 *.eye5 > start -70 .aimdx store ", in human language, should be: "if the eye3 on my left has a higher value that the eye5 on my front, it means that I have a target on my left. If this condition is true I might better turn to my left by -70, in order to have that target exactly in front of me". Is that right?



And another question: what is the syntax in order to use logic operators? Example, I want to make the bot grow up to a certain amount of body points, before reproducing.

Human language: "Check if body is below 8000 AND check if energy is above 15000, if both conditions return true, get fatter. When you get to 8000 body stop doing that . If you don't have enough energy don't do that."


Coded:

*body 8000 <
*nrg 15000 >
5000 .strbody store


How do I write the "AND" operator? (or OR or whatever logic operator)





PS: I know it might sound a bit "slow" to you to use my "human language" method, but I told you I'm not a programmer so I need it at the beginning, to understand what does what

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Newbie's presentation and questions.
« Reply #3 on: November 09, 2009, 05:13:49 PM »
Quote from: Vortex
Quote from: Numsgil
The closer you are to your target, the larger the value will be.  There's an exact formula if you're interested.  You can probably dig it up in the source code.  Most of the numbers, like 40, are just magically picked by people because they seem to work.  Not much science involved.

I saw that the food shot is around 40/50... I'll just stick to it to get started. Anyways, it should be that I have to put a lower value if I want my little beast to shoot from further away, right? Do you know which is the range? (max_closest_to_me_value - max_far_away_value)

Unless Eric changed it when he was working with the code, range actually increases as you get more body.  So an exact number is somewhat hard.  Plus the distance the shot travels depends on the speed you were traveling when you shot it.

Quote
So, if I got it straight: the value is larger the closer is the enemy. So " *.eye3 *.eye5 > start -70 .aimdx store ", in human language, should be: "if the eye3 on my left has a higher value that the eye5 on my front, it means that I have a target on my left. If this condition is true I might better turn to my left by -70, in order to have that target exactly in front of me". Is that right?

Right

Quote
And another question: what is the syntax in order to use logic operators? Example, I want to make the bot grow up to a certain amount of body points, before reproducing.

Human language: "Check if body is below 8000 AND check if energy is above 15000, if both conditions return true, get fatter. When you get to 8000 body stop doing that . If you don't have enough energy don't do that."


Coded:

*body 8000 <
*nrg 15000 >
5000 .strbody store


How do I write the "AND" operator? (or OR or whatever logic operator)

*body 8000 <
*nrg 15000 > and
5000 .strbody store

The and operators work with the same reverse polish notation, but they operate on the boolean stack instead of the integer stack.

Quote
PS: I know it might sound a bit "slow" to you to use my "human language" method, but I told you I'm not a programmer so I need it at the beginning, to understand what does what

Not at all, it makes perfect sense.  I'd recommend putting them in there as comments above any code you write.  This is a write-only sort of programming language.  It's very hard to see code and figure out what the author intended, as you've already noticed.  I basically wrote the better part of the virtual machine and I still have a hard time working through what code is doing.  Especially if it's presented without any newlines.  Single gene bots, before the inplace conditions made the whole practice somewhat obsolete, where especially a pain to read.  You could write them fairly easily, but deciphering what they did was next to impossible.

Offline Vortex

  • Bot Neophyte
  • *
  • Posts: 5
    • View Profile
Newbie's presentation and questions.
« Reply #4 on: November 09, 2009, 07:04:53 PM »
Thanks a lot for your kind help. I'll go on with tutorials... see you soon, I guess