Tuesday, January 24, 2012

Quick update

Wow, long time no post.  Been busy over the holidays so I haven't had a chance to do much coding.  Doesn't help that I bought a ton of old Twilight 2000 pdf's from rpgnow.com to keep me busy reading and reminiscing. Hopefully this week, I'll put up the third post in the Emacs + Clojure + Leiningen series.

I have however lately been thinking about where to spend my free time in programming.  I still want to do some clojure programming, and I will, but the pragmatic side of me also wants to get back into some C/C++ programming.  I've slowly been reading the OpenGL SuperBible book (almost done with Chapter 4), and my original idea was that I would try to port the C++ code to clojure code (via the lwjgl library).  But I realized a couple things...

1)  The graphics side would be slow
2)  I don't want my C/C++ skills to rust away
3)  Might be an opportunity to pick up some C++11x
4)  I won't have to do any mental conversion of the code

The disadvantage of course is that I don't want all of my game to use C++.  I want the graphics side to be in C++ and possibly some OpenCL, but the actual game logic to be in Clojure.  So how am I going to accomplish that?  I could write a whole bunch of JNI so that the C++ code could call Java code.  Another option would be to do some IPC, and have the C++ code shuttle information and make method calls via some kind of RPC mechanism.

I already have a little bit of experience with Netty, and I even started writing my own messaging protocol to be communicated over the socket.  Although Netty was relatively painless, writing TCP socket programming in C/C++ is not fun...not to mention asynchronous or multi-threaded socket programming.  I could use boost's ASIO library, but that in itself looks like a pretty big learning curve.

So I'm still debating what to do.  JNI is tedious and error prone (usually requiring passing NIO byte buffers all over the place), and socket programming isn't fun.  I think I'll go the IPC socket route...but I am kind of dreading it.

But my decision to use C++ will be a time eater.  Not only will I have to refresh my skills (and pick up some of the new C++11x features), there's a ton of new libraries I will have to figure out like libSDL, boost.asio, boost.threads, and of course OpenGL itself.  I also want to learn a new build system called waf.  Makefiles are horrible, and I don't want to have specific IDE project files for each OS.  In a nutshell, waf is a replacement for autotools like functionality, but it is a bit complex.  That being said, I think it's approach seems more reasonable than other tools like cmake or rake.

But, a thousand mile journey begins with the first step.  I've already cloned the latest libSDL 1.3, built it, and make a simple OpenGL context window with it.  This will allow me to use SDL instead of GLUT that the OpenGL SuperBible book uses.  A small step, but a step none the less.




















No comments:

Post a Comment