Geeks With Blogs

News

Series

Add to Technorati Favorites


An Archived Managed World This blog has moved to http://www.managed-world.com/blog

The tracer bullet is basically all finished now. I have enemies being spawned on a regular basis, the scoreboard is operational, the "Recap" screen is working. The only thing that is not implemented yet is the High Score system and screen. Of course, currently there is only one "type" of enemy and the game stays at an even pace and never "accelerates" to make it harder.

Obviously, there is a lot more work to do. I'm just happy to be at a point where the game is basically entirely functional now. That makes me happy :).

Tomorrow night will probably be spent doing some cleanup and refactoring to make up for today's coding session(s). Once I hook up the High Score system, I will need to add some different types of enemies and add some increased pacing to the game. I will probably also have to tweak the game flow a bit (ship speed, bullet speed, enemy speed, etc.).

Now, to show how truly pathetic I am at art, and to show off my extreme programmer art, I present this screenshot. Just remember that to this point, I am _not_ worrying about graphics. I am worrying about gameplay and functionality. Perhaps posting this screenshot will really make Chris and George think that I will definitely lose :).

Posted on Saturday, May 27, 2006 7:33 PM Game Development | Back to top


Comments on this post: Spaceballs - Day 10

# re: Spaceballs - Day 10
Requesting Gravatar...
Nice job Jason! Looking good. So, just out of curiosity, what object are you storing your bullets in (collection, hash, array, etc)?

And then, what option are you using to keep that storage container clean?

I spent a good bit of time struggling with that issue today, so I was just curious what you came up with.

...of course, we could have discussed it today had you finally installed Google talk ;)
Left by George on May 27, 2006 8:24 PM

# re: Spaceballs - Day 10
Requesting Gravatar...
Hey George :). I'm planning on setting up Google Talk when I get home from spending time with the family today.

I store my bullets with all my game's Entities (of type Entity) in the same dictionary. So, my bullets are stored with my ship and with my enemies.

I have a class that is dedicated solely to managing that collection, called an EntityRepository. The game logic adds a new Entity to the Repository. Then when it is "destroyed" based on collision detection, the game logic removes it from the repository. Entities are just Models (like in the Model/View/Controller pattern).

The Views of the MVC pattern are called EntityRepresentations (although I'm thinking of changing that just to EntityView). They are managed by the RepresentationRepository.

When an object is added to the EntityRepository, the EntityRepository sends out a message via the Messaging system that tells everyone that an Entity was added (or removed when it is removed). The RepresentationRepository listens for these EntityAddedMessages and calls the RepresentationFactory to build the view for the Entity that was added. This way, the model knows nothing about the view.

Now, both repositories store entities (or representations) in a Dictionary whose key is the ID of the entity (a Guid that is created when the object is instantiated) and whose value is the Entity itself.

So, even though the CollisionDetection manager is a seperate class from the game logic, it is also using these same repositories. This is possible by using a Service Pattern where the repositories are actually services that get registered with the ServiceLocator. This way, no matter what areas of the game need access to the entities, there is always just a single copy in memory.

Man, that's a long comment. Perhaps I should just make a post about it.
Left by Jason Olson on May 28, 2006 8:43 AM

# re: Spaceballs - Day 10
Requesting Gravatar...
Is your Entity class your Sprite then or does it inherit the Sprite class you mentioned in a previous post? Is the Entity class a base class so your ship and bullet inherit from it or are the ship and bullet both just an instance of Entity?
Left by Cameron on May 30, 2006 1:58 PM

# re: Spaceballs - Day 10
Requesting Gravatar...
Cameron, an Entity knows nothing about a Sprite. However, an EntityView (or EntityRepresentation) does know about a Sprite. I'm seperating the Model from the View here for the MVC-type implementation. So, an Entity would be a model so should know nothing about how it will actually look.

I never actually inherit _from_ a Sprite in my code. An EntityRepresentation will actually encapsulate an instance of a Sprite as a private member to do the rendering for it.

You are right on the last part though. My Bullet class and my Ship class both inherit from Entity. Then I have a BulletRepresentation class and ShipRepresentation class that both inherit from EntityRepresentation (I'm thinking of changing it to just EntityView). The representations' constructors accept an instance of the entity they are representing. So, in the case of the BulletRepresentation, it has a private member bullet which is of type Bullet that it uses to know where to render the Sprite.

Perhaps I should take another post to dig into this pattern a bit more.
Left by Jason Olson on May 30, 2006 7:39 PM

Your comment:
 (will show your gravatar)


Copyright © Jason Olson | Powered by: GeeksWithBlogs.net