Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Designing a 2d autonomous system

  1. Apr 17, 2012 #1
    I want to create a programming project that involves creation of a discrete autonomous system. It is very similar to cellular automaton as the simulation environment is composed of 2D cells on an unbounded grid. Cells have attributes assigned to them which makes them behave and function together as a self-sustaining system. For example, cells are programmed with basic functions such as moving and dividing and specialized tasks that they must perform such as energy retrieval, synthesis and storage, defense and information storage.

    To design the system and its rules, I'll need a programming language and a graphics rendering program. Should I use a general purpose programming language such as C++ coupled with OpenGL to render graphics or should I use a program designed for mathematical visualization such as MatLab or Mathematica?

    I don't know Mathematica/MatLab and I only know a little bit of C++ so I would not start this project any time soon but I would like to know the prerequisites of creating it.
  2. jcsd
  3. Apr 17, 2012 #2
    How much processing power do you need? If you can get away with a little less efficient use of your CPU and memory (i.e. in 9 out of 10 cases), I suggest learning Python. It teaches good programming habits and is surprisingly easy to learn and use. There's of course also the fact that if you're a beginner in programming, you won't write extremely efficient code in C anyway.
  4. Apr 17, 2012 #3
    My computer has an adequate CPU and very good memory as well. I have also run complex GoL simulations without any problem. I am actually not new to programming, seeing as I've written a lot of C# programs before.

    Python still seems like a good idea however, and I am planning on learning the language. Should I first learn Python 2 or 3? I was thinking 2 due to it being generally older and more stable.
    Last edited: Apr 17, 2012
  5. Apr 18, 2012 #4
    Python also provides several reliable GUI libraries for you create simulation applications while I still think you may need to go into Java world a little. You have the basics of C#, entering Java for multi-agent/autonomous systems would never cause you any troubles. The reason I tell you so because Java has been originally well-known as a GUI provider for decades, long before its brother Borland C++, and its son MS' C# were born. Many academic applications and those for research purposes are originally written in Java. If you would want to use C++, you will probably also need a C++ GUI tool/framework since OpenGL alone may not be enough.
  6. Apr 18, 2012 #5


    User Avatar
    Science Advisor

    You can get existing GUI systems that lay on top of OpenGL or DirectX in C++ if you wish. In fact all game engines with UI support will have this kind of functionality already in-built.

    The benefit of some of these is that if the GUI takes advantage of the 3D environment, you can have a 3D GUI and do all the things in the GUI that you can in a normal rendering environment like transparency, shaders and so on.

    If you want to get fancy, this is how you do it. Also I think if you look hard enough you'll find someone's already done this and posted it as an open source library or project.
  7. Apr 18, 2012 #6
    May I ask why you don't want to use C# to create this system? It's not my favourite language, but I think it would be powerful enough to do this job, too.

    Popular opinion states you should learn 2.7.x first. I disagree, because I think if you learn 3.x you will a. be familiar with the newer (ergo: proper) syntax, and b. be able to program in 2.7.x with only a few minor changes (which you can look up on the internet quite easily). It should be noted, though, that many libraries have not yet been converted to work properly under Python 3, so it's highly preferable to at least be familiar with both.
  8. Apr 18, 2012 #7
    If you can find a copy of "Computer Simulations with Mathematica" by Gaylord and Wellin in any of the libraries you have access to then that entire book is on the subject that you are looking at, along with lots of examples, code, etc. It includes documentation on linking to external compiled C code. That is somewhat old, but it should provide good general advice while you are still planning on what direction to go.
  9. Apr 18, 2012 #8
    Sounds like a good fit for Processing: http://processing.org/

    Here's an example of GoL in Processing: http://processing.org/learning/topics/conway.html [Broken]
    Last edited by a moderator: May 5, 2017
  10. Apr 21, 2012 #9
    Thanks for the input, everyone. I haven't made a decision to what I'm going to do yet but I will use the advice here as a guideline.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook