Pick it up Man!
More changes for the Amulets & Armor project. This update I’ve got an interesting video for you. It shows how you can pick up items now in the look mode. Continue Reading
Pick it up Man!
More changes for the Amulets & Armor project. This update I’ve got an interesting video for you. It shows how you can pick up items now in the look mode. Continue Reading
WASD with Mouse
Since my last post, I’ve been working on making the keys work using the WASD keys and the mouse. I wasn’t too sure how this would work out, and honestly, I’ve never done these types of controls in a game, much less in a windowed game. Other than a bout of rea life interruption, the new code was not terribly hard to add. The video attached shows more…
Removing the Curse — One Bad Bug
I cannot help but be pleased by my work today. Although I did not get the new WASD and mouse controls fully working yet, I got side tracked with a bug in the system. Working with the game lately has been a bit of trial and error lately because each time I ran the debug version, I would get an error about every 2 minutes or even sooner when I started casting a large number of spells.
Irritated by the instability of the system, I changed my tactics from adding or changing the code to finding that bug NOW. The little voice in my head was already screaming at me that I was being unprofessional and letting my desire for new shiny features distract me from the mundane and obvious problem before me — that the product was being taken down by a small infestation of memory mangling termites.
Using a magical routine called _CrtCheckMemory() along with my own house rolled MemCheck() commands, I was quickly able to setup a system that searched high and low for the tale tale signs of an unwanted visitor. Nevermind that the frame rate dropped to less than 1 (a screen update every 5-10 seconds), but I was able to setup a test that would cause the bug to show itself. And low and behold, it was in the effects system.
The effects system tracks what effects are on the player. Cast regeneration, and you get a small icon on the side of the screen and your character regenerates. But the effects were not working correctly. Come to find out that the small memory structure allocated for the effect was the WRONG structure. And I when I mean the wrong structure, I mean the wrong structure. Somehow the inventory structure was being used in place of an effect structure (ahh, the one flaw of C — too much power). The proper structure is bigger than the one that was being allocated and writes to the effect were scribbling past the end of allocated memory, thus, corrupting the heap. Since most spells create an effect of some type, this explains why I thought the spells were cursed! They were slowly destroying the memory space.
Now I’m able to play the game again and for long periods of time. Alright, I admit it, I played for about an hour today without a crash. It was nice never seeing a bug … until … I tried to quit and found a new bug. Sigh. The good news is I was able to use the tools developed above to identify what caused the crash, I just have to figure out how to easily recreate it. (It occurs when a blood splatter disappears off the ground at the same moment you complete a level — how’s that for a rare bug!)
My general rule is to find a test case to recreate the bug, verify the bug exists multiple times, fix the bug, and then test that the bug is gone. I hate bugs!