# Is this possible?

Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last
• 07-09-2011, 04:17 PM
Mcdonalds
Is this possible?
Basically, I want to make a very, very simple 2d 'world'...

Just male + female dots, when they bump into eachother a third is created after 90 seconds...
Each dot stays alive for 1200 seconds, then they disapear...

Something simple like that? Making a population basically.

Then, adding smaller things and developing it. It'd just be a personal project...

I know it's an empty idea at the mo' but I'm sure I'll be able to add stuff to it.
• 07-09-2011, 04:35 PM
JosAH
Sure it's possible; the 'bumping' into eachother can be tricky, especially when more than two dots are involved (and those 'dots' have a size large than one). Does that 'bumping' need to be realistic (like balls colliding in snooker etc.)? For starters, better keep it as simple as possible.

kind regards,

Jos
• 07-09-2011, 05:18 PM
Dark
You could do a check to see if the two dots are already mated with a boolean check. Would keep it simple. Do the two dots separate when a third is made or do they stay paired until death?
• 07-09-2011, 07:27 PM
Mcdonalds
Quote:

Originally Posted by JosAH
Sure it's possible; the 'bumping' into eachother can be tricky, especially when more than two dots are involved (and those 'dots' have a size large than one). Does that 'bumping' need to be realistic (like balls colliding in snooker etc.)? For starters, better keep it as simple as possible.

kind regards,

Jos

I just mean, a small window with tiny dots moving in random directions, bumping off one another and the walls. When a female randomly bumps a male, they bounce of as normal, the woman dot turns into a pregnant woman for say, 90 seconds, and then the pregnant woman turns into a normal woman and another dot appears randomly a female or male and the circuit continues xD

Quote:

Originally Posted by Dark
You could do a check to see if the two dots are already mated with a boolean check. Would keep it simple. Do the two dots separate when a third is made or do they stay paired until death?

Keep seperated for now, I'll make it advanced later... :) And I'd like to make it so they disapear after a while...
• 07-09-2011, 08:35 PM
Iron Lion
Sounds like an interesting and open-ended project. Might have to give it a go myself.
• 07-09-2011, 08:51 PM
JosAH
Quote:

Originally Posted by Iron Lion
Sounds like an interesting and open-ended project. Might have to give it a go myself.

There are still some small problems to solve:

- what happens when a pregnant female dot bumps into (another) male dot.
- what happens when a female gives birth to a male dot; do they bump into eachother immediately and the female gets pregnant again?

kind regards,

