FAQ Search
Memberlist Usergroups
  Forum Statistics Register
 Log in to check your private messages
Log in to check your private messages
Moonpod Homepage Starscape Information Mr. Robot Information Free Game Downloads Starscape Highscore Table
Your best bugs
Post new topic   Reply to topic    Discussion Pod Forum Index -> Independent Game Development View previous topic :: View next topic  
starscape junkie

Joined: 15 Jun 2003
Posts: 177
Location: The Thirteenth Colony

PostPosted: Mon Oct 17, 2005 4:54 am    Post subject: Your best bugs Reply with quote

What are some of the best(or i guess by definition worst Razz) bugs youve ever had in your programs.

My personal best is the one ive been trying to suss out for over two hours now.
Theres an image drawing at 0,0...ordinary enough, except for the fact that its caused by reading into a specific variable from a file(No fin>>, no drawing). As an added bonus the image is only loaded into memory, i hadnt gotten around to using it yet, so theres no function call to draw it anywhere. For kicks i disabled the image drawing function i use, and yet it still manages to draw itself onto the screen (id love to know how that works)
Back to top
View user's profile
Poo Bear
Pod Team
Pod Team

Joined: 14 Oct 2002
Posts: 4121
Location: Sheffield, UK

PostPosted: Mon Oct 17, 2005 8:32 am    Post subject: Reply with quote


There is a picture of a nice one I had here where all the contents of the entire world suddenly appeared in one room.
Back to top
View user's profile Visit poster's website
Pod Team
Pod Team

Joined: 14 Oct 2002
Posts: 3734

PostPosted: Mon Oct 17, 2005 8:44 am    Post subject: Reply with quote

One of the Starscape updates included a broken savegame with a rather colourful name Sad
Back to top
View user's profile Visit poster's website

Joined: 03 Sep 2005
Posts: 38
Location: Nottingham, UK

PostPosted: Mon Oct 17, 2005 5:49 pm    Post subject: Reply with quote

Rainbow? Smile
Back to top
View user's profile Visit poster's website
Starscape Jedi
Starscape Jedi

Joined: 13 Dec 2003
Posts: 89

PostPosted: Sat May 13, 2006 7:36 pm    Post subject: Reply with quote

One of my favorites was with a 2d game that has homing missiles in it. I had a bug in the homing code that caused the missiles to circle in one direction at their maximum turning speed instead of seeking a target. When I went into the game to check out the algorithm, the bad guys shot some twenty or thirty missiles, and they all hung in the air spinning. It looked like a field of butterflies.

One of my other favorites was in a 2d game that had gravity. As a debugging routine, I had a vector drawn on the ship in the size & direction of the gravity -- and it was naturally using the inverse of the distance squared, as real life gravity does. Anyway, at one point while testing the game, I got distracted and my ship got sucked into a star, and that gravity vector got drawn so big and so far off the screen that it crashed the program. Took me forever to figure out why the game was crashing on player death.

