Wednesday, June 22, 2011

In Profundis Progress (6/22)

Did I make a mistake in picking C++?  I know it sounds like I'm dithering between languages, but coming to it from something as luxurious as Python makes C++ seem really... what's the word I'm looking for... Aspergery?

In any case, the development timeframe for this thing is such that I don't think I can become proficient enough in C++ quickly enough to make effective use of it.  But fast-enough Python code relies on either using an out-of-date library (Psyco ceased development with Python 2.6) or a special interpreter which is probably not compatible with the breadth of Python modules I require (pypy).  Further, packaging Python into executables seems to be generally hacky.

I just want to code in peace, and I can't seem to write anything right the first try in C++.  Someone in comments a while back suggested Java.  Maybe I should consider that.


  1. Have you considered using Jython, so that you could pick an existing Java game framework, run on the JVM, and still keep the Python syntax?

    Might be worth experimenting with, I'm not sure how "performant" that would be.

  2. I love C++. I use it for projects all the time. And with experience I believe it's about as fast to develop in as, say Java. But, the experience is hell to accumulate. I'm not as fond of Java, but even as a C++ proponent I'm forced to admit that in speed Java is in the same area as C++. (In memory C++ has a decided edge, but RAM is cheap.) I believe Java is easier to learn than C++, but I was fluent in C++ before I looked at Java so I can't be sure. Of course, any new language will have speed bumps in learning.

    Another possibility is a C or C++ library used in Python. Depending on what's slow, perhaps you can isolate a small section and suffer the effort port it to C or C++. You're still stuck with learning C or C++, but hopefully a smaller, more isolated portion is an easier problem to tackle. If your slow section is the cell simulation, that might be a good area for such an optimization.

    On that note, what is slow at the moment? I assume Python has profiling tools. Was Psyco really providing much of a speed gain? In particular, if you're spending a lot of time getting graphics up on the screen, there may be faster interfaces. I believe there are OpenGL interfaces, and many 2D games are using OpenGL/Direct3D to get major speed boosts in compositing.