Welcome!

Hey, I'm Skylar, a kid aspiring to become a competent programmer. This blog is here to detail my dabbles in development.

My dream is to one day become a professional programmer and do some game development in my spare time.

Thanks for visiting my blog, and I hope you'll come back!

Pages

Day 5 of Charge Development




So I said I'd be working on the quad tree decomposition... and I did. I implemented it and everything and the way I went about it just made it completely suck. After that failed real hard, I thought about how efficient it really was, I figured that every collision is one check, and the work to update the section each frame is significant compared to that, so I've decided to scrap that.

So instead I created a simple particle engine. For the most part, I just took LazyFoo's particle engine and slightly modified it to fit how I wanted it to react. I may expand it a bit but at the moment I'm only worried about one thing: The colored surfaces.

So the problem is that there is 4 surfaces that are used in the particles. LazyFoo has them as global variables but I doubt he'd do that in a real project. It's bad practice because the entire game doesn't need it. The only thing that actually needs it is the levels.

So my problem is that I have to display the surfaces in the particle class, because if I declare them in another class, then they can't be accessed. I don't want every particle I create to create 4 surfaces because that becomes real inefficient, real fast. The solution is supposed to be static variables.

I admit I forgot what the keyword was. I knew what it did though. As of now the variables aren't static, it's getting late so I'll fix it up tomorrow.

The big problem is that static variables can't be initialized in the class they are created in, nor in header files. Not initializing it isn't an option because that causes static variables to not be in scope. So what I'll have to do, is initialize them in the play state, and see if that works.

Well for now that's all I got... so I'll be back tomorrow for another update.

0 Response to "Day 5 of Charge Development"

Post a Comment