My favorite bug ever wasn't for a game, though. It was for a school project back when I was learning to program. The project was in C and involved arrays - and just from that setup, you should know what it was. I had a routine that iterated over the contents of an array and (after doing some checks for valid data), printed each element. These elements were whole data structures in themselves. When I ran the program, all my elements looked fine, except the last one. It had all the fields right except the one specifying the 'number of spaces' in the output -- and that one tended to take on really screwy and random values and mess up the display of the whole thing. I couldn't figure it out for the longest time, but of course (as you've guessed by now) I was off by one and running off the end of the array.

That only solved half the problem, though. Why was I getting valid data out of uninitialized memory? Well, it turns out I called a function right after declaring the array, and I called it with one of the elements in the array. The result was that the next glob of memory on the stack after my array was used for the parameters of the function, and so when the function returned, the uninitialized memory off the end of the array was set to valid values!

I'll always cherish that one, even though I haven't programmed in a language that let me see uninitialized memory for quite some time now. I guess it seems kind of mundane, looking back at it, but at the time seeing uninitialized memory make sense was such a profoundly WEIRD experience, I'll never forget it.

It was even weirder than that time I had a bug that depended on the construction of Perl's symbol table... Wink
Back to top
View user's profile
Starscape Jedi
Starscape Jedi

Joined: 25 Apr 2003
Posts: 1143
Location: Glasgow, Scotland

PostPosted: Sun May 14, 2006 2:14 am    Post subject: Reply with quote

Can't think of any amusing bugs off the top of my head, but I will say that it's an incredibly satisfying experience the first time you get an assertion failure in a piece of simple code you never thought should ever breach your assumptions, and you realise that it's being fed some stupid bad data from somewhere else. You look at it and realise how much harder it would have been to track down what was going on if the error had propagated further.
Back to top
View user's profile Visit poster's website MSN Messenger

Joined: 06 Sep 2003
Posts: 160

PostPosted: Thu May 18, 2006 11:28 pm    Post subject: Reply with quote

Here's a bug I found when I was learning C++ from a highschool course.

I was learning how to create my own linked list class for the first time (as opposed to the second, third, fourth and fifth times in courses CS 142, 124, 235, and 240 respectively). The bug refers to a single line of code:

x = x + 1;

Now, one of the things I love about Microsoft Visual Studios as opposed to the GNU build system is that I find the Visual Studios debugger infinitely more useful than gdb or even ddd. Now, I was debugging my code, stepping through it line by line. When I reach this particular line of code, Visual Studios tells me that x has a value of 2. Once I pass this particular line of code, x has a value of 0.


I rebuild my code, thinking that maybe I had run my code with out recompiling in the changes. Nothing changes, x is still equal to zero after I add one to it.

Now I'm beginning to get upset. My program isn't doing what I want it to, and because of the laws of GIGO, I'm beginning to think that I have done something undescribably stupid. I start taking more and more drastic measures. I add a line of code.... and the debugger skips it. Now, in hindsight this should have been a red flag to me, but I'll get to why it wasn't later. I then remove the offending line of code entirely. And the exact same thing happens.

Now, I do a whole bunch of other stuff - commenting out code, adding many lines of code, so on and so forth. After about 20 minutes of this, I finally go get the teacher. The teacher shrugs his shoulders and tells me to recode the entire thing. From scratch.

Now, I DEFINATELY did not want to recode the entire thing from scratch. I didn't have access to a compiler at home, so I would most likely have to come in before and after school to work on it which was something I did NOT want to do. So I continue trying to fix it. EVENTUALLY, I CLOSE visual studios in disgust, copy my code out of the project folder, and just delete the entire project. I recreate the project and move my copied code back into the new project.

And what do you know!? It worked! In hindsight, I figure that something was wrong with the linker, and it kept linking the wrong object code. Once I deleted that object code, I the linker sought out the correct object code.

Now, if I had known better, I would have realised this as soon the debugger skips lines of code, because that means that that line of code simply doesn't exist in the object code. However, because we were being taught C++ on Visual Studios, the teacher had decided that teaching us about the compilation process was out of the scope of the class. It wasn't until college that I actually learned about the compiling and linking process, and about preprocessed files, and how the compiler turns this into object code, and how the linker then links stuff together and creates the executable file. Visual studios hides this entire process from you (in a matter of speaking), while the GNU build system does not.

It is for this reason that, though I love the Visual Studios has a great debugger (IMO), that I believe that students should be taught how to program C++ on the GNU build system first, before being allowed to use Visual Studios.

Anyways, there you have it. My first bug that took me more than 5 minutes to fix.
Back to top
View user's profile

Joined: 19 May 2003
Posts: 363
Location: London, UK

PostPosted: Fri May 19, 2006 10:10 am    Post subject: Reply with quote

It's hard to think of amusing ones. I guess they never seem amusing at the time.

Most wasted time for something completely trivial -

Once upon a time I was writing an NT service that used the Lotus Notes API. I kept getting pointer errors deep inside the Notes DLL whenever my service did stuff. I double checked the API docs and I was calling all the Notes API init functions in my start-up code as I was supposed to - so, out of ideas, I spent over a day stepping through and reverse engineering the Notes DLL up to the point of the crash.

Turned out I wasn't calling all the init calls after all: the NT service manager calls your service entrypoint on a different thread than the .exe entrypoint so I needed to call the Notes Init Thread function on the new thread. Grrr. And then it all worked.

(I don't see the point that the GNU tools expose compiling / linking to you any more than VC++: even if you know what you're doing you're only making trouble for yourself using the separate tools over using the g++ compiler driver to do the full compile. But hey.)
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Discussion Pod Forum Index -> Independent Game Development All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group