Programming

Macbook Pro, XNA & Parallels 4.0

For anyone interested, after Boot Camping my new Macbook Pro (late 2008) and loading the partition into Parallels 4.0, I was able to build and run a default XNA 3.0 project. I’m assuming because of the improvements in 4.0 and support for Shader Model 2.0. Parallels 3.0 did not have the capacity to run any XNA build because of the lack of supported “hardware” (rather ironic term when talking about visualization). Either way, I’ll post a screen shot when I get some 3D content loaded in.

Please read instructions carefully!

While working on my research project/thesis, I decided that I really need to start incorporating threads into my apps to make anything of myself as a competent programmer. This involved two significant revelations: first, that pthreads do not inherently play nice with C++ OOP (duh! they're a native C library!); and second, threading OpenGL programs in an entirely different ball game.

Getting a thread up (which, for the record, I have done before for classroom projects), was no big deal. Then realizing that C++ classes don't play nice with pthreads was a bit tricky. Once I figured that out (I welcomed static member functions with open arms, I just don't feel the need to code proxy thread classes! That's crap), I couldn't understand why my app kept crashing inside a thread using OpenGL calls. I thought it had to do with something I wasn't getting right when trying to recast a void*; however; some sleuthing made it clear that only OpenGL calls made the main process choke. All this eventually taught me a very valuable lesson...

READ THE INSTRUCTIONS FIRST!

The Apple documentation, conveniently titled "Multithreading and OpenGL," made it more than obvious that pitfalls run rampant across the OpenGL/Multithreading paradigm. Only a few sentences in gave me the clairvoyance I needed to see why my thread kept crashing.

I'll keep OpenGL calls within the main thread for now, but I look forward to working in Cocoa/Obj-C soon. At least there, OpenGL seems cared for delicately with plenty of out-of-the-box routines that are multithreading specific.

svn checkout svn://192.168.1.114

I setup an old beige tower with Xubuntu (733 MHz, 384 MiB) and put up Apache (of course), as well as *drum roll* SVN! I'm using it on my research project cause I'm trying to experiment with a bunch of new programming designs for this project. I branched a"stable" version and started a bunch of other changes, and to know that I won't screw up the original is just awesome! I should've done this a long time ago.

w00t!

glRotatef(xRot, 0.5f, 1.0f, 0.0f);

It's quite impressive what programming simple games will teach you. I don't know why I've waited so long to knock boots with small game projects. Sure, admittedly I've had trouble following through with a lot of them, but now that I've gotten over that first big hump, its been a drastically different story.

I started writing a small game engine using C++, SDL & OpenGL. Source code will be provided in the coming weeks, but for now, check out the pathetically underwhelming screenshot after the jump. Read More...

glBegin();

So now with TetriSDL out of the way, I started looking at other projects. Before I move on though, I've committed myself to learning OpenGL (and Kung-Fu, if there is any time leftover). OpenGL is seriously the wwwwhip, mostly cause its cross-platform and ridiculously easy to work with. Any of the games I start working on needs to be ported to other platforms; all the effort I put into XNA doesn't do jack shit if I spend 100% on my Macbook.

On a much more interesting note, I've been listening to the Flight of the Conchords almost non-stop. They're absolutely fantastic. Oh! And I've also been gearing up for Kat's return to life. I can't wait to introduce her to all the ladies I met at the bar during the past five weeks.

Enjoy the best Flash game on the Internet!

delete &myGame;

So I close a chapter in life. As noted earlier, I started a lot of Tetris projects over the years, but no longer do I have to feel defeated by lack of interest or programming ineptitude. I make it sound like it was an epic endeavor; sometimes it was...especially when the ogres showed up.

As I expected, it was 4 lines of code changed to get it to compile on Windows XP. Click here to go to the code page.

tetrisGame.Update(&errorMsg);

Its been almost two months since my last update. However, the purpose of this particular update is to acknowledge a very special moment! Teris!

Sure I started plenty of Tetris projects here and there, the first being the DirectX version I slaved over while visiting Katherine at Yale, but what I have finished here tops all of them. Its written in C++ (with some Obj-C calls for alert boxes); its my most portable version yet (runs on Mac OSX, but itshould only be a couple of line changes for both Windows & Linux). At the moment, it does everything it needs to as a Tetris game. There is still a couple of changes I wouldn't mind making:
  • Add sound & music
  • Improve CPU usage & memory footprint
  • Needs a main menu
  • No menus? No repeats!

I'm tolerant of the only 6% CPU usage and ~6MB footprint it has right now. Still, it certainly can be improved; hell, it's only Tetris; it ain't Pong! I'll post the source and a Universal binary tomorrow.