Author Topic: How to use my new features.  (Read 5240 times)

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
How to use my new features.
« on: May 30, 2005, 01:27:40 PM »
New features for 2.37

First there is the shape settings.

You probably all know by now that pressing the smiley face on the tool bar, your robots all change to triangles.

Well it doesn't quite do that any more.
What you get now is a random number of sides between 3 and 5....

unless.......

You use the new feature in your robot's DNA file that allows you to select the number of sides for the robot to have.

To use this, just add a line at the beginning of the robot's DNA using the new "shp" feature. Here is how you do it.

Code: [Select]
shp 4

cond
'your condition
start
'your action
stop

etc.'
This will give youa square robot.
shp 3 will give you a triangle and so on.


The second new feature relates to ties. These days robots can have 4 ties (rather than 3 like they used to)
Each of these ties is held in a small array inside the robot structure. Besides each tie having a unique (or sometimes not so unique) address number, they each have a totally unique ID within the robot's own structure. They are automatically assigned numbers from one to four as they are created.

2.37 uses these ID numbers in 8 new sysvars to directly manipulate the angle and length of each of the four ties.

.tieang1 sets the angle of the robot with respect to tie number one.
.tieang2 sets the angle of the robot with respect to tie number two.

And so on

.tielen1 sets the length of tie number one.
.tielen2 sets the length of tie number two.

And so on

Where with the old system of .tienum, .fixlen, .fixang, the ties could only be addressed at a rate of one per cycles (because of the .tinum address system), with the new system we have a seperate sysvar for each one so they can all be addressed on every cycle.

In case you didn't download my temporary 2.35.7 last week (and therefore didn't get my tie tesrer bot) here it is again.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Light

  • Bot Destroyer
  • ***
  • Posts: 245
    • View Profile
How to use my new features.
« Reply #1 on: May 30, 2005, 02:23:52 PM »
what happens if say you have 4 ties and tie 2 gets deleted do the other ties remain numbered 1,3,4 and if another tie is created it would become tie 2?

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
How to use my new features.
« Reply #2 on: May 30, 2005, 11:46:08 PM »
To be absolutely honest I don't know. I haven't tracked the old code through that far yet.
It will be made such that they retain their id but I'm not sure that they do right now.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Carlo

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
How to use my new features.
« Reply #3 on: May 31, 2005, 04:17:03 AM »
Quote
To use this, just add a line at the beginning of the robot's DNA using the new "shp" feature. Here is how you do it.


CODE 

shp 4

cond
'your condition
start
'your action
stop

etc.'
 
This will give youa square robot.
shp 3 will give you a triangle and so on.

Hmm. I hope this shall have effects ONLY on the simulation appearance. First, because having three options (triangle, square, pentagon) is not exactly what I'd call "open ended"; second because otherwise you should invent some strange rule to take shape in account. By the way, that shp 4 instruction, if I'm not wrong, just breaks the structure of dna. What is it? Not an executable istruction, it is outside genes, and the correct syntax for this kind of information would be

'#shp: 4

as for color, mutations, generation, etc, in the beginning of the dna. There's a useful routine for dealing with those robots parameter at the beginning of the dna files. So use it!

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
How to use my new features.
« Reply #4 on: May 31, 2005, 04:59:36 AM »
shape works like def.  That is, it's a command to the parser instead of the DNA execution.

I'd recommend adding shp 1, which is a circle.  You were talking about shape effecting how many ties you can have (1 tie per side, right?).  Are you still thinking along those lines?

A pentagon, when drawn, looks alot like a misshapen circle.  I think triangle, square, and circle should be enough.  Maybe a 2 sided gum drop shape, although that's harder to represent visually.

Offline Carlo

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
How to use my new features.
« Reply #5 on: May 31, 2005, 06:58:47 AM »
Quote
shape works like def.  That is, it's a command to the parser instead of the DNA execution.

There are three types of code in the dna files:

1) robot's parameters: these are parameters which can be added to a dna and are automatically saved by the dna save function. Parameters are useful because they carry additional robot's features which cannot be expressed by the dna.

2) parser commands: these commands affect the dna parser. There's only one parser command (def) and it only defines an alias for numbers. Alias label are simply converted to number when dna is tokenized.

3) the executable dna. This is what the parser executes, that is, genes.

Now, the shape type has definitely NOTHING to do with how the dna is parsed or executed. It is instead an additional feature of the robot. So it has to be expressed with the code for that type of feature. There are dedicated routines to parse that kind of code in the dna, as well as routines to add it to the dna when it is saved again from the simulation. So, please, use them, or the program will soon become a total mess.

Quote
You were talking about shape effecting how many ties you can have (1 tie per side, right?).  Are you still thinking along those lines?

I hope you're not. In my opinion, there should be a one way arrow going from the simulation to the visual representation, like this:

what happens inside the simulation ----------> what you can see on the screen

(this kind of model is so elegant and so used that modern object oriented programming languages have special constructs to implement it).

I understand that, if you decide that a square robot can have only four ties, then the fact of the robot being square it's just a visualization of the fact it can only have four ties. But let's face it: if you were really interested in this, you'd have added the 1-2-3-4 ties selector in the robot options window, and only after you'd have imagined a way to represent this visually. But here we have the opposite: first you decide that having a triangle robot is funny, and after you say "oh, well, but this should mean something after all". This makes me very very doubtful about the real need of this new feature.

Offline Carlo

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
How to use my new features.
« Reply #6 on: May 31, 2005, 08:17:46 AM »
Quote
You were talking about shape effecting how many ties you can have (1 tie per side, right?).  Are you still thinking along those lines?

Ah, and I forgot to add this: that if you really want to bind shape to number of allowed ties, then the parameter in the dna code (and in the option window) should be named something like "maxtienum", not "shape", as shape would be just a consequence of the max tie number.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
How to use my new features.
« Reply #7 on: May 31, 2005, 11:16:52 AM »
The maximum tie number thing was just something that Num and I spoke about a while ago.
I never really had any intention of limiting the number of ties with respect to the shape of the robot.
I must admit that I have been considering ways in which the shape of an individual robot could be used to help define the shape of a multi-bot but I don't really have any concrete ideas about that just yet.

As fot the shp command, it operates exactly like def in that it sits outside of the main DNA and never passes to the genome array at all. The robot's shape is defined at the point at which the DNA text file is tokenized.
I specifically didn't want any kind of control for the shape from within the genes and controlling it from the options panel would take away control from the bot designer. Tagging it onto the front of the text file is the perfect solution and has zero effect on the way that DNA is parsed.
There are many other things that can be set this way in the future. Things such as enzyme bit strings and energy management types.

It is possible to define the shape as any number from 2 to 10 from within the DNA file but if you don't bother to put anything in then it will be randomized to 3, 4 or 5. I found that more than 10 slows the sim down way too much.

The shapes also mutate just like color does although changes are very infrequent.
The shape function is really just there for a bit of eye candy rather than being a functional part of the program. That is why it can be switched on and off. Basically the shapes are very much like the skins except that control is given to the DNA programmer directly.
Also putting some some thought into more interesting shapes but haven't really reached any usable idea yet.
« Last Edit: May 31, 2005, 11:22:12 AM by PurpleYouko »
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Carlo

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
How to use my new features.
« Reply #8 on: May 31, 2005, 11:33:10 AM »
Quote
The shapes also mutate just like color does although changes are very infrequent.
The shape function is really just there for a bit of eye candy rather than being a functional part of the program. That is why it can be switched on and off. Basically the shapes are very much like the skins except that control is given to the DNA programmer directly.

That's ok for me. But I insist that you have to put the shape type among the other parameters (one of them defines, for instance, the robot's color) and not as a parser command. You can take advantage of routines to load and save those parameters, so most of the work should be already done. You can put there also (if you want) a parameter for defining the skin. Finally, you may want to add a shape control on the robot options windows, so to set the shape also from the program's interface.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
How to use my new features.
« Reply #9 on: May 31, 2005, 11:36:06 AM »
The problem with the commands you're talking about is that they're in Hash form, which is unreadable to humans. (I think I got that right, it's been a while).

So I would have the shp command for making bots, and then use the hash for saving the shape.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
How to use my new features.
« Reply #10 on: May 31, 2005, 11:36:58 AM »
Quote
put the shape type among the other parameters (one of them defines, for instance, the robot's color

So how can this be done from the DNA text file in any way other than the way I have done it?

The feature must be able to be written into the DNA text file or it will be utterly pointless.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Carlo

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
How to use my new features.
« Reply #11 on: May 31, 2005, 12:50:52 PM »
Quote
The problem with the commands you're talking about is that they're in Hash form, which is unreadable to humans. (I think I got that right, it's been a while).

No, you haven't.   :P
The parameters are written in a readable and editable form; but there's an hash of them plus dna at the end of the dna that's used by the program to understand if the dna or parameters have been generated by the program itself or have been manipulated by someone. The reason is that parameters carry information about the robot's generation and mutations number; but if there were no hash function, someone could write a f1 bot and then write in it "generation 10000, mutations 5000". Or take an evolved bot, modify it for being more efficient, and then reload it in the simulation. You understand that's not really fair.
Actually, the program lets you load dnas without hash or with wrong hash, but if the hash is wrong it simply ignores the "important" parameters, that is, robot's "real" name, generation and mutation number.
For example, if you saved a dna of an evolved robot called "myrobot.txt", and the filename is "myrobot-10MillionCycles.txt", your dna file will look like that

'#name: myrobot.txt
'#generation: 12334
'#mutations: 4354
'#color: &Hffaa33

and at the end, you'll have

'#hash: (strange hash code here)

Now, if you reload the dna in the sim, it will be reloaded as myrobot.txt, not as "myrobot-10MillionCycles.txt"; moreover, its generation and mutation number values  and color will be restored to that saved in the dna file. But if you modify in any part the file, the program will notice it, and only the color (which is not "important") will be restored.

I made this system because when you use internet sharing you never know what is coming from the net; and also because it's no good to lose information about generation, mutations and original name each time you save a dna