Why is it that inspiration always seems to hit you when you nowhere near a pc or your code? You can sit and try to hammer stuff out for hours, but the minute your away from the pc and code and you can’t get to it, you get the Aha! moment.. doh.. Now if I can just remember how to use that long pointy thing.. whats it called.. oh yeah. a pencil..
It never fails though. I’ve been thinking about redoing the main menu for cannon #12 for a while.. ever since I redid the title logo. And sitting in the coffee shop before work, reading Doolwind’s Game Coding Journal (some good stuff there) it hit me how I wanted to do the main menu. Of course, I don’t have a laptop so I have no access to my code or even graphics programs (aside from paint) to even do a mockup.. ah well.
It just amazes me how much easier and clearer things become when your not focused on the code. Like last night I started getting some really bad slowdown when the player has both options and is firing repeatedly; it stutters. I got to thinking on the way im doing collision checks on all my bullets compared to the items they could hit. The player has a bulletManager and bulletList. Each option has its own bulletlist. Im passing a lot of lists around to do my checks which is not the most efficient way to do it. It was working fine before, so its a result of something I’ve done in the last 24-48 hours.. But.. I see how ineffecient my code is, sometimes requesting the same bulletList 3 times in the same Update cycle to check against junk items, shields, the enemy missiles, etc. So I need to consolidate and setup a local variable in the update that gets each bulletList once and only once at the beginning of that cycle.. better yet, create some variables on a higher .. ugh. forgot the word.. Scope.. create a variable with a longer lasting scope; that way im not recreating the list item each time, im just calling for the new list and clearing the old one. That should eliminate a LOT of redundant calls and garbage collection.. which I know is whats killing me.
But thats part of designing a game I guess.. this thing has expanded beyond what it was ever intended to be.. adding space junk that can be hit.. adding in the player options which were never planned.. new code is added and changed rather than modifying and optimizing the existing code. So thats what I plan on doing tonight.. optimizing.. Now i wish i had backed the project up to one of my flash drives. I could have gotten that done at work today with notepad..