Writing

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Showing posts with label postmortem. Show all posts
Showing posts with label postmortem. Show all posts

Dot n Munch: Postmortem

Dot n Munch

My wife, Miho, was pretty busy with kid's school work, taxes and what not, so I thought that I would make a game that was super easy to tied me over before I got help with the art work. If the wife is happy, I'm happy.

I decided to make what I thought would be a simple game. It was a timed, "fit the piece in a hole" type of game, giving me hopes of advancing my skills and increasing my reusable code. In particular, I wanted to develop a level manager, something that would display unique splash screens, then load the next level, then display a different fail or try again screen.


The Good:

1. Improved my classes.
2. Improved my state machine.


The Bad:

1. Time estimate was off.
2. Did not reuse my sprite class for collision detection.
3. Not that excited about the game.
4. Adding complexities did not work out.


The Good:


1. Improved my classes.

This is pretty minor actually. I cleaned up my timer and frame rate classes. My favorite class by far in this whole game is my BubbleChat class. Basically it reads the size of the text and puts a bubble around it with a pointer to the sprite who is talking. It can contain up to four lines of any length. I can change the color and what not.

2. Improved my state machine.

I was really hoping for a nice segue to my next game, Pixel Rescue. I wanted to become comfortable with loading levels and scripting them to what I wanted to do. This was a semi-success.

I set up a very nice scripting for the talking dot. It is a simple state progression. Probably along the lines of how I would set up some scripting. State is progressed when timer is done.

private void draw1 (Graphics2D g2d){

    // move over to the center
    if (state == 1){
        x = player.getX() + 4;
        if (x > 388){
            x = 388;
            ++state;
            chat = new BubbleChat(x,y, Color.WHITE, "Hi there!", "Please don't let me get crushed.");
            timer = new Timer(messageDelay);

        }
        y = player.getY();


        player.set(x, y);
    }

    // say hello for timed period
    if (state == 2){
        chat.draw(g2d);
        if (timer.done()){
            ++state;
            chat = new BubbleChat(x,y, Color.white, "Use your arrow keys to", "move me to a safe spot.");
            timer = new Timer(messageDelay);
        }

    }

    if (state == 3){
        chat.draw(g2d);
        if (timer.done()){
            ++state;
            chat = new BubbleChat(x, y, Color.white, "Good luck!");
            timer = new Timer(messageDelay);
        }
    }

I did not get the level loader quite to where I wanted. It progresses but not as cleanly as I would like.

The Bad:


1. Time estimate was off.

Game number two in java for me, and I still can't estimate how long something will take. I estimated a week and again I'm at two weeks with many more hours than I expected. On the inside I even told myself this should take 20 hours. The two biggest delays came from collision detection issue and motivation. There was also a lot of sitting and staring at the game, thinking to myself "how can I make this better?"


2. Did not reuse my sprite class for collision detection.

Since I was not going to rely on Miho's artwork this time, I used Java2D to create my polygons. I went too simple and ran into major problems. The bottom line is testing for an intersection of two polygons might work for hitting something but if you need to bounce back, it doesn't work well because it doesn't provide directional information. It much better to use the sprite approach of testing edges. If the left edge has passed the right edge, then move the sprite right. This works.

I spent a lot of time trying to guess at the direction and counter directions. Then the keyboard input created a bit of lag time so I could never ever get it working perfectly. I went back to the sprite style of checking edges and that fixed nearly everything. There is still a small problem when two sides are over at the same time but it doesn't seem to effect game play much. I'll have to see if someone complains during the feedback phase.

Not using my sprite class from Subby and the Fishes seemed to be dumb decision as I had to rewrite and troubleshoot a bunch of code.


3. Not that excited about the game.

The game is okay. I've tried to make it funny and as addicting as possible within a very confined design space. However, I'm just not that into it. Working on the collision issues for over a week was really demotivating for me. I was thinking "I don't like this job" when I should have been thinking "this will be so cool when I'm done." Procrastination and avoidance added several days to the development time.

The funny thing about it is that I could have sworn I had spent four weeks working on the game but when I look at my completion date for Subby and the Fishes, this one was only two--but sure felt like four.


4. Adding complexities did not work out.

Firstly, there were just general design ideas, not really thought out, so no reason to implement things like slippery movement or bouncing. The game is more about finding the spot rather than motor skills.

Second, I am happy to be done.

Subby and the Fishes: Postmortem

So how did the development "Subby and the Fishes" go. My goal was to write a simple applet game that could be sold to advertising based sites. Lets review 10 things that went right and 10 things that went wrong on the development.

The Good:

  1. Starting with a small project.
  2. Choosing Java2D over 3D.
  3. Rewriting to make code more elegant
  4. Having other people play it.


The Bad:

  1. Estimate to completion was completely off.
  2. No refined sprite class.
  3. No refined sprite manager class.
  4. Display class was not abstracted

The Good in detail:


1. Starting with a small project.



Starting with a small project is just about the best thing a programmer can do. We all want to make an even better World of Warcraft but this isn't the way to go. First progress is immediate. It is quite motivating to see the game become better and better by the hour. I found the how to write an RPG in 40 hours quite inspiring.

Second, it is much easier to rewrite your code. If you did something wrong with the structure, you only need to refactor a few classes versus thirty or more. I think rewriting for elegance is key. With a big project, there is just no time to rewrite with huge pieces of code. My first rewrite and reorg took almost 8 hours on a very simple game. I hate to think how much it would have taken on a larger one.

Third, feature creep is limited. For example, my sprite class resizes, animates, and alpha blends. It does not flip, rotate, or force pixel colors. At some point I will want to add these features but they are not needed for this game. Each would probably take me hours to complete if I implemented properly with speed tests.

Fourth, there is little to no artwork delay. Art takes a long time to make and can be expensive. It can be quite quickly developed. In my case, my wife, Miho, can knock out most of the sprites in a weekend.

2. Choosing Java2D over 3D.

This could probably be retitled to "Go with what you know." In my case, I've spent a month playing with Java2D. It is familiar, and there are a ton of excellent tutorials on the subject. JOGL looks extremely attractive and will probably be the only way to go in the long run for developing desktop applications. However when I sat down to try to learn it, I found myself wasting valuable time. It was going to take me a month to become quite comfortable at least.

I also felt like I had more important things to learn like object orientated structures, sound, map management, user input. Kevin Glass has a nice tutorial that abstracts the display of the game from the game itself. Flip a switch and run JOGL, Java2D or LWGL. I'm still deciding if I should go this far perhaps as a final rewrite.

3. Rewriting to make code more elegant

I can't say enough about this. Since it is a small game, there is time to go back and make it right. For me, my first rewrite was to make reusable sprite and sprite manager classes. Maybe this is just good object oriented design but it was a first for me and I love the way it turned out. I can now add sprites in a matter of minutes. My code is much easier to read.

A spin off of the sprite class was to create a resource manager for the art work. It was simple hash map that loads everything into memory. But it sets up my sprite manager for timely reads so I don't have to wait for hard drive loading. It also sets things up for later if I ever need to manage video or PC memory with a large game.


4. Having other people play it.

Feedback is invaluable, no matter how hard it is to listen. About 10 people played it on JGO, finding bugs and making excellent suggestions with regards to speed and difficulty. What was also quite important was that I was able to pare down my TODO list just to get in what players wanted.



The Bad in detail:


1. Estimate to completion was completely off.


My original estimate was one week. Total time was four weeks, working part-time, nights and weekends. Rewriting the code to make in organized well took a week and half alone but improved my programming skills. The sound was a bit of a nightmare. I originally tried to add some music but the EasyOgg and another free library have major bugs in them, making them scratchy and bugging on different operating systems.

Here is the list of things that took longer than I thought.

Rewriting the code 1.5 weeks
Reorganizing the code 2 hours.
Sound and music 1 week, OGG never worked.
Compiling for Java 1.5 1 hour
Art mistakes 2 hours

2. No refined sprite class.

I spent the most time working out a nice sprite class. This took a long time to get it perfect. The nice thing though is that is completely reusable. I loved the fact I can add sprites in minutes.

3. No refined sprite manager class.


The overall structure of the code could still probably be improved. There are controllers and actors. Then there is a controller for the controllers. The first time going through this makes it a little confusing as to what controls what.

4. Display class was not abstracted

This is more of an I wish I would have thing. I wish that my display class was setup perfectly for a JOGL or LWJGL conversion. I'm very curious to see how much more speed I would have with these in place. 33 FPS cap just doesn't seem that good. However, no one that played it really went lower.