COMP521 - Modern Computer Games
Winter 2008
(Course website)
Preamble
Your friendly neighbourhood TA here. If you haven't noticed, this page is pretty much in a constant state of flux. Generally speaking though, I'll try to make sure everything you see/hear on this page is true -- if not always complete.
Given this state of affairs, it may some day happen that you can't find what you're looking for here -- or that what you do find doesn't make much sense. On such occasions, feel free to send off a quick email to...
Nicholas.Rudzicz <AT> mail.mcgill.ca
Sadly, 70% of my waking hours are spent jacked in to the "Internets," so I'll probably get your email right away.
Go forth, young hobbits...
UPDATE: I've uploaded my own class notes from when I took the course. They can be found here. I MAKE NO CLAIMS AS TO THEIR ACCURACY; however, they can hopefully help you get a better grasp or a new perspective on a given problem.
UPDATE #2: I've uploaded the class presentation I gave regarding procedural content generation in video games. (Link)
UPDATE #3: (if anyone still visits this site) I enjoyed TA'ing the course, and I hope you each took something away from it as well. I'm not sure if TA assessments have been disabled/delayed because of the TA strike (or if anyone bothers filling them out), but if there are any lingering issues, complaints, questions, or anything else, I can be reached at my McGill email, above, or otherwise at nrudzicz <AT> hotmail. It was a pleasure, and I hope to see you kids around campus.
Assignment 1
(Assignment handout)
[P]NFG
You'll all need copies of NFG (176K) and PNFG (923K). Download these to a directory of your choice.
To compile a PNFG program -- say, foo.pnfg -- run the following command (from the same directory where you have downloaded the above .jar files):
% java -cp pnfg.jar pnfg.Main -nfg foo.pnfg > foo.nfg
This will compile your PNFG program into NFG format (note especially the '-nfg' flag and the redirection '> foo.nfg'). To actually run the resulting NFG game file, foo.nfg, enter the following in the same directory:
% java -cp nfg.jar nfg.Main foo.nfg
Troubleshooting
- I compiled these .jar files with JDK 1.5. Check that any errors you might have do not arise from an incompatible JVM.
- Java heap size is sometimes a problem. If you encounter an 'Out of memory' error, or something similar, you can try adding the '-Xmx1000M' flag to the command line, just after 'java'
- UPDATE: It seems that PNFG is indeed affected by the newline characters in your .pnfg source files: it expects Unix newlines as opposed to Windows ones. If you're writing/compiling your .pnfg file in Windows, you'd be well-advised to either:
- Copy your .pnfg file to your McGill CS account, and use the "dos2unix" command on the file there (i.e., "% dos2unix foo.pnfg").
- Download Cygwin to your Windows machine, install dos2unix.exe through Cygwin's interface, and run the program on your local source file, as above.
Example(s)
I've uploaded an example .pnfg file here. More may follow.
Inform 6
The version of Inform we will use is Inform 6.30. To properly install and use it to compile our game files (*.inf), we must go through a few steps first.
Troubleshooting
- If you have trouble connecting to the if-archive servers (which seems to happen more frequently than I'd like), try connecting to any one of the dozen or so mirrors. Hopefully, one will be available.
- If you just connect to the mirror at its head, or if the particular versions of Inform executables/libraries/interpreters to which I've linked don't work for you, you can navigate to different versions of each.
- Try one of the mirrors listed above. Once you find an active one, follow the links listed below for each type of file...
- Executables: $INF-MIRROR -> infocom -> compilers -> inform6 -> executables
- Library: The library is the same for all platforms.
- Interpreter: $INF-MIRROR -> infocom -> interpreters -> frotz
Assignment 2
(Assignment handout)
Bounding areas
- The random points you generate can be within arbitrary limits (up to the maximum and minimum representable numbers in your language of choice, of course). However, I suggest two things:
- Do not restrict yourself to one quadrant of Cartesian space. Allow both negative and positive values on both the x and y axes.
- Since you'll be comparing the effectiveness of two algorithms, having larger clusters will make the comparisons more obvious -- that is, the difference in resulting areas will be more apparent.
- With these two points in mind, my own suggestion would be to generate random points anywhere between no less than -1,000 and 1,000 on both axes, scaling those limits outwards if you feel so inclined.
- However, I spoke with Prof. Verbrugge, and he expressed his own opinion that the points would be best chosen from around the origin. His explanation is that, since floating-point values in any language have a fixed number of bits, larger values have a larger number of bits devoted merely to generating the offset from the origin, which results in fewer bits devoted to absolute precision. Conversely, values close to the origin can devote more bits to precision. Thus, it's argued that picking your random points from around the origin will result in more precise values.
- All this to say that picking ranges for your random points is up to you. Picking them on a larger scale (-1000 to 1000, say) will result in larger (by magnitude) differences in area; picking the points on a smaller scale will result in much more precise answers. Since we're mainly interested simply in the comparison (e.g., "Ritter's algorithm gives bounding circles 1.25 times as big as Welzl's"), the choice is up to you.
- See my class notes (up in the preamble) for my own interpretations of some of these algorithms.
- Ritter notes:
- Welzl notes:
- The question came up as to whether the "base case" of three points defining a circle was really a trivial calculation. It is indeed trivial, although not necessarily obvious. The procedure can be found here: http://windowseat.ca/circles/ (click on "learn about circles"). There's a lot of graphical fluff, but it's probably the best explanation you'll find.
Perlin Noise
- There are obviously a number of ways to go about this problem; however, in the end, you should all have something that looks fairly similar.
- Personally, I tried implementing something myself following the instructions on this site (also linked to on the main course website). It took me three or four hours to get some good-looking noise.
- Note that Zucker's approach says nothing about octaves! We have to take his algorithm and iterate it n times (where n is our number of octaves).
- At each iteration -- that is, for each octave -- we have to calculate the frequency and amplitude associated with that octave. We then use x*freq and y*freq as the "inputs" for this iteration, perform the calculation as explained on Zucker's website, and multiply the result by our amplitude. This final result is then added to our running total of the noise generated at the original x,y co-ordinates.
- New: I received an email based on Zucker's approach to Perlin noise, and the response I wrote was typical of me, in that it was long and overly wordy. There might be some useful information in it however, so I reproduce it here.
Troubleshooting
- I had the problem (and apparently wasn't the only one) getting the Assig2.java applet to load in my browser. I'm in Ubuntu, and after googling the symptoms I traced the problem to issues with the libXp library. In my repositories, I found that I already had libxp6 installed, but not libxp-dev. I installed the latter and had no more problems. If you're having similar issues, check if you have (in whatever distro you use) libxp and libxp-dev installed (I don't think this is a problem in Windows).
Assignment 3
(Assignment handout)
GBA Emulator
Assignment 4
(Assignment handout)
Client/Servers