Page 1 of 2 12 LastLast
Results 1 to 20 of 24
Like Tree1Likes

Thread: Is this possible?

  1. #1
    Mcdonalds is offline Member
    Join Date
    Jul 2011
    Posts
    8
    Rep Power
    0

    Default 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.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    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
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    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?
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  4. #4
    Mcdonalds is offline Member
    Join Date
    Jul 2011
    Posts
    8
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    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 View Post
    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...

  5. #5
    Iron Lion is offline Senior Member
    Join Date
    Nov 2010
    Posts
    210
    Rep Power
    4

    Default

    Sounds like an interesting and open-ended project. Might have to give it a go myself.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Iron Lion View Post
    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 ;-)
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    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.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  8. #8
    Iron Lion is offline Senior Member
    Join Date
    Nov 2010
    Posts
    210
    Rep Power
    4

    Default

    Also, since its lifetime is tracked by a counter, it could only become fertile after a certain number of ticks.

  9. #9
    Mcdonalds is offline Member
    Join Date
    Jul 2011
    Posts
    8
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    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 View Post
    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

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Mcdonalds View Post
    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
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    Mcdonalds is offline Member
    Join Date
    Jul 2011
    Posts
    8
    Rep Power
    0

    Default

    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?

  12. #12
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    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.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  13. #13
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    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
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  14. #14
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    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.

  15. #15
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    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
    cenosillicaphobia: the fear for an empty beer glass

  16. #16
    Mcdonalds is offline Member
    Join Date
    Jul 2011
    Posts
    8
    Rep Power
    0

    Default

    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...

  17. #17
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Setting a population limit would be a lot easier.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  18. #18
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Mcdonalds View Post
    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
    cenosillicaphobia: the fear for an empty beer glass

  19. #19
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    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.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  20. #20
    Mcdonalds is offline Member
    Join Date
    Jul 2011
    Posts
    8
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    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.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •