Networking is Alive BUT…
Progress on the networking code in A&A is coming along. I now have the ability to send packets from Classic A&A v1.02 in DOSBox to a special A&A Server and have it send packets to another instance running Classic A&A v1.02 Windows version. I am excited with the ability to see the traffic with tools we didn’t have back then. Not only do I get multiple windows in the Windows version, but I can even dig deeper with Wireshark and look at the raw packets and timing. This is good stuff. Except for one thing … it doesn’t play the game.
Sad. And the problem is more of a devil than I would have expected.
I’ve been debating on how to tell people about the latest progress. After two months, you would expect there to be a whole new 3D engine and a dozen more enemies in the game. Alas, no. Now for a few words.
Released into the Wild
Plenty has happened since my last post and it is time to give an update on what has been happening — some exciting (A&A Released!), some good (Contests!), and some not so good (Bugs!). Let’s start with the best part — the release of Amulets & Armor Classic v1.00.
We Have Established Control
Progress is continuing! This update includes some new features, a video about the new escape menu, programmer talk, and a little mood music. 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!