Posts Tagged ‘rpg’

OpenGL in VisualStudio.Net with the TAO Framework

March 4th, 2009

Some who read me on a regular basis might be wondering what ever happened to the RPG I was writing in VisualStudio using Microsoft’s XNA technology. Truth is, it never went anywhere. Like a lot of past projects, I got very psyched about it, wrote a bunch of code, and then school started and I got way too busy to finish it. I haven’t touched the code since I wrote that post, but now I’ve got some new ideas.

Last term in school, I took an excellent course on OpenGL programming with C++. The course covered how to create and render 3D graphics, with study lent to topics such as window management, points, vertices, and polygons, lighting and shading, hidden surface removal, and texturing. My earlier post about the MAX 3D Engine was a byproduct of that course.

Since then, I’ve discovered a managed .NET wrapper around the OpenGL libraries called the Tao Framework that allows you to (in theory) code any graphics application in Visual Basic or C# that you could in C++, with the added bonus of the pretty IDE, code completion, top of the line window handling procedures, and the .NET libraries. Now at this point, if you’re a graphics programmer, you’re laughing aloud at my outrageous claim – managed, run-time interpreted code could never be fast enough to run a video game! You may be correct. Frankly, I have no idea, as I haven’t yet had the time to write a full video game.

What I have come up with however, are two starter projects for anybody wishing to try their hand at OpenGL programming using Tao and Visual Basic.NET. The code in both is well documented, easy to follow (especially if you are familiar with standard OpenGL routines), and seems to run at a reasonable 60fps. Now, I can’t tell until I add a few more polygons to the scene whether this framerate is an artificial limit applied by the environment, or if interpreted code actually has no hope of ever running a game at a reasonable speed. That is an experiment for a later day. For now, I will simply share these starter projects for all to use. If you do something with them, please leave a comment and let me know how it went.

Tao2D Test Harness:

A simple application that spins a tri-coloured, smooth-shaded triangle around the y-axis.

Source Code: Tao2D Source VB.Net.zip

MD5 Hash: 4DA0FC584B1EF8738B3B9CA4C1F55388

Binaries: Tao2D Binary.zip

MD5 Hash: 611382CB00CADD860A81A85573CBA763

Tao3D Test Harness:

A simple application that spins a really crappy looking cone around the x-axis

Source Code: Tao3D Source VB.NET.zip

MD5 Hash: 8D54DB42109F12C745AD14922FF8850E

Binaries: Tao3D Binaries.zip

MD5 Hash: 5D4CD4D02B3EE1194758A543DF36C034

As always, I recommend using Tyler Burton’s Hash Verifier program to verify the integrity of these downloads.

Troubles with XNA

August 26th, 2008

I’ve always had an interest in making video games. I remember making a puzzle-based game with Microsoft Power Point way back in the day that occupied a full box of floppy discs. While the current state of the video game industry seems contrived to prevent new players from entering the scene, I’ve often toyed with the idea of trying to get involved by way of participation in a smaller project.

I’ve worked on numerous ‘bastard’ games over the years, so called because they’ve often been written in VB or Java, and usually had horrible physics or jerk rules that made them impossible to play. These have always been fun, but I recently decided that I’d like to do something a little more serious, and started looking into the MS XNA framework for Windows and XBOX 360.

I grabbed a text book on the subject, and started at it, intending to create an old-school top-down RPG similar to early Zelda titles or Pokemon a la GameBoy. So there I was trying to write a game in an unfamiliar language (having never used C# before), and with a new mindset on how games should be created. The majority of basic classes were ported over from an old VB project that I had lying around, allowing me to get a sprite and tiling system up in short order.

In order to properly test the tiling system, I decided to leave the engine for a short period and build a map editor app back in trusty old VB. I set it up so that the editor saves two files – a PNG pallete of all tiles used in the map, and an XML file that describes which image from the pallete to put on each square of the map grid. For those interested, the source code can be had here.

So now that basic maps can be created and saved, the task of loading maps into the engine is at hand. And this is where I got seriously mucked up. XNA introduced me to the idea of a Content Pipeline – essentially, my engine cannot load files from arbitrary directories on the system drive at run time. All necessary files must be dropped into the project at design time, to be compiled into a binary file that the engine will read from at run time.

Ok so not a big deal for image files – just drop them into the content folder, load them into a Texture2D object, and draw them to the screen. But how on earth do you do likewise for an XML file? In order for my engine to use the fancy map editor that I spent hours working on (and am pretty proud of), it has to process an XML file for the level, load the necessary pallete of tiles, and construct the background grid based on that information.

Sure, hardcoding the levels -would- work, but that’s ugly and stupid and horrible. I like my XML levels, and want to process them (with the content pipeline if I must) with ease. The missing link is figuring out how to open an XML file for reading that is hanging out in the content pipeline.

Anyway, that’s about as far as I’ve gotten, but I’ll keep updates coming as I get farther into my adventures with writing an RPG.

Cheers,

Jon