Added a config file

Now that school is in full swing things have been moving pretty slowly, as I suspected. I did implement a config file this weekend though. All the game settings were hard coded before so there was no way to change anything after it was compiled. I already have a file read/write module in the engine so it was just a matter of reading in the file and parsing out the data I wanted. There is a screen parameter structure that I use to initialize a screen so I just fill in this data with what is read in from the file. Eventually I'd like to use an XML formatted file and get an XML parser working, but right now it's more like a windows .ini file. But now I can change the screen resolution, refresh rate, toggle if window/fullscreen, and determine what version of the shaders to use (but this is not fully implemented yet).

Anyway that's the latest.

If anyone is reading this, what games are you playing right now?

I was playing Resident Evil 4, but I haven't been playing much of anything since school started. I'm close to the end so I need to spend some time and finish it. I'm also playing Viewtiful Joe a little bit and currently patching Anarchy Online (which takes forever on dial-up). I haven't played it in a while but since it's free right now I figured I might play around with it again. I miss my Final Fantasy XI.


2D line collision

So I coded a little bit on the weekend and implemented some simple 2D line collision. I wrote a line intersection function and a vector reflection function. In my Calculus and Physics classes we are studying vectors right now, so I'm getting some good review of this stuff. And learning some new things as well.

I hit a few stumbling blocks while I was trying to find the intersection of two lines using parametric equations. I Found the answer I needed online (here) but I wanted to know how to derive the answer so I spent some time with it and eventually figured out what I was missing. I'd like to explain with some diagrams and equations but I'd need to make and upload some images to do that. Maybe later when I have some more time.

Also I recently discovered the game "n" and there is a wonderful 2D collision tutorial on their site for those that are interested. I just looked at it a little and it has some really nice demonstrations using flash.

For anyone interested this link is a good math reference.

And check out the student showcase winners from the IGF (Independent Games Festival).

(I'm slowly trying to learn some HTML and CSS so I've been tinkering with the blog template I started with. You may have noticed things looking different. For now I'm happy but don't be surprised if things start looking different. ^_^)


Back to school

So school started yesterday. I'm taking Physics, Calculus 3, and Intermediate Japanese 2. This semester should be pretty cool since I like all those classes, but my Japanese class makes me a bit nervous. I feel like I'm somewhat behind so I need to study more this semester then I did last semester. It's the last Japanese class that I need for my degree so I just have to make it through this semester.

I'm also in the process of filling out my application for the University of Michigan, and getting transcripts from all the schools I went to. I have to answer two short answer questions and write an essay which I'm not looking forward to at all.

Needless to say I haven't done any coding since my last post. My next task though is going to be a collision module. Just some simple 2D line collision, boxes, and circles. Nothing that should be too hard. Once that's done I can start doing a mock up of a level and get some control mechanics in place. I want to get a box on the screen that can run around and jump, collide with any lines or boxes I put in the 'level' and get the camera to move through the world following the box.


This is a strip being rotated. It's using the vertex shader code and my matrix / vector math functions. Posted by Picasa

This is the Sprite testbed. It's using an early version of the sprite engine which just builds one large strip using degenerate triangles. Posted by Picasa

When you start the testbed application you see this screen. It's the basic launchpad to all the different testbeds. Posted by Picasa

Vertex / Pixel shaders

I've been coding like crazy lately, every day for most of the day. Well so much for working on game mechanics. Instead I decided to play around with vertex shaders so that I could remove any Fixed Function Pipeline code and get the engine running with shaders instead. I'm familiar with assembly shaders, having written some for XBOX, but I decided to play around with the new High Level Shader Language since it seems that this is the future of programmable graphics hardware. It was pretty straight forward. I looked at some DX sample code and figured most of it out. I compile the shaders using fxc.exe and generate header files that contain the binary shader code. It took a while to get everything working smoothly because I didn't know about the Vertex Declaration, which I believe is new to DX9. So for a while things weren't working properly and I didn't know why. I eventually figured this out and things were fairly smooth from then on. I have a basic vertex shader that just passes the incoming vertex information out with the only exception that I upload a world/view/projection matrix into a constant register and do the vertex transformations in the shader. The pixel shader just passes through the vertex color. Currently I don't even use this shader since I haven't figured out the texture lookup in HLSL yet.

So that was my last big accomplishment. Everything is up and working again, but now I have the shader portion of the engine in place. Plus a did a bunch of other modifications that were needed to work with this change to shaders. I also switched from using clock() to using QueryPerformanceCounter() in order to get better resolution when timing the framerate. Plus it will help when I finally implement my own profiler. So much to do, so little time. Classes start on Monday.


A little history

Alright, heres a brief history of my game project.

In 2004 I was still working at a gaming company and trying to finish up our project. At this time I had already decided that I was going to leave once the project wrapped, move back to Michigan, and go back to college (originally for a degree unrelated to computers but now I'm going for a Comp. Sci. degree). Brainstorming one day with some friends and fellow workers I thought it might be cool to make a 2D particle engine based game where everything in the game was rendered using particles. I mean everything. It would look like the whole screen was alive. It seemed like a cool idea and I started thinking it would be a manageable project to work on in my spare time (A 2D game being less reliant on complex 3D models and animations, so I could manage most of the art, at least initially, and the scope would be much smaller than a game using a 3D engine). The game design has changed significantly since then, but that was the original catalyst for this project.

I initially began by researching what types of software I would need for the project. I knew I needed some version control software, an IDE, a debugger, and I had to determine what else I might need and where I would get it. Since I already owned a copy of MS Visual C++ 6.0, I figured I'd stick with that, at least in the beginning. I decided to go with Subversion (SVN) for managing assets (code and art). It seemed to be a good successor to CVS, which is (or was) the most widely used open source version control software. It took a little time to get up to speed with it but I wouldn't go back. I was never a big fan of SourceSafe any way.

Since the beginning I knew I wanted to keep the game independent of any platform. I would develop it for Windows, of course, but I also wanted to play around with Linux. I didn't have a Linux box at the time, but I do now. It helps to be able to compile with different compilers and for a different target. By starting with these two it will make the transition to any other platform (like a console) so much easier. So that meant I had to use the GNU compiler and since I didn't have a Linux machine I downloaded Cygwin and started using it. My whole project actually exists in my Cygwin directory on my Windows machine and in the same location on my Linux box. I use the Cygwin build of SVN and all my tools are run through a Cygwin Bash shell.

More recently I started learning Ruby. It interested me as a scripting language and as a language to write any tools I would need, so that I could code one tool and have it work on Win or Linux. I have a few tools written in Ruby already. Though I have yet to work with any GUI tools yet, they are all command line. But Ruby/tk seems like a viable option to make any GUI based tools I need (like a level builder tool).

Currently DirectX is the only library supported, but OpenGL is soon to come. The Linux build compiles and runs but all the graphic calls are just stub functions so it doesn't do anything. The last Linux change was the addition of SDL. I can create a window but thats it. The Win version will eventually support DirectX and OpenGL.

The Win build uses nmake and Windows cl compiler, and the Linux build uses all GNU tools. I'd like to get a GNU build working under Windows but I haven't done that as of yet.

I've got a good portion of my engine done. Most of my time was spent trying to design and code the engine. I've finally gotten to a point where I can start coding parts of the actually game play because there are enough pieces of the engine in place. The engine is by no means complete though. I have a testbed application that I use to test new parts of the engine as I code them and now I'm playing around with some game mechanics (finally!).

So in a nutshell that's where it all started and what has happened up until now. I'm currently in between semesters of school so I'm trying to do as much coding as I can. School takes up most of my time so I usually only code like one day a week, which means progress is usually pretty slow.