Wednesday, August 5, 2009

Hitting the Wall

Leaks. Why did it have to be leaks? I hate 'em. I really do. The baleful looks that I throw their way should carry the raw loathing in some kind of concussive optic blast, reducing them to their tiny, and I assume - adorable, pieces. Or my hate based heat vision would destroy my computer and most of my living room, also a possibility considering the magnitude of the hate and the size of the accompanying stink eye laser it would produce.
Right then. The engine leaks for some reason. the previous reason I could blame entirely on enemy animations and loading. Now I find the leak goes even in the enemy free Cliff area, which is stupid. So, once again I loaded up the CAD Menu (which has a variety of delectable treats - try the veal!) and tried to summon up increases in memory usage. I found that when I just stand there and do nothing, no leak. No increase in memory usage. When I run around though, I get small and slightly random increases in memory consumption. So I went in and found/remembered that the Death Rectangle collision is pixel perfect and to get that the engine makes a copy of the current animation frame. This gives a static variable for the Death Collision. What I didn't find was where it released that memory where it was done. So I added that and bingo, bango, I still have a bloody leak.
What I do know is that the engine only leaks when I touch it. So the current leak has something to do with either Control, Animation or maybe the Collision Engine. Oddly, none of those really run or load anything dynamically, so I'm at a bit of a loss.
What bothers me more is the fact that the game slows down disproportionately to the amount of memory being quaffed. So when it's running at 45000 Kb the game is dandy and runs at the silky smooth 35 FPS it's supposed to. However, after a few minutes of play at 48000 Kibbles it starts to run like an octogenarian asthmatic - slowly into the ground. Those 3000 extra Kb's don't seem enough to cause that. It's possible that the slowdown is caused by something unconnected to the leak, which gives me additional hate to focus into an eye beam. It may be an optimization thing with the new enemy animating codlets, but those are even referenced when the area is enemy free. So for right now, I'm at a loss for how to correct a game breaker. I'll think of something. I have 200+ posts of figuring out something.

- Moving on to the next thing I have to build (once I get that^ bashed to death) - the walls. The conceit of the level is that the walls are all broken with ways to get inside and ways to get outside by getting cute with the Portal Rectangles. In effect I want to create a maze style environ that requires the player to think in 3 dimensions.
The more I think about it, I want the area to be small. I mean, quite small. Especially compared to every other area in the game. I'm shooting at building a layered puzzle with about 16 screens in it. Since the area is broken into a front and a back that's really only 8 screens worth of area. To put that in perspective the Cliff level (in spite of my wish to shrink it) came out at almost 60 screens, including all the screens that exist only to fall through.
By keeping it small I can do quick concepts of it and throw it out if I find it distasteful. No building an entire level worth of 50 screens and then deciding to give it the heave. Further, the smaller area will actually serve the puzzle itself. If there's 40 screens worth of stuff it makes it impossible to remember your way around an area. With 8 it's possible to get the player to get their bearings and feel all smart when they figure it out.

-Yep, that's an extended mutant power metaphor. I regret nothing.

No comments: