Tuesday, May 4, 2010

To: Extensibility, ilu

So I'm really happy with myself that when I designed out my object manager and factory I thought about the long term and how to handle objects swapping meshes and textures and how to make specific items contained in a large class like our Projectile class which has 28 different kinds of objects.

For PoC we only needed to have our coconut in, so when you wanted to spawn an object in the game all you would need to do would be just specify that you wanted such as:
(ENTITY_TYPE, Transform Matrix, Velocity)

but now that we are going to have a few more in for feature frag 1, I needed to change the function call to spawn objects around a little. I added in the fact that certain objects needed a specific specifier (projectiles needed types, as did trees), so I added in a second parameter for that. I also decided to put in two sublists into the manager, one for each island. This will help out Ryan who is working on our AI right now, because he requested that I put some sort of system in so that each of the objects in the game know what island they are on so that when he calls to look for an item to collect he doesn't accidently try to go to the player's island. So after all these changes the new spawn function looks like:
(ENTITY_TYPE, int objSubSpecifier, Transform Matrix, Velocity, ISLAND_LIST)

So, I was able to change around two functions in the manager, and one in the factory and I got the desired behavior in under a half hour, all thanks to extensibility.

No comments:

Post a Comment