Darwinbots Forum

Code center => Suggestions => Topic started by: PurpleYouko on August 23, 2005, 09:21:55 AM

Title: Optics
Post by: PurpleYouko on August 23, 2005, 09:21:55 AM
I know Carlo will hate this but I think color recognition would be a real cool thing to add.
Team it up with a command for changing your own color and it is even more useful.
Title: Optics
Post by: Zelos on August 23, 2005, 01:43:12 PM
it seem to have quite some good feed back. But as I explained before you could change ur Color (http://s9.invisionfree.com/DarwinBots_Forum/index.php?showtopic=675&st=0) while you live (with cost of energy depending on how graet the change is) but also that if we have deepth where no light reaches they would be color less, its no use so why waste energy on it then? but then they could glow and other bots could see it. nums a question, could you make it so it follow the square rule like in real life? and do you ppl want it to be square like in pur 3d universe or linear like in 2d that db is?
Title: Optics
Post by: PurpleYouko on August 23, 2005, 04:42:19 PM
Depth would be a great feature to use in pond mode where we already have a light gradient that controls the feeding rate of veggies.

I like the darkness and glowing bots idea in this scenario. It could be combined with color/light vision such that none of the refvars would work in complete darkness and only bioluminescence can be seen.

We can make Angler bots with glowing lures  :D
Title: Optics
Post by: Botsareus on August 23, 2005, 05:40:52 PM
If you wana talk realistic we should have real dna , real protines , real molecules , and 3D. Good Bye Computer speed, have FUN!

 :evil: Bau
Title: Optics
Post by: Numsgil on August 23, 2005, 06:53:06 PM
The depth gradient for eye range isn't terribly difficult.  The harder part is the biolumiescence, because it would tend to be fairly computationally expensive depending on how you do it.

Let me think about it for a bit.
Title: Optics
Post by: Zelos on August 24, 2005, 12:57:12 AM
bot you maniac. sure it would be fun to have those but that is not possible today. maybe in a distant future its possible but now not so dont be so damn ironic.

how do you mean nums?
Title: Optics
Post by: PurpleYouko on August 24, 2005, 03:22:01 PM
Quote
The depth gradient for eye range isn't terribly difficult. The harder part is the biolumiescence, because it would tend to be fairly computationally expensive depending on how you do it.
I don't think so.
Just adjust their color towards black as they get deeper by multiplying the base RGB by a depth factor so that beyond a certain level they become all black.
Bioluminescence will just multiply the RGB by another factor, determined by the chosen bioluminescence factor of the robot.
Simple.

Also lets a robot choose to glow red, white, blue, yellow or any pale color.
Title: Optics
Post by: Numsgil on August 24, 2005, 05:09:32 PM
If we assume that all bots cannot be seen further than the 12 bot lengths or whatever that's standard now, then the problem becomes considerably easier.

So the idea is that a bot has a minimal (and maybe maximal) level to detect R,G, and B values?  How do we handle bots that are actually all black?  Are we assuming they're invisible?  Do we calculate a color at a certain depth and have the difference of the bots color to that?

Just thoughts.  I'll admit it would be neat to have a bunch of white dots floating around because the bots are all perfectly blended into their environment.

We'll need a formula that factors in relative motion, color of the bot, background color (which is effected by depth I'd assume), and how sensitive the looking bot's eyes are.  Unless I've missed something.
Title: Optics
Post by: PurpleYouko on August 24, 2005, 05:31:44 PM
Missed something?

I think you may be overcomplicating it.

Here is a simple suggestion. Instead of a bot always seeing what is in its eyes, make it only do so on a percentage basis. On some cycles it will see and on some it won't.
In normal light this will be 100% but as the amount of light reflected or created by the target bot decreases, it is not always seen. At zero light (blends into the background perfectly) it cannot be seen at all.

This system will also allow chameleon bots to blend with the background color at a cost.
A further mod would be to allow bots to boost their vision, allowing them to see better in bad light but worse in full light where their eyes will become saturated.

Opens up quite a few cans of worms really.
Title: Optics
Post by: Numsgil on August 24, 2005, 05:55:58 PM
I'm not much for non-deterministic vision.  I'd vote to decrease range that a bot can be seen as the light level decreases.  Are we having bots have color vision or not?  If bots' vision is black and white it makes some things a bit easier.
Title: Optics
Post by: PurpleYouko on August 24, 2005, 06:17:28 PM
I kind of like color vision actually.
I see your point about the non deterministic vision though.
Maybe sight range should be proportional to the luminosity of the target minus the background light.  (light difference or more accurately color difference)
Use an upper and lower fixed cap to determine if a bot is seen or not.
Allow bots to adjust their own sensitivity to light. ie. shift the working visibility window up or down.
Title: Optics
Post by: Numsgil on August 24, 2005, 06:24:15 PM
That's more or less what I was thinking.  Just need an actual formula to start working from.
Title: Optics
Post by: PurpleYouko on August 24, 2005, 07:02:07 PM
Well all the colors return an RGB value and the bots already have a color property stored in a long variable. Shouldn't be too hard. Add the RGB components Higher numbers make brighter colors.
If memory locations can be changed to long as well then bots can also have a direct color sense too.
Title: Optics
Post by: Numsgil on August 24, 2005, 07:06:57 PM
Changing bot memory to long means alot of incredibly large and pointless numbers.  Which is something I'd rather not even mess with.

Storing R,G and B values seperately might be a better idea.  And then also store a value representing total emitted + reflected light.  Such a value would probably not be larger than 1800 (and that would be a white bot glowing as hard as it can).
Title: Optics
Post by: Endy on August 24, 2005, 11:13:19 PM
Ohh...Pretty Colors.

Seriously I like the idea since it will give me some nice markers to see what is happening. Sort of like using radiation to track cells.
Title: Optics
Post by: Zelos on August 25, 2005, 12:59:53 AM
why use RGB? why not use the the frequens? red is 420 THz blue 750 THz and green is about 580 THz. So we could have one value that tells what color it sees. The frequens of the light (It gives the opritinity to see IR and UV) But we could also have a light intesity.  Like how many watt per cm² (but our own values). Then we could also have a minimum light intesity. If the intesity is less the bot cant see what ever that reflect or is lumonating.
What kind of formula are you after num?
Title: Optics
Post by: Ulciscor on August 25, 2005, 01:03:49 AM
Oh my.... I find this pointlessly overcomplicated. But then I never liked physics anyway. Why introduce more complex real life physics when the bots can't even utilise the current physics properly?
Title: Optics
Post by: Zelos on August 25, 2005, 07:43:48 AM
cause its fun, more accure. more options. and is already something life have adepted to and there for wouldnt have problem to adept to it again. if you dont like physic you dont like reality
Title: Optics
Post by: Numsgil on August 25, 2005, 09:03:31 AM
I'd use RGB for the simple fact that that's how VB is doing it already.  All the bots already have an RGB value, so it's real easy to take that and do fun things with it.
Title: Optics
Post by: Zelos on August 25, 2005, 09:49:55 AM
just to clear things out, with RGB you mean red green and blue right? where in db is that? ive never seen we use it.
if we use that the problem is that we lose specefic colors. I think it would be fun to see bots evolve colors others cant see but they can and maybe even use it as comunication.
Title: Optics
Post by: Numsgil on August 25, 2005, 10:17:27 AM
It's in the code.  That's how all colors are handled in Visual Basic, which, of course, Darwinbots is written in.

We don't get ultraviolet, but then, do we really need it?  The point is that there's a window that bots have to their vision.  It doesn't matter if it has parallels in real life or not.
Title: Optics
Post by: Zelos on August 26, 2005, 12:30:29 AM
if VB use it it will obvius be easy to use RGB then but some of the fun is gone then
Title: Optics
Post by: Ulciscor on August 26, 2005, 12:58:45 AM
Quote
if you dont like physic you dont like reality
I don't understand why we have to make the bots more like life on Earth. We know how they evolved and turned out. I would have thought it would be more interesting to see how bots would evolve in conditions unfamiliar to us. That's my opinion anyway.

Just because we see a certain way doesn't mean every other organism in the universe does. For all we know there are some that can look into DNA. If it works then why change it?
Title: Optics
Post by: Zelos on August 26, 2005, 03:31:31 AM
youre right that it might not evolve like on earth but most planest have the same options we did in the past so why shouldnt we give our life those options?
Title: Optics
Post by: Endy on August 26, 2005, 04:20:08 AM
Like the idea of luminosity it would be handy to use it for eco sims and be able to seperate bots by having them not see each other.

