4 Hugues Ross - Blog: Space Douchebag! - 3 - Shiny Things
Hugues Ross

10/2/13

Space Douchebag! - 3 - Shiny Things

Well, week 4 ended and week 5's just about done too. Let's talk updates.
Space Douchebag! is coming along rather well, overall. Last week, I added in enemies and got things set up so that they could spawn in the background. You still couldn't interact with them at all, but it was a step in the right direction. This week, I made Space Douchebag! into an actual game by letting you shoot them. Score has been added as well, and enemies begin spawning at greater speeds as time progresses. They can kill you too, though the collision detection on your ship is a bit spotty.

That's great, but there's one other piece of news that makes me very happy with myself: As a surprise for my professor, I wrote an entire particle engine from scratch ahead of time! Take a look:
I realize that this isn't the best picture, but taking
screenshots of explosions is hard.
The explosions look quite nice in motion, and have a nice cartoon vibe to them. I think I just managed to hit a sweet spot with the settings. In case you don't quite understand what a particle system is, allow me to explain. Particles are tiny, simple objects that don't generally interact with anything else, and die soon after being spawned. They usually are created in large groups, with some randomness, to make various effects. This could be fire, explosions, rain, halos around bright objects, sparkles, smoke, and many other things. Particle emitters are simply objects that generate these particles, usually from a set location. The way my explosions work is that they fire off a ton of particles for a split second, going out in random directions. the particles, initially orange, slow down and turn gray before finally disappearing. This makes a nice smoke ring, as shown above.

For this week, we were not only required to make a blog post about our work(which is why I'm posting now of all times), but we also needed to implement a design pattern. I'm not sure where exactly to start with these things. They're quite cool, but difficult to explain. I suppose you could equate them specific plays in chess. Someone smarter than you came up with some elegant strategy, and now it's accepted by most as a very good move. I couldn't really think of a good way to implement any of the design patterns that I knew, so instead I designed my particle system in a manner similar to(though not exactly the same as) the decorator pattern. Essentially, I made my particle emitters particles. They act like particles for most purposes, in fact. The only difference is that they can make particles themselves. This means that in order to make more complex spawning patterns, emitters can make more of themselves, and tell them to move in certain ways. Then, the new emitters can make particles however they want. Here's a simple illustration of how it works:

Normally, this would be a huge pain to get working properly. However, here it's as simple as any other particle system. So while I agree that this setup isn't exactly the same as the decorator pattern, I feel that it demonstrates the same general concept(making additional functionality for an object using related objects).

Finally, I was going to add shaders this week as well, but I ran out of time thanks to a few other school projects. Maybe I'll do that next week. As promised, there will be a dev update for AMAZE on Friday. 
Post a Comment