Update on Bunny Bomb

So, I finished creating a graphics system for Bunny Bomb. It works much better than my previous system. Still a couple of bugs to flesh out inside of the Bunny Class though.

Here’s the current prototype.

Here’s the old prototype.

The big differences between the two come from collision detection and the game field. In the old version, the game field was divided into individual cells. Anytime a bunny attempted to enter a pre-occupied cell, they would fail the movement. In the new version, bunnies aren’t bound to a cell and can move freely. Any time they come within a certain distance of another bunny (IE right before collision can occur visually), the bunny stops.Each bunny class has an automated random movement function using a setInterval. With the new version, since the bunny will not move into a collision, no visual overlay of elements occurs. The random movement function is simply called 1 second later (a variation exists between the various bunnies of between 0-500ms for this function call so that all bunnies don’t move at the same time), and the bunny has the possibility of moving in a separate direction.

Some bunnies may not move upon spawning simply because I created a random value between 0 and the stage width to spawn the bunnies, and some come into existance inside of the collision prevention radius. (Hence, they will never move since they are always “collided”).

The biggest difference between the old and new prototype comes from the visual rendering method. In the old version, each bunny class had an associated movie clip which would be updated each time the bunny moved. This created a lot of redraw for the flash player, and when the number of bunnies approached around 15 bunnies on the stage, there was a noticeable decrease in performance.

I worked around this by creating a simple rendering system using the BitmapData class. This allows me to only have one visual representation for each bunny which gets redrawn on the stage for each bunny. I created Frame Buffer using a Bitmap that gets duplicated onto the screen every frame (in the current prototype). This is for simplicity, and I will probably try to increase the efficiency of the graphics system as the project continues.

Just for proof of the performance increase, I created a second prototype which contains 40 bunnies to show the performance increase. This can be seen here.

Advertisements

One Response to Update on Bunny Bomb

  1. Taco! says:

    :O Interesting. Can’t wait to see the final results!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: