First Fullscreen Game

Hey, I’ve been working on a game for my computer science class and I’d like any input you guys have on it. It’s sort of a Sonic The Hedgehog-esqe game, and I’d like to share it here. I named it ‘Java Quest’ after the language I programmed it in. First, some background:

  • The teacher of my computer science class is named ‘Steve Shannon’ and I choose one of my friends in that class to be the main character, ‘Nick Wood’. The author of the text-book, Exposure Java, is named ‘Leon Schram’. Basically I was bored in Algebra 2 and I started writing a story line. It mostly consisted of Nick falling asleep while coding a lab assignment, but he still coded in his sleep. This code compiled to a portal into an alternate universe inside the computer. You later find out that he only activated a virius planted by Schram in his computer. Also, there is a slight inside joke in story line. ‘Schram should Scram’ is a little rhyme Nick yelled out during a test :wink: Everything is original, down to the last sprite animation. (Except the music, which I got from http://www.flashkit.com/)

My entire class loved it, hope you enjoy it as well.

And with out further ado, my 3 weeks of hard work:

http://modx.ath.cx:1337/jq_screen_00.jpg

http://modx.ath.cx:1337/jq_screen_01.jpg

Download Link:
http://modx.ath.cx:1337/JavaQuest.zip

All source code is included if you’re curious. I’ve built it with the JDK 1.4_07. To run the game, run the included ‘run.bat’ file.

(I know the sprite graphics aren’t that good-looking, but I’m not in a Graphics Design class… I think the awesome particle system makes up for it though :slight_smile:

Legal Garbage: Java is a registred trademark of Sun … blah blah …

Known Bugs: If you hit a tile just right you will go straight though it. I’ve not a clue how this happens, but it does.

Nice game. The jump speedup chevrons are a nice feature. The graphics are chunky but that gives it a nice Retro look :slight_smile:

The collision detection needs work though, as I fell out of the game a couple of times. Possibly the player is moving so fast he skips over the block and collision detection fails. You could look at detecting intersections of lines as a fix although its a bit complex. Imagine 4 line segments drawn around each tile. Now add a further line between the player’s current position and his new position. If this last line intersects any of the other four, you have collided with the block. For a really good job actually test against four lines from current to new player position, one at each corner of the player’s bounding box. Here is some code ripped from one of my games do find line intersections. Intersections are tested for in the horizontal plane which is in x & z. Ignore the y coord checking near the end as this is for a 3D game. If you are doing vectors in Maths, that will help a lot.

    /** Returns distance 0 to 1.0 along vector x, z to wall w1, w2 with height check */
    public float getIntersection(Wall w1, Wall w2,
        float x1, float z1, float x2, float z2, float y0, float y1) {
        // Returns MAX_VALUE if there is no intersection

        // Intersection point is calculated as
        // x = x1 + u*(x2-x1);
        // z = z1 + u*(z2-z1);
        // or alternatively as
        // x = w1.x + v*(w2.x-w1.x);
        // z = w1.z + v*(w2.z-w1.z);
            
        float wx = w2.x - w1.x;
        float wz = w2.z - w1.z;
        float dx = x2 - x1;
        float dz = z2 - z1;

        // Calculate distance to intersect u along path
        float dwx = x1 - w1.x;
        float dwz = z1 - w1.z;
        float denominator = wz*dx - wx*dz;

        // No intersection if the lines are parallel
        if (denominator == 0)
            return Float.MAX_VALUE;
        
        float numerator = wx*dwz - wz*dwx;
        float u = numerator / denominator;
       
        // No intersection if point does not lie on path vector
        if ((u < 0.0f) || (u > 1.0f))
            return Float.MAX_VALUE;
        
        // Calculate distance to intersect v along wall
        float wdx = w1.x - x1;
        float wdz = w1.z - z1;
        
        numerator = dx*wdz - dz*wdx;
        float v = numerator / -denominator;
        
        // No intersection if point does not lie on the wall
        if ((v < 0.0f) || (v > 1.0f))
            return Float.MAX_VALUE;
                
        // No intersection if we can pass through the hole in the wall
        // This uses the actual height of the entity
        float stepHeight   = w2.y00 + v*(w2.y10 - w2.y00);
        float lintelHeight = w2.y01 + v*(w2.y11 - w2.y01);
        if (stepHeight <= y0 && lintelHeight >= y1)
            return Float.MAX_VALUE;
        
        // No intersection if we clear the wall entirely
        // Allow stepping up to climb on top of low pillars
        float bottom       = w1.y0  + v*(w2.y0  - w1.y0);
        float top          = w1.y1  + v*(w2.y1  - w1.y1); 
        if (top <= y0 + PORTALSTEP || bottom >= y1)
            return Float.MAX_VALUE;
        
        // There is an intersection with the wall
        return u;
    }        

Alternatively (and this wouldn’t really work with the speed the player gets to when jumping) slow down the max movement speed, so that you can’t jump through a block between frames.

The loading time for the final level seemed quite long and as nothing was displayed I thought the game had crashed - Maybe ‘loading’ was supposed to display, but it wasn’t.

Cheers
Alan

Thanks for all that input. I’ll see if I can’t put in the line collision detection. I’m not sure about the last level loading time, it all depends on the computer I suppose.