Author Topic: Cellular Automata  (Read 6149 times)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Cellular Automata
« on: 2008-10-20, 07:00:15 AM »
It occurred to me early this morning that one interesting feature in a game might involve tiles automatically generating and affecting each other as seen in Conway's Game of Life.  (The idea was also related to the way barrels explode in TechnoVenture for anyone possibly familiar with that game -- one barrel exploding will cause all its neighbors to explode if they are also barrels.) So this morning I decided to implement a zero-player game in SGDK2 -- I actually went ahead and created this game of life, which turned out to be quite simple (had it done in about an hour and only used two plan rules and maybe 50 lines of code).  I'm not sure exactly where to go next with this idea, but as I think about it more, I think SGDK2 is a great environment for developing and testing these so called Cellular Automata.  I'm very interested in the idea of creating complicated and interesting systems that develop "magically" from very simple elements.  For example, in this Game of Life, even though the rules are described in 4 statements, you can get some very interesting and complex behavior out of it by devising interesting configurations like the puffer train.  It's almost like drawing the map is creating rules -- kind of the way that specific atom arrangements can lead to complex chemical reactions that actually carry out tasks in a sense.

I think some very cool games could be created from these ideas, but I don't know if I have the brain power to come up with them.  :educated:  Presumably there are some that could be accomplished using only the built-in sprites and rules support without writing any code.  Just because the idea of cellular automata started with a grid of cells and rules doesn't mean we couldn't find something interesting by using sprites and rules instead (which are easier to use in SGDK2).  Sprites can follow relatively complex rules quite easily in SGDK2.  If 4 statements can devise a system as interesting as this Game of Life, imagine what interesting systems are possible from a variety of relatively simple sprites, all acting on relatively simple rules, but also being able to interact with each other (and tiles).  I hope someone else takes an interest in this too and we can demonstrate some interesting ideas with SGDK2.  :alien:

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Cellular Automata
« Reply #1 on: 2008-10-20, 07:21:39 AM »
http://gamedev.enigmadream.com/index.php?topic=1219.0

The Game of Life was what this question was about actually.  In fact, since you told me to keep it around, here's my version.
« Last Edit: 2008-10-20, 07:32:16 AM by durnurd »
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Cellular Automata
« Reply #2 on: 2008-10-20, 08:09:49 PM »
Ooh... you didn't happen to try it with SGDK 2.1 yet did you?  I'll have to give it a try when I get a chance.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Cellular Automata
« Reply #3 on: 2008-10-21, 03:21:33 AM »
This is a very good sign: In the old SGDK 2.0, I loaded your project and noticed that it ran at 75 FPS, so I reduced the cell size from 16x16 to 8x8 and made the map 80x60 instead of 40x30.  Then it was running at 33 FPS.  Then I loaded that project into SGDK 2.1 and it ran at 75 FPS.  Woohoo! 8)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Cellular Automata
« Reply #4 on: 2008-10-24, 05:37:38 AM »
Here's the compiled program I created with SGDK 2.1.  You can use the mouse to draw patterns and press F5 to see how they play out.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Cellular Automata
« Reply #5 on: 2008-10-24, 07:59:24 AM »
Just for future reference, for those trying to run on Linux:

I have to have 9 supporting files to run a program with OpenTK and FModEx.  Even then I can't run the program because it can't find winmm.dll to detail the number of joysticks.  But if I had the code and removed that part, the nine files would be sufficient to play the game, and those are:

*.config (where * is the filename, in this case, CellGame.exe); contents:
Code: ("CellGame.exe") [Select]
<configuration>
  <dllmap os="linux" dll="fmodex.dll" target="./libfmodex.so"/>
</configuration>

libfmodex.so (which is a symbolic link to your actual version.  Mine is:)

libfmodex64.so.4.16.04 (which is for x86 64-bit Linux systems)

OpenTK.dll

OpenTK.dll.config; contents:
Code: ("OpenTK.dll.config") [Select]
<configuration>
  <dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
  <dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
  <dllmap os="linux" dll="openal32.dll" target="libopenal.so.0"/>
  <dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
</configuration>

OpenTK.Utilities.dll

OpenTK.Utilities.dll.config; contents:
Code: ("OpenTK.Utilities.dll.config") [Select]
<configuration>
</configuration>

OpenTK.Utilities.xml

OpenTK.xml

Now, I'm not sure which of these files are not strictly required, but its a setup that after fiddling with, I've found to work.  The XML files, for example, basically just give descriptions of the function calls, which are probably not necessary to the running the program.  The empty config could also probably go, and I'm not sure if I really need the symbolic link, since I could point the config file to the real version just as easily, except then it's harder to move to other systems.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Cellular Automata
« Reply #6 on: 2008-10-25, 07:39:37 AM »
Actually I no longer use OpenTK.Utilities.dll.  It was only for Fonts, which I do manually now.
Here's the SGDK2 file if you want to fiddle with it further.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Cellular Automata
« Reply #7 on: 2008-10-25, 11:03:08 AM »
After generating the code on a Windows machine, I copied the code to my machine.  I was able to get the program to run after changing only one line of code:

Code: [Select]
      int controllerCount = 0;//Joystick.GetDeviceCount();

And I added only one extra file (OpenTK.dll.config).

The program was not kind enough to work very well, though.  It doesn't read mouse clicks, and it doesn't read F5 either.  Also, apparently both CTRL keys are registered as L-CTRL, so that didn't work either (but I pressed Shift and that worked to remove the message).

Also, I had to recreate the project file, since apparently it didn't like the .csproj file SGDK2 generated.  This wasn't too hard though.  Just had to get all the references and resources in the right places in the tree.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Cellular Automata
« Reply #8 on: 2008-10-26, 08:19:57 AM »
On a related note, you said Mono 2.0 was out but didn't work on Ubuntu, right?  Do you know if Ubuntu 8.10 released a day or two ago will work with it?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Cellular Automata
« Reply #9 on: 2008-10-26, 09:28:54 AM »
Ubuntu 8.10 will be officially released in 4 days, and will not come with 2.0.  1.9.1 is still the latest stable release of Mono for Ubuntu, so it'll still be a bit before .net 2.0 is "supported" on Ubuntu.
Edward Dassmesser