Jump to content

Babylon.js Monthly Challenge! :-)


RaananW
 Share

Recommended Posts

So, I just got back from a long vacation, on my way to the next one, and I have some time to spend in between!
I always thought it would be nice to see how many different implementations can be written for a single task (unlimited, really), and what's a better way than to give the people at the forum a monthly to come up with a solution for a silly task! Yei!!!

So, I suggest a monthly challenge. And I want to offer the first:

3D Game Of Life
which one of you haven't implemented game of life? they are always (well, not always, but usually) 2D. let's see how you create a 3D version of it!

The rules are simple (copied shamelessly from this page - http://gameoflife.samuellevy.com/, written in this other framework that none of you should even know. something with three. and js.)

  • Cells (in this case, cubes) with only 1 or less neighbors die, as if by loneliness.
  • If 5 cells surround an empty cell, they breed and fill it.
  • If a cell has 8 or more neighbors, it dies from overcrowding.

I promise to participate as well!
Submit your solutions (preferably as a playground link) to me (using PM), and I will post all of them on October 1st as a poll. Try to be original, that's the entire idea.
The winner will be decided here in the forum, and will win respect and honor. And a bottle of beer if you are ever in Berlin.

So! Who wants to participate?

Link to comment
Share on other sites

Hmm. I implemented a naive 3D game of life for a talk I gave a few months ago. It wouldn't be in the spirit of your contest to enter it here, but if anyone wants to borrow the Life implementation you're certainly welcome to.

 

Demo: http://andyhall.github.io/noa-lt/

(WASD to move, "3" to place game-of-life blocks, and "4" to start/stop the Life game iterations. "I" to invert mouse.)

 

Life implementation: https://github.com/andyhall/noa-lt/blob/master/lib/conway.js

Note that this implements "4555" life, but it's trivial to change to a different ruleset. (3D life rules are referred to as ABCD, where dead cells must have A~B neighbors to get born, and living cells must have C~D neighbors to stay alive. 4555 is one of the relatively few rulesets that have "interesting" behavior, like blinkers, gliders, etc.) 

Link to comment
Share on other sites

  • 2 weeks later...

This is a really cool idea!

 

fenomas - That looks like a pretty solid basis for a minecraft implementation, how long did it take to create?

 

I've been working on it off and on for about a year now :)

 

To be precise, I'm working on a game, and that link was a one-off demo for a talk I gave about the engine I've made. The engine part (that manages rendering the voxels) is here, it's OSS so feel free to use it or hack on it. 

Link to comment
Share on other sites

Any good starting positions for the given rule set that I can try out for testing? I think it works... but I am having performance problems (not babylon, but my code), probably due to my inefficient way of checking the neighbors :P

 

Soo... whats the goal... I mean, at some point it has to run into performance problems, right? How big do you "colonies" get?

 

For me it already feels slow when iterating over 1000 people. Getting slower and slower the more are born and hitting the script runtime limit of my chrome browser at about 6000.

 

So if you guys say you make colonies up to 100 000 I know I am doing something wrong here :P

post-12304-0-55680800-1443353030.jpg

Link to comment
Share on other sites

Any good starting positions for the given rule set that I can try out for testing?

 

This link from the previous page notes a few structures. But generally, the idea of an "interesting" ruleset in Life is that, if you fill a given space randomly and then iterate, there will be some chance of an interesting result (i.e. not collapsing to nothing).

 

When I did my demo I used 4555 because I wanted an easy glider, but generally I found that random inputs always collapsed to nothing very quickly. I haven't tried other rules much.

 

Regarding size, I'd think 20-30 cubed should be achievable, so you might want to find the hot spot in your code and optimize. But even a 10x10x10 space can show interesting behavior. Remember you can wrap around the edges if you want, so that for example gliders keep going forever.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...