CS 326
Object-Oriented Design, Fall 2003,
Instructor: Jeffrey Horn
CONTENTS
- Assignment 1: 3D Game Studio
- Assigned: Friday September 5, 2003
- Due: Friday, September 12, 2003
- Install 3DGS (see below), and test it as follows
- Start up the WED (world editor) from the Start menu. Open up office.wmp. Compile (the whole level, at least this first time) and run it.
- Now find the office.wdl script file in C:Program Files/Gstudio/work/, and open it with TextPad.
- Change something interesting, and noticeable to the player. Save the file, and then go back to the WED, recompile (you can choose "entities only"), and run it.
- Show it to me!
- Assignment 2: Using the SDK
- Assigned: Monday September 15, 2003
- Due: Monday, September 22, 2003
- Install the SDK, if you have not already done so (see the instructions and files in the "discussions" section of our course WebCT page).
- Read the SDK documentation (comes with the install), at least page 4 to see how to get started.
- Implement the following:
- First make sure you can compile and run DLL files in 3DGS. To do this, try the following:
- First take this file, ackdll.cpp, and put it into the folder SDK/dllsdk, replacing the old one. This file contains two new functions flipUpsideDown and Straighten. Then locate the file named ackdll.vcproj and open it with Visual C++ or Visual Studio .NET. You should see the ackdll.cpp file.
- Compile it into a DLL (in .NET, you click on menu "Build" and then "Build ackdll").
- Go into the folder SDK/dllsdk/Debug and get the file Ackdll.dll. Copy it to your GStudio work folder (mine is in the default location C:/Program_Files/Gstudio/work).
- In the work folder, save the old copy of the script file office.wdl (e.g., rename it), then replace it with this one (office.wdl), which uses the two DLL functions in Ackdll.dll. (You will see the calls to them in the action "patrol_prog". Note all needed changes to the Cscript are immediately preceded by a comment line with "// DLL DLL DLL DLL DLL DLL DLL DLL DLL DLL DLL DLL" .)
- Start up the WED on office.wmp, then run it. No need to compile in WED if all you have changed is the script file (office. wdl). When you click "!" in WED, the script file will be compiled (here you will see any error messages). When the game runs, check to see that FlipUpsideDown and Straighten work (use the "U" and "S" keys respectively).
- Add your own, similar DLL function. Do something interesting!
- Add a DLL function that gets a Cscript object, and thus acts as a "C++ wrapper" for that part of Cscript. (and is exactly what Conitec does not want us to distribute, apparently!)
- Add a DLL function that calls a built-in Cscript function, and thus acts as a "C++ wrapper" for that part of Cscript. (and is exactly what Conitec does not want us to distribute, apparently!)
- Add a DLL function that calls YOUR Cscript function. You write the Cscript function that you call, and you use it to access a Cscript function that is not normally available to DLL functions (e.g., "beep", but don't try "wait"! (why not?)).
- Show them all to me.
- Submit the code (.wdl and .cpp files) to WebCT, as soon as I get a drop box up!
- Assignment 3: Wrapping the SDK in C++
- Assigned: November 7, 2003 (updated Nov. 14 with Adam's header files)
- Due: Friday, November 21, 2003
- Install the SDK, if you have not already done so (see the instructions and files in the "discussions" section of our course WebCT page).
- Major Tasks:
- Implement a class that derives (extends) the BasicEntity abstract class. (i.e., it compiles!)
- Use any model you like. Clearly write your name on it somewhere (use a painting or drawing program on the texture.
- Make your class (rather, objects of your class) "work" in the virtual world. This means it should do a pretty good job of reaching the "goal" set for it, including some ability to get around obstacles, including map entities (e.g., blocks and sprites) as well as other "dynamic entities" (e.g., other BasicEntity objects).
- Turn all of this in via WebCT.
- Detailed instructions:
Here is the code directory.
DLLs
- First thing to do is to get all of the DDL files (you can just grab the zipped dllsdk folder in the file ackdll.zip) and put them into your dllsdk folder. (Note that one of the new files is ackdll.cpp. This will overwrite (replace) your current ackdll.cpp, so save it first if have anything in there of your own.)
- Then open up your project and from within Visual C++ (the file Ackdll.dsp) or Visual Studio (the file ackdll.vcproj), and replace all occurrences of "fixed" by "fixedPoint":
- Under "Edit", choose "Find and Replace", then "Replace in Files", then in the pop up window, make sure you check off the box for "Match whole word", and make sure the search will "Look in all documents". That should do it! (At least for Visual Studio. Don't know exactly what the sequence is for this in Visual C++.)
- Open up the eight new files (acdll.cpp BasicEntity.cpp, Gerbil.cpp, and Controller.cpp and their associated .h header files). Then add them to your project. Seems you have to do this manually. Go to menu "File/AddExistingItem...".
- Compile. This should give you a new Ackdll.dll that should go in your Game Studio work folder.
C-script .WDL files
- There are two ways to do this. The preferred way (I prefer) is to get the file cs326_API.wdl and put that into your Game Studio template folder, NOT YOUR WORK FOLDER! Then get the two pieces of code makred bu the "*******" comment lines from the file office.wdl and put those two sections into the appropriate places (see comments in the code) in YOUR office.wdl file (or whatever .wdl file you want to use; it just has to be the main .wdl file for your level, which means it has to have the same name as the .wmb file).
- Or, if this does not work, you can try copying the entire office.wdl file into your work directory, overwriting your current office.wdl file.
- Or you can get my zipped work and template folders and replace yours with them.
- Edit (with WED) the level and run it!
- NEW: (as of Dec. 6, 2003)
- Here is the vector manipulation code I showed you in class on Friday. I used it in my BasicEntity class, "Jeff", to rotate my entity toward the goal (in my "move" method). Of course, rather than give you the code for "Jeff", I have instead repackaged the code (yes, it compiles!) into more general methods, and made them "protected" methods in BasicEntity. You can simply replace your two files for BasicEntity (.h and .cpp) with the following, and then call them from your BasicEntity subclass, OR you can copy just those methods into your class. No matter what, your code should work with mine, as the latest BasicEntity (which I will be using) simply has MORE methods added, including one that moved from private to protected. But that still means the new BasicEntity will be backwards compatible with classes derived from the older versions.
- BasicEntity.h (with vector methods, see comments in the .h file that explain each method)
- BasicEntity.cpp (with vector methods)
- Here is the Controller code that can help you test your BasicEntity-derived class (i.e., your "Gerbil"). It simply makes an array of BasicEntities, puts 10 copies of yours into it (you have to edit the constructor and put your class name in there instead of "Jeff"), and then calls your "create", "setgoal", and "move" methods to get your entities moving toward the goal:
- Controller.h
- Controller.cpp (see comments in the .cpp file)
- Assignment 4:
- Assigned: November 19, 2003
- Due: Tuesday, December 2, 2003
- Create a UML class diagram of ALL the classes used in assignment 3, showing their properties and their relationships (e.g., aggregation, derivation) to each other.
- You can do it by hand, or try using Metamill (see LINKS above):
- NEW: (as of 12-7-03)
- If you want to do this assignment fast and easy, then go to Scott's web page and follow the instructions there. This will get you a class diagram of your C++ code (You can skip, or delete, all of the structs that came with the SDK. All that I am interested in is our classes: Controller, BasicEntities, subclasses of BasicEntity, and any associated classes you might define.)
- Then add any associations (arrows) between classes that Metamill did not include. Get the arrowhead right, including labels. I think what will be missing is the arrow from BasicEntity to Controller, although there might be more missing. What kind of association (and therefore arrowhead) go on that arrow? Any labels? (e.g., if there are many BasicEntity objects in one Controller object, there is a way of showing that on the association arrow under UML). There is a summary of association types at the bottom of this web page. And here is a more detailed page that gives more explanation. Or you can look in our book; Chapter 8 or 9 is where UML is introduced. I will be grading that arrowhead (between BasicEntity and Controller)! And its label. Plus any other associations missed by Metamill. So get it right!
- Turn in the class diagram. You can save it as a bmp, jpg, or whatever (AFTER you add the missing associations) and email it or drop it into the WebCT assignment 4 drop box, OR print it out and hand in a hardcopy.
- Assignment 5: ASSIGNMENT 5 has been cancelled!
- Assigned: November 19, 2003
- Due: Wednesday, December 3, 2003
- Write a copy constructor for your class. It must do a "deep copy", and really create a separate, independent offspring.
- Here is the signature of the copy method: public <your class name> child(distance_vector location).
- The parameter location gives the (x,y,z) coordinates, in the world coordinate system, where your offspring should be located. Otherwise, all the other values (e.g., pan, tilt, roll) should be the same. You then return the C++ pointer to this copy of you.
TEAM WORK