Could we do something with the negative values of RGB? Possibly represent other color spectrums with them(3?). Not ever necessary normally,(considering our own eyes are limited :) ) but DB doesn't have to follow our rules.
Title: Optics
Post by: Zelos on August 26, 2005, 04:55:58 AM
maybe, but I rather have frequenses. it gives the option of some bots see a certain color while others dont
Title: Optics
Post by: Numsgil on August 26, 2005, 09:02:48 AM
Negative RGB values might work.  Depends alot on the formula we decide to use.
Title: Optics
Post by: Zelos on August 26, 2005, 09:12:35 AM
im pretty good at formulas, so what shall the formula tell? and what values do we have to our help? RGB of course but what more?
Title: Optics
Post by: Zelos on August 26, 2005, 09:45:17 AM
if its that at a certain distance the color vanish and becoems invisible we should use the square law. wich means that the light is 1/4 as intens when the distance is double. so with something that tells how sensetiv the bot is for light. We could use the watt/dm². its easy and gives low numbers for big values. the normal intensity on earth would be 11W/dm² (from the sun). If we use this we can make the formula simple with out RGB. Unless RGB stands for the intesity of RGB.
the formula without RGB would be
Code: [Select]
I/r²-B
where I is the emited intesity and r is the distance and B is the bots intesity its able to see. So when its minus or 0 it dont see it. But with RGB it would simply replace I with (R+G+B) but what about if we have so that water absorb light of different color different? then we can use some formulas. then we have to decied how it absorb. does it absord light as total no matter how far it goes or does it abosrb like X%/m. with the constant one we simply put the a K (konstant) infront of each RGB, so it would look like
Code: [Select]
(K(R)*R+K(G)*G+K(B)*B)K(X) is the constant of the color in it.with a %/m it will look different. it would look
like
Code: [Select]
(K(R)^r*R+K(G)^r*G+K(B)^r*B)with this light decrease very fast. what do you think guys? is this the way you wanted nums?
Title: Optics
Post by: Numsgil on August 26, 2005, 04:30:14 PM
I'm not 100% sure it should be inverse square, since it's not that the light intensity becomes too faint, but that the light is absorbed by the medium.  That might be a linear relationship.

I dunno, I'd have to check how the Gradient is handled.
Title: Optics
Post by: Zelos on August 27, 2005, 12:42:41 AM
the light intesity is the inverse square. if we double the distance it becomes 4 times weaker
Title: Optics
Post by: Numsgil on August 27, 2005, 10:28:46 AM
Light intensity for a radiating body in a non absorptive medium.  Things like stars in space.  Doesn't quite work the same if the medium is absorbing light as you go along.  At least I don't beleive so.  Feel free to find something to the contrary.

Here's my proof:

Quote
Theory:
Light intensity decreases as the square of the distance from a light source. For example, if you measure 200 lm/ft2 at a distance of two feet from a light bulb, then at a distance of four feet, you will detect 50 lm/ft2. This fact assumes that the light is travelling through a vacuum. This is a reasonable approximation for air, but it is not a fair approximation for water. First of all, when light makes the transition from air to water, a fair portion of that light will be reflected. This explains why you can often see your reflection in a calm pool of water. This reflection of light occurs because water has a higher index of refraction than air. The light that is ultimately transmitted (allowed to penetrate the water) then has to deal with more absorption and scattering from various particles in the water. This combination of absorption and scattering is called attenuation. All these factors explain why it is significantly darker underwater than above water.

Like light intensity, temperature tends to decrease as depth increases. There are two reasons for this. For one thing, less light is received the further down below the surface you go. When light is absorbed by a substance, it is converted into heat, so more light means more heat. As you go down further and further beneath the surface, you'll find less and less light and therefore temperatures are cooler. It is also a fact that cold water is denser than warm water, so it will sink down to the bottom while warm water rises to the surface.

This is what I found (yes, read it.  Seriously.  READ...IT)

Source Some crazy experiment for kids (or maybe students) (http://www.iscienceproject.com/labs/finished_labs/6357_litempvarydepth.html).
Title: Optics
Post by: Zelos on August 27, 2005, 10:49:22 AM
interesting, I like it exept that its using foot. god damn it why cant ppl use SI units, the right and only good units.
Title: Optics
Post by: Endy on August 27, 2005, 06:58:44 PM
Alright, I'll chip in my two cents. :)  I was just wondering if we could create true day/night cycles, affecting sight radius with this. Shouldn't be too hard since some of the code is already there for the plants.

Something like *.night could be used to tell the "time".
Title: Optics
Post by: Numsgil on August 27, 2005, 07:58:32 PM
You mean a gradual change instead of BAM night and BAM day?

I was thinking of tying this sight radius thing in pretty tightly with the veggie controls.  Unless people think they want seperate controls for each.

That would also encourage bots to sleep at night.  Before the problem was bots that hunted irregardless of what time it was, decimating a veggy population in the middle of the night.
Title: Optics
Post by: Zelos on August 28, 2005, 01:41:11 AM
this with the night could partly be solved with the astronomy things I suggested a while ago
Title: Optics
Post by: Endy on August 28, 2005, 04:05:48 AM
Oops, didn't realize there was already a daytime memloc. :redface:

I was just thinking it'd be nice for the bots to be actually restricted sight wise during night, like they'd be restricted at deeper/darker depths. Prehaps also add something that allows bots to see farther at night/deeper depths, but be restricted during the day/closer to surface and vice versa. Should probably have some sort of cost associated with it, to keep bots from abusing it.

I think that be a good idea using veggie controls for it. It'd seem kind of silly restricting the bots from seeing but have the same amount of nrg available from the plants.

To Zelos- While it's nice to imagine a future species of bots looking sideways into the stars, and wondering what sort of deranged creator is out there; I don't think it's very practical. :)
Title: Optics
Post by: Zelos on August 28, 2005, 04:28:12 AM
to endy
go and read about it before you comment it einstein
im not talking about having stars. im talking about that light intensity change along as the day and year pass on.
Title: Optics
Post by: Numsgil on August 28, 2005, 09:09:22 PM
Zelos's idea was actually quite intricate, involving light intensity changing based on if the playing field was part or a whole of a planet.  It just needs the E grid for it to ever be practical.
Title: Optics
Post by: Zelos on August 30, 2005, 10:46:10 AM
it sure need it, btw hows it going with it? the egrid I mean
Title: Optics
Post by: Numsgil on August 30, 2005, 01:35:21 PM
When school gets a good rhythm I can start programming again.  I also need to finish the new mutations code.

I posted the source with the hope that it might inspire some forum goers to give a whack at adding or fixing something.  If I can get someone to handle the smaller coding issues, PY and I can concentrate on the more massive code changes.
Title: Optics
Post by: Botsareus on August 30, 2005, 03:49:11 PM
Problem is:

A. I have collage myself.

B. My new firstbot "seems" to evolve yet again , time will tell.

-Forumgoersareus

 :D  , sry (If firstbot evolves consider that my excuse)
Title: Optics
Post by: Zelos on August 31, 2005, 11:21:35 AM
boit, what does that have to do with this?
Title: Optics
Post by: Ulciscor on August 31, 2005, 12:16:59 PM
[Bots] was just saying that he didn't have time to help with coding right now because he had other priorities.
Title: Optics
Post by: Numsgil on August 31, 2005, 01:37:33 PM
I know Bots, don't sweat it.

Maybe we should set up a donation page on the home site, and distribute funds from it to programmers based on effort :D

No?  Well, I can dream...
Title: Optics
Post by: Numsgil on September 19, 2005, 04:15:35 PM
I'm going to start on this idea.  I'll keep it real simple, ignoring bioluminescence, and just have light levels decrease as you get deeper in pond mode, and increase as your surface area does (bigger thigns are easier to see).

I think this might be the impetous to see speciation develop naturally in pond mode.
Title: Optics
Post by: PurpleYouko on September 19, 2005, 04:18:02 PM
That was the kind of thing I always had in mind for pond mode anyway.

Go for it.
Title: Optics
Post by: Zelos on September 25, 2005, 08:15:58 AM
thats a good start, maybe later we can take the other stuff
Title: Optics
Post by: Numsgil on September 25, 2005, 03:22:40 PM
I'll probably start on it in earnest after 2.4 is up.
Title: Optics
Post by: Zelos on October 07, 2005, 10:58:00 AM
so very very sweet, but nums, could we have Biol (bioluminescence) later?
Title: Optics
Post by: PurpleYouko on October 07, 2005, 11:17:21 AM
I would think that bioluminescence would be a feature of allowing bots to (temporarily) change their own color. Should be straight forward enough.
Title: Optics
Post by: Zelos on October 07, 2005, 11:19:10 AM
thats basacly what ive been saying, they change color temporary and can keep bioling fo aslongest they want, of course with a energy cost.
Title: Optics
Post by: PurpleYouko on October 07, 2005, 01:46:22 PM
And on the opposite side of the coin they would be able to hide against the background color of the screen (also at a cost)
The actual cost should be proportional to the amount of R, G and B that they want to change by and should be charged per cycle with the default (no changing) to revert to normal color for the species.

I also would like to see the visibility of a robot being proportional to the difference between its color and that of the background screen.

In addition to this we should have controls that can change the background color (with day/night cycles, polution levels from the e-grid etc.) so that programmers don't design their bots to be "invisible" from the getgo.

Or possibly only allow sight differences in certain types if sim like pondmode or for mutations to find the best color.
Title: Optics
Post by: Zelos on October 07, 2005, 01:50:50 PM
persinaly im not very happy with RGB idea, I rather have frequens or wavelenght. like the bots have a standard color and then can biol different and then we give a mathematical propotion of the cost
Title: Optics
Post by: Numsgil on October 07, 2005, 02:12:02 PM
RGB vs. wavelength/frequency is immaterial.  All visible colors can be made from RGB just as easily as with wavelength or frequency.

RGB has the benefit that that's how computers display color anyway.
Title: Optics
Post by: PurpleYouko on October 07, 2005, 02:57:34 PM
All robots already have RGB values stored in their data files already. It is the only way that VB can display them.

If we were to use wavelengths then..

first. we would have to convert them to RGB in order to display them.

Second. some colors like Brown and Pink would not be possible without mixing several wavelengths and displaying them simultaineously.

RGB is way simpler to use and implement.

There could also be an intensity value which is effecively R, G and B added together so that 765 (255+255+255) would be maximum intensity (pure white) and zero would be minimum. Almost all intensities would have several RGB combinations that could make them.
Title: Optics
Post by: Greven on October 07, 2005, 03:09:50 PM
Actually PY there is 256 * 256 * 256, which is := 16.777.216 colors... Some very alike, but still another nuance (or whatever it is called in english, same color only slightly different and to the human eye really no difference)
Title: Optics
Post by: Numsgil on October 07, 2005, 03:37:27 PM
PY was talking about Black to White light intensity.

Like if you have a Black and White monitor displaying RGB, what intensities will each color be.
Title: Optics
Post by: PurpleYouko on October 07, 2005, 03:47:01 PM
Quote
Actually PY there is 256 * 256 * 256, which is := 16.777.216 colors

I know that but there are only 766 intensities, one of which is 0 therefore 765 is the highest possible intensity, bright white, while zero is the lowest possible intensity, black.
Title: Optics
Post by: Greven on October 07, 2005, 06:03:13 PM
Oh sorry, I didnt read the whole post, just scan it and saw 3* 255 which didnt fit into my world...

I am truely sorry!
Title: Optics
Post by: Zelos on October 08, 2005, 01:57:45 AM
but what about if bots want to display colors other bots are not supposed to be able to see?
Title: Optics
Post by: Numsgil on October 08, 2005, 11:36:32 AM
We would just need to implement a "color window" for bots.  Basically ranges of colors the bot can see.

Oh, and to handle the intensity problem:

imagine each bot has a "base" color.  This can be represented by a 3 part vector (RGB).    To determine the new color of the reflected light and its intensity such and such far away, you'd do:

Divide RGB by 255.  This is now the percentage of each color that the bot reflects.

Determine the light level where the bot is.  That light intensity * RGB = color and intensity of reflected light  (You could also multiply light intenisty by another %age color vector, for colored light in the sim).

Say a bot can see this new bot.  Well, the colors it sees is our previous vector scaled back for the distance the light has had to travel from the reflecting bot to the seeing bot.

If all elements of our new RGB vector are visible to the seeing bot's window, then it can see that bot.

The only thing missing from that equation is consideration for the size of the reflecting bot.  Small things seen far away are invisible basically (RGB = <0,0,0>)