• entries
195
198
• views
103883

## New bug to me

I actually managed to run into a kind of bug in C++ that's new to me.
struct Base {  void print(void) {}};struct Derived : Base {  void print(void) {    Base:print();  }};int main(int, char **) {  Derived d;  d.print();  return 0;}

Here Derived::print() wants to call the Base::print() function as part of its implementation. Unfortunately, this doesn't call Base::print(). Base: here is treated as a label before a recursive call to Derived::print() which causes a nice happy stack overflow.

On the plus side, this didn't show up in any actual production code. On the down side, it did show up in the sample exam questions the publisher supplied for a beginner's C++ book. You'd think that for a question along the lines of "what does this code snippet do" that someone would have actually tried compiling and running the code before deciding on an answer.

## Week/Class 9

This week we spent a bit of time reviewing the games for the last six people in my class then spent a bit of time on the basics of GML, the Game Maker scripting language. That corresponded to the first six pages the GML section in the Game Maker help file. After that we spent a very short time with the 3D tutorial from the
Game Maker site.

I think for my next Game Maker project I might try implementing Dodecahellspawn in Game Maker. Given the fact that Game Maker only implements a subset of D3D and I don't think that includes access to the depth buffer, it should be quite challenging.

## Week/Class 8

So last week we spent the first half going over the platformer tutorial from the Game Maker website. Then we spent the second half grading each others game projects. We were supposed to give three to five minute presentations followed by group grading. I think some of my classmates have a time management deficiency, as most presentations went well over five minutes. That left six people who hadn't presented at the end of class.

Anyways, peer grading went by the numbers by category.
Gameplay      6 ptsFeatures      6 ptsVisuals       6 ptsCreativity    6 ptsSound         3 ptsDocumentation 3 pts

In any case, electronic hand-in doesn't seem to be working for me, so I uploaded a copy of my gm6 file to my webspace here and sent the instructor a link. This has the side benefit of allowing any of you with a registered copy of Game Maker to look at the file too.

## Week/Class 7

Yeah, late update on this one. I've been sick. Last session still most people had not completed their game projects, so there was another week extension. The teacher has stated this was the last one though. So we did presentations/group debugging sessions with what we had. Some of it was interesting; one guy looks like he wants to do a Scorched Earth clone. I don't think his implementation is the right way to approach things though. A lot of the appearance of the original Scorched Earth were due to implementation details, and the guy is reimplementing the appearance without concern of how that implementation will impact performance. I.e. creating missile trails by creating a number of single pixel objects. Works in simulating the appearance, but not so happy performance-wise.

And yes, my project was done. Done done. Ready to turn in and all that jazz, which makes the extension somewhat annoying to me. It's about ten megs, so I'll only upload it if you someone actually demands it. The background music is in wave files, as the mp3 versions of the music caused some bizarre audio effect defects (appears to be a GameMaker issue). If I get the time I might upload versions with mp3 audio complete with audio defects.

## Week/Class 6

In yesterdays class we finished the maze tutorial for the first hour, then we spent the rest of the time demoing the programs we've produced. I only spent a couple hours on mine and felt sure that I was going to get a failing grade on it, but it turns out that most of my classmates produced things that were far, far below what I had done. A suprising number were just a single room with a ripped sprite moon walking (the moonwalking being a bug that was quite common). The consequent lowering of the bar made my piece of crap look quite nice in comparison.

The teacher pushed back the due date for the assignment till next week. Oddly, the design document now needs to be placed as part of the program in the game information section. This isn't something I expected, otherwise I wouldn't have replaced the F1 functionality with my warp to the next level cheat button.

In interests of full disclosure, I'll post my train wreck of a game. It's a more or less blatant rip off of Gradius/Life Force, though it's 100% programmer art and not ripped sprites. (I swear some of my classmates spent more time looking for sprites than they did programming.) I finished about a level and a half, but I got most of what I wanted for the power-ups done.

Or not. Gamedev doesn't be seem to be accepting my uploads. I'll try again later.

## Week/Session 5

Again not much happened in class. We finally finished the 1945 tutorial from the Game Maker site, and did a quick run through on the Maze tutorial. The assignment for next week is to produce a game and write a design document for it.

## Week/Session 4

Yesterdays session was again fairly boring. We just went thorugh steps three and four of the 1945 Game Maker tutorial. For next week we're supposed to think of a game for our first game project. I'm thinking about doing something like the Gradius series. If you're an old school gamer, you may find it more recognizable under the name Life Force, which I believe was actually the second Gradius game.

## On the soapbox

As you may or may not know, in addition to being a moderator, I'm also one of the editors for gamedev.net. (Though if you've received a rejection from us in the past year or so, chances are I'm the one who wrote it.) One thing I've noticed, not just in the articles gamedev receives (though it's one of those that prompted this rant) but in articles published on the internet on the whole, is the general lack of error handling or even detection code in article source code. Often this is in the cause of "clarity" or some such other worthy cause.

Today I wish to say: "Well, screw that."

I feel like entire generations of coders are growing up not knowing how to deal with error conditions because they're constantly learning from sources that don't acknowledge that network failures occur or that you occasionally receive bad input from the user. (Or if you're a compiler writer, you constantly receive bad input from the user, but I digress.)

So leave it in. If you're writing exception safe code, say which guarantee that your functions give. Check those return values. Go ahead and call GetLastError(). Throw those exceptions and make those assertions.

Despite our best efforts to the contrary, people still are learning programming by imitation. We can't stop that, but we can at least give them good code to imitate.

## Week/Session 3

Yesterday was fairly boring. Basically all we did was work our way through the first programming tutorial and two parts of the second tutorial from the GameMaker site. However, rather than let us see the Game Maker files for the projects we were presented with the executables and the resource files and had to code the Game Maker games ourselves. I suppose this is a reasonable approach for an beginner course, but it still seemed like the pace could have been brought up a bit.

## Week/Session 2

Yesterday was the second session of the Game Development I class. As mentioned, last week's assignment was to create a review for the game Chicken Attack. I didn't particularly care for the game, as you might determine from my review. We spent the first hour or so of class reading each others reviews and grading them. In this case I felt a teeny bit sorry for being in the class since peer grading was on something of a curve. We broke up into groups of six or so, and whoever had the best review got five pointes, whoever had the worst got three and everyone else got four. It was pretty much unanimous that mine was the best in the group. On the other hand, I didn't feel too bad about it since the rest of the reviews in my group didn't show much depth or critical thinking.

Essentially everyone wrote something of a check list style review with rating individual elements without really going into what made them good or bad. Some were essentially just "good graphics, bad sound, boring gameplay" with enough words to pad it out to one page. I think part of the problem is that most reviews you see online or in magazines are geared towards the audience of the game buyer. This is totally reasonable, and I'm not saying otherwise. However, as potential game developers, the ability to analyze elements of what are basic factors and see how they contribute to actual game play is important. For example, graphics were analyzed simply in the terms of eye-candy. Again, reasonable for a consumer level review, but not so reasonable from a review made by and for game developers. Analyzing graphics should occur on a deeper level, such as whether the game uses basic color differentiation, or whether the animation of static elements adds or detracts from feature recognition. Not only is this thought pattern important from the standpoint of game development, but it's also easier to make a page/word requirement when you're actually saying something rather than just trying to cleverly restate the same thing four times in the same paragraph.

I don't expect this kind of thought process from beginning game developers. However, I had hoped that there had been other serious hobbiests in the class, and it doesn't seem to be the case. And admittedly, I am a bit over trained. I think about these things all the time when playing games. (Except for first person 3D games, in which case I'm mostly thinking about not being sick. Which probably makes things worse.)

The individual group discussion and grading was followed by a whole class amalgamation of key points in the reviews of the groups. This would have seemed more productive to me if the teacher spent more time emphasizing the critical thinking parts of game analysis. On the other hand, I somewhat spiked the flow of things by going second and plastering some of my more in depth complaints on the white board.

The next part of class was a basic discussion of the various elements of a game. The discussion was a little over simplified for me, but considering the implementation system we're using is Game Maker, it seemed reasonable enough. Well, except for the aggregation of all events under a single event handler mechanism. This is how Game Maker operates, but having spent too much time working on low-level game application details, the lumping together of things such as collision events with user input events got under my skin. Also the discussion of the game loop was also not precise enough to my liking. The game loop was the basic three step "process input events, update internal state, render" game loop. However, the professor referred to processing input events as if that part of things was waiting on user input rather than processing queued input events. This isn't how most games work, nor how Game Maker works. The only real time you see that is in basic command line games made without actual input libraries.

Finally, we spent some time on learning how to deal with Game Maker. We basically went through the "hit the ball" tutorial that comes with Game Maker. From there we were given a short time to come up with variants on the basic program and seeing what the groups could produce. My group went with a variation of something that I was fooling around with while everyone was working on the tutorial material. The gm6 file for that is here. Again, my copy of Game Maker in class is non-registered, so anyone should be able to play with this one. What it should do is start with a whole mess of blue balls. When two balls collide with each other, they change color from blue to red and back. Clicking on the red balls gives you one point. Clicking on a blue ball gives you a negative point. When a ball leaves the field by the hole in the left, you lose ten points. There wasn't enough time to put a victory condition in, so I suppose the goal is to get as many points as possible before all the balls leave the room.

The assignment for next week is to play the 1945 example game with Game Maker and to think about how to implement it (in Game Maker).

In other, completely unrelated news, this is post 10,000 for me.

## Game devlopment school week 1.

So, in the interests of keeping my academic software discount, I usually try to keep enrolled in courses at my local community college. Last semester I took 2D Computer Animation, which didn't turn out to be about what I expected, but was interesting nonetheless. This semester I've enrolled in Game Programming I, a pilot course that the college is using to help develop a curriculum for a two year game development degree. Yesterday was the first day of class, and I have come to the conclusion that I'm a tad bit overqualified for the course. However, for those of you interested in seeing what actually happens in a game development course, I've decided to write about it here. (Since I'm not doing anything else with the journal space anyways.)

The primary tool for the course appears to be Game Maker. The college seems to have gone and bought a number of licenses so that we're using the registered versions. (Naturally, the computer I was on had the unregistered version for some bizarre reason.) The text book is Andrew Rollings and Ernest Adams on Game Design. However, the course is focused on game development, not game design, so it looks like we're only covering the first third or so of the book, and most of the rest of the course will be focused on practical development via Game Maker.

The first class dealt primarily with administrative details and technical problems for the first half. We're using computers with removable hard drives for the lab work, and if you've ever dealt with removable hard drives, you know what kind of troubles can result. Especially when dealing with people who have never dealt with removable hard drives. I personally thought it would be intutively obvious for everyone to power down the machines before taking out the drive, but that seems not to be the case.

From there we played with the demo games that are packaged along with Game Maker to get an idea of what Game Maker is capable of, and then did a group exercise to identify points that make for a good game. (First small groups, and then as a class merging the lists of the small groups.) After that we downloaded and installed the game "Chicken Attack" from MSN Games and played that for a while.

Assignment for next week: Write a one to two page review of "Chicken Attack" and read chapters one and two of "Andrew Rollings and Ernest Adams on Game Design". Woo hoo.

## Apples and Oranges (well not quite)

So the parental units bought these HUGE asian pears. If you've never seen or eaten an asian pear they're sort of like a cross between an apple and a pear. So I took one look at them and said they must be eight times the size of a regular asian pear. Discussion occurs and the maternal unit says it's probably only four times the size (this is by biomass, which we eventually specified). So the maternal unit asks my brother to weigh a huge asian pear and an orange, normal asian pears not being available.

So of course he gets confused and makes the comment, "I know this isn't apples and oranges, but it's close."

Ok, that had no point. Just wanted to share.

## The Joy of Hard Drives

So my laptop hard drive has died, so I'm back on my old desktop. This wouldn't bother me so much if the stupid thing hadn't died in the middle of a backup; which corrupted the backup hard drive as well. I managed to salvage data for the most important things for work and the like; but I seem to have lost both the latest version of Dodecahellspawn and the Incredible Edible Cow, as well as a lot of application settings like my Firefox bookmarks and so on. This annoys me greatly.

I'll probably get a replacment drive for the laptop sometime after Christmas. For some odd reason prices seem to drop a lot around that time of the year.

## Getting used to things

I think I'm finally getting used to the new layout, at least visually. My muscle memory on the other hand is still completely borked. I'm constantly accidently bookmarking a forum when I mean to be going to the forum listing or going to the stats or who's online page instead of hitting the activetopics button. Hopefully that will go away soonish.

## Birthday

So another birthday today. I've been really busy lately and haven't decided what I want to get for myself this year. Any ideas?

## Sudoku again

There were some sudoku puzzles in the in-flight magazine on the plane, so I took the chance to bang out a solver between Denver and Las Vegas. It was absurdly easy. At this point the game no longer interests me.

## Back from vacation

If there's something worse than going to Vegas and losing money, it's going to Vegas with your brother, losing money, and said brother winning big because of advice you gave him.

Still had fun. Just not as much fun as I would have if the fraternal unit also ended up losing money too. :P

## On Vacation

Attending a convention in Las Vegas this weekend. Leaving tommorrow early morning and coming back Tuesday night. So chances are by this time next week I'll be broke but happy.

Wheeeee.

Turns out I was wrong about the number of possible states in sudoku; there are some transformations which I thought were isomophic that aren't. Now it actually sounds like an interesting problem to solve.

## Sudoku

There was recently a spate of sudoku based posts made in the forums. One of the things that came up was a difficulty creating a solver, but as far as I can tell there are only 186,624 different possible sudoku boards, which given the amount of storage is necessary for a sudoku board in computer memory, would be trivial to iterate through. Maybe I'm missing something. I guess the only way to find out would be write one for myself.

## Well crap

I really need to stop talking about SVG in this thing. Google is now linking me back to my own journal when I'm doing research.

## After Effects

Today I spent some time trying to convert some 3D animation information I had laying around into a form that Adobe After Effects would take. Adobe After Effects stores two sets of rotation information for 3D layers: one called Orientation, and then X Rotation, Y Rotation and Z Rotation. Orientation is actually represented internally as a quaternion; however, it's expressed to the end user as a series of rotations, X, Y and Z. This is annoying, but something that you can live with. Or at least, since I'm a programmer I can live with it since I can automate the task of converting quaternions to the Euler angles.

The part that boggles my mind is that the rotations are X degrees counter clockwise around the X-axis, then Y degress clockwise about the Y-axis, and then Z degrees clockwise about the Z-axis. When I first saw that I said, huh, must be a left handed system, not a right handed system. Then I looked at the layer information, and there in the comp window are the three axes of rotation, and yup, it's CCW about the X, CW about the Y and CW about Z.

So after spending about an hour screwing up the derivation of the quaternion conversion to the After Effects Orientation format on paper, I finally sat down with IDLE and brute forced a derivation. That is taking each component of the rotation matrix that represents a given quaternion and applying arc sines, arc cosines and arc tangents to various combinations of the matrix elements until I got the orientation back that I used to generate the quaternion.

It's a hack, but it works. At least out to the square root of epsilon of a double for all the inputs I've tried so far, which is good enough for me.

## Not much

Finally got around to doing some work on dodecahellspawn. Basically I ripped out the model code and replaced it. The problem with the old version was that the game state and the display information were hopelessly entangled. So that part got gutted and rebuilt from the ground up. The code is much cleaner now, and the interface should be better for attaching a scripting system to.

In unrelated news, we seem to have gotten a lot of new forum members lately. Which is usual for the first part of a school year. What seems unusual is how bad their spelling and grammar are. I swear I'm tempted to babelfish them into german and back to see if it makes more sense sometimes.

## Keyframed cows.

One nice thing I've discovered about the SVG format is that path nodes interpolate well. This means that I can get away with just building keyframes and interpolating between the key frames for my animations. Not only does this solve some of the issues I was having with frame rate dependent jerkiness, but it reduces the amount of animation content I need to create by an order of magnitude. This comes at a cost of making the SVG I'm building slightly more complex as I need match up nodes in each keyframe for the interpolation, but still a net win in terms of amount of time to spend on art.