Jos (<--- I'm out of here before it goes out of hand ;-)
• 07-09-2011, 08:56 PM
Dark
Perfect, the male dot makes his own brother! Yay! That would be a pretty interesting thing to make, relations so that if a dot is related to another dot it can't get any of those dots pregnant.
• 07-09-2011, 09:00 PM
Iron Lion
Also, since its lifetime is tracked by a counter, it could only become fertile after a certain number of ticks.
• 07-09-2011, 09:05 PM
Mcdonalds
Quote:

Originally Posted by JosAH
There are still some small problems to solve:

- what happens when a pregnant female dot bumps into (another) male dot.
- what happens when a female gives birth to a male dot; do they bump into eachother immediately and the female gets pregnant again?

kind regards,

Jos (<--- I'm out of here before it goes out of hand ;-)

Aah, thanks for this, I didn't think about the mother bumping into it's own baby...
I guess I could give all dots a certain variable (blood type), and when they have babies, they get the variables of the two parents? e.g. A male (blood type F) + a female (blood type B) makes a baby (blood type FB), and that would stop the baby going near it's own? And an FB + GC would make FBGC and then it could go on and on? Or maybe it could last only for a certain amount of generations? :)

Also, pregnant dots + males won't effect anything.

Quote:

Originally Posted by Dark
Perfect, the male dot makes his own brother! Yay! That would be a pretty interesting thing to make, relations so that if a dot is related to another dot it can't get any of those dots pregnant.

What do you think of what I said above? Relations would be a tad out of my lead xD
• 07-09-2011, 09:12 PM
JosAH
Quote:

Originally Posted by Mcdonalds
Aah, thanks for this, I didn't think about the mother bumping into it's own baby...
I guess I could give all dots a certain variable (blood type), and when they have babies, they get the variables of the two parents? e.g. A male (blood type F) + a female (blood type B) makes a baby (blood type FB), and that would stop the baby going near it's own? And an FB + GC would make FBGC and then it could go on and on? Or maybe it could last only for a certain amount of generations? :)

Too complicated imho; the mother could 'throw away' the baby so that they won't bump into eachother right after birth.

kind regards,

Jos
• 07-09-2011, 09:15 PM
Mcdonalds
I guess it is confusing considering I'm just starting...
Would it be hard to make a small gap where all new borns come from? Or a 'spawn' spot?
• 07-09-2011, 09:17 PM
Dark
I don't think relations would be that hard just time consuming. Assign your original created dots a different identifier. The new baby gets two identifiers, one from the mom and one from the dad. If the baby bumps into another dot, if either identifier is identical then nothing happens. Of course this only eliminates siblings from mating, but its a start.

A more advanced method could be adding each identifier the parent has, IE an array list. After X amount of identifiers are added to the newest baby it would drop the first two allowing it to mate with others who had the original identifiers it started with again.

IE;

a-b Mate
c-d Mate
ab-cd Mate
abcd mates with efgh
cdefgh is born.

cdefgh mates with ijklmn
fghlmn is born.

Just an idea, still not really accurate on how genes work. Since its not really a science program, virtual inconsistencies can exist.

But for a first start, take JosAH's idea. Toss the baby away from the mother, or you could make it avoid mating for x amount of seconds.
• 07-09-2011, 09:23 PM
Dark
At the idea of making a spawn spot, you could just pick an offset of the mother dot and make the baby there.

getX of motherDot
getY of motherDot
create babyDot at getX+offsetVar and getY+offsetVar
• 07-10-2011, 01:01 AM
pbrockway2
The "spawn spot" is rather non biological.

In fact the two sides of this program (population growth, billiard ball like bouncing) don't have a lot in common if you see the program as modelling some actual real world process. Having the objects bounce off each other is quite challenging in itself: especially 3-way collisions as Jos mentioned, and having the program run reasonably quickly for a decent number of objects.

For population numbers a better (more realistic) rule might be to produce children at random locations in numbers that scale linearly with the number of individuals above a certain age (the mating population). Left to itself this will result in a Fibonaccci-like explosion, so it might be a good idea to have the population size limited in some way. (eg by a "carrying capacity" modelled via the logistic equation. See Population ecology - Wikipedia, the free encyclopedia).

Things get really interesting when you have not two sexes but two species: one limits the other by preying on it but the prey effectively limits the predator by being its necessary food supply. There are examples of several formalisms of this as a Java applet at MathCS.org - Java: Population Dynamics.
• 07-10-2011, 08:50 AM
JosAH
Maybe the OP (or anybody else) finds it interesting to google for "Java cellular automata simulation". Interesting links show up, even from the Fourmi laboratory. Most of the simulations are able to run Von Neumann's self reproducing CA and of course Conway's game of life. It's interesting stuff ...

kind regards,

Jos
• 07-10-2011, 12:58 PM
Mcdonalds
This "land" could be increased every time a new dot comes, stopping them all being cramped together in the end.

Also, this is all starting to get really complex for me...
• 07-10-2011, 12:59 PM
Dark
Setting a population limit would be a lot easier.
• 07-10-2011, 01:28 PM
JosAH
Quote:

Originally Posted by Mcdonalds
Also, this is all starting to get really complex for me...

Start implementing your own basic idea but don't forget those few exceptions (pregnant females bumping into other males and pregnant females bumping into their own babies just after birth) and forget the rest of the crapola; that's for later (if ever). See if you can get it to work and enjoy the entire development process.

kind regards,

Jos
• 07-10-2011, 01:50 PM
Dark
Pick something to start with, like making the dots wander around the screen. Then make it detect when they collide. Then try making two different types of dots, with genders. Then work on the making new dots and all that it implies.

When you look at a long term project like this you have to take it apart into steps. If you just dive into it you will overwhelm yourself.
• 07-10-2011, 03:51 PM
Mcdonalds
Quote:

Originally Posted by JosAH
Start implementing your own basic idea but don't forget those few exceptions (pregnant females bumping into other males and pregnant females bumping into their own babies just after birth) and forget the rest of the crapola; that's for later (if ever). See if you can get it to work and enjoy the entire development process.

kind regards,

Jos

That's excellent. As I'm a begginer this project would help me motivate myself into learning new abilities (java-usage). Thanks.
Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last