Setting up JIG on Eclipse:
I’m going to do the majority of my projects in Eclipse as opposed to NetBeans. I may later try doing the projects in NetBeans to test the instructions for setting up JIG, but for now I’ll stick to Eclipse.
Getting JIG up and running with Eclipse
1. Now that the most recent version of JIG is up, I’ve downloaded the jar file just fine.
2. Started Eclipse.
3. Selected my workspace.
4. Moved past the welcome window.
5. Created a new project.
6. I’m going to name my project SpaceFrenzy, as that is going to be my first project.
7. The instructions here may be a little outdated. The instructions say I need the JRE of 1.5, though I was instructed to use Java 1.6, I’m not sure if the instructions need to be updated or not. Fortunately, Eclipse has a default of JRE 1.6 I believe. It calls it jre6 which I can assume is the same thing. Overall, a detail not really critical detail.
8. Included my library just fine from an external source. Since I’m going to be using the JIG engine a lot over the course of this summer, I put it in a lib folder inside of my workspace. It may or may not be helpful to suggest this. Another option may to suggest adding it later into a lib folder inside the project that way it’s not dependant on something outside the folder. If you like, I could figure out how to add a library in an existing project and write instructions for that.
9. Clicked finished. Eclipse has offered no complaints (yet), so by following the instructions listed I am done starting a project with the JIG library.
I’ll make note of any problems I may have with this when I start on the Space Frenzy tutorial.
Space Frenzy Project:
Once again, I’m not sure if this is true or not. The tutorials page explains that in order to run the tutorials 1.5 SDK. I was told to use Java 1.6, so I’m not too sure if it needs to be updated or not. Just a minor note regarding the documentation on the Tutorial’s page.
Part 1: Space Frenzy Design
Third bulleted item in Anatomy of a Computer Game, there is a segment of text as follows: “User interface elements (things that indicate the state of the game, like the number of lives remaining or the score this far).” I think you mean “(things that indicate the state of the game, like the number of lives remaining or the score thus far).” A minor wording change.
There doesn’t seem much here for me to offer any insight on other than I’m confused who the end user is of the tutorial is. Part of it seems aimed towards students such as the explanation of the objects in the game. However some information on that page, like the basic description of the JIG API, seems more aimed towards educators. It works for both in this instance, but I suppose I would be expecting the tutorial (or maybe just future documents) to be worded differently if it were focused on a student or a professor.
I do like how the game was put into terms of the Object Oriented paradigm. Thinking of a game in terms of an object with certain actions it performs appeals to people easier, especially to students in the Freshmen and Sophomores whom are more than likely being introduced to the concept of OOP (object oriented programming). For example, this would he handy in teaching WSUV students OOP in the Advanced Databases class when learning about objects.
Part 2: Space Frenzy Getting Started
Finally time to find out if I included the JIG library correctly and follow the tutorial. Seeing as the code to make a window and run it is fairly straight forward, I went ahead and copied most of it (except for the name, I’m just going to build off the same program between steps). With a few problems involving my own zip program, I get the jar running and managed to import the StaticScreenGame. Once that was done, I had no problems with the compiler. The code looks something like this: http://tinypic.com/r/hupr8l/5.
Feeling optimistic, I went ahead and ran it. As expected, I got a blank screen that did nothing. Remembering that JIG had a command prompt, I hit the` key to get to the “terminal” and typed in “help”. The terminal replied with a list of commands I could run. I typed in fps (frames per second) to see my speed and I was a little disappointed. The frame rate was around 68 fps. This was far less than any demonstration I had seen on other machines (I think I ran the physics demo on my new machine and it was several times faster). This (http://tinypic.com/r/6iwtx4/5) is an image of the window while the program is running. Also, my computer had performance issues while the program is being executed. The game was using the majority of the CPU usage, when exiting the game, the CPU usage went from 100% to 7% roughly. A picture of my CPU usage can be found here: http://tinypic.com/r/dlqjyp/5. My computer is fairly old, but I didn’t believe old enough to run that slow on a simple java program. It still can run processor and memory intensive programs such as Guild Wars (an online role-playing game) fairly well.
I’m not sure yet if this memory consumption affects the performance of the game itself. I’ll note more on this in the next part of the tutorial.
Part 3: Creating Game Objects
Finally I move on to the creation of objects on the screen. In reading the introduction paragraph for this part of the tutorial, I felt a little overwhelmed by the wall of text. Despite the mass of text to digest, the concepts were easy to understand. A Viewable object is something that you can see on the screen (like the ship), the Sprite is the most basic level of a viewable object (like a painting) and a Body is something with mass and velocity (like a body of mass, it weighs something and can move around).
Moving on to the coding section just below, I once again copy what is written there. To ensure I have the correct packages included, I use Eclipse’s tools to import a package for an object if it can find it in a library that is included. I do this for the VanillaSphere and Vector 2D. After filling in the code provided into my own classes, I continue on to rendering the ship in the next step.
I start by filling in the code given to me by the tutorial. This was the part in which I added rendered objects. The only one so far was just the ship, so I went ahead and added the lines of code into the constructor and added the render method. However, the compiler didn’t seem to care if I had the @Override or not. I left it in just in case. The result displayed a little blue triangle facing to the left on my screen.
I found the ability to put a visual object onto my screen within seconds to be extremely useful. Having the ability to put up some basic object to represent the objects on my screen was rather encouraging. There are many computer science projects that involve creating something that doesn’t produce immediately obvious results. The JIG engine, thus far, has been able to show to me that I can create a visual object on my screen in minutes. With the regular java libraries open to 1.6 Java, creating a triangle on a screen is a little more involved. It is even more involved to make it move around the screen.
Next I moved on to the section focusing on giving control of the ship to the user. I found the inclusion of the two new attributes to the ship class slightly confusing. I assume, at this point, that angularVelocity is public since it doesn’t have a keyword in front of it. It may be useful to include the word public in front of it, just to be explicit.
Now that the ship had those two new attributes, I went about adding the update method to the SpaceFrenzy class as well as the macros incorporated with it. Then finally I added in the thrust method for the ship and modified the update rule for the ship. These steps were a little difficult to follow since there was no explicit label or note as to which source file the new code was to be added to. Also it may be useful to note which imports may be desired.
Once the code was all input into their respected classes, I ran the program. As expected, the program ran smoothly. The triangle was able to turn around and thrust forward, then wrap around the screen when it went off the edge of the screen. There did not seem to be any performance issues inside the program. However, when I tried to prompt the JIG terminal for the frames per second, it would not display the FPS at the bottom right hand corner as it usually did. I tried typing the command in several times, but it would not display. While the triangle was “thrusting” forward, the number in the center would change from a 0 to a 1. Once I released the forward key, the number would return to 0 and the triangle would stop accelerating. The performance of my computer outside of the game is still somewhat slow.
I'll write more on part 3 later.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment