Stupid code...

Posted by Darthvender on Aug. 19, 2010, 11:18 p.m.

A week ago I "fired" my level designer because I'm having to completely rewrite the engine for Chronicles of the Hchrubak, which will take quite some time.

The code was becoming a jumbled mess and I was basically having to overhaul the game anyway.

So, I began with a new movement and collision checking engine that uses almost exclusively while loops with lengthdir_x and _y. All was good, and it's a little hard to explain, but there was a large bug within the code after only a few days.

I retyped much of it and checked my logic several times through. After TWO @$*#$!# DAYS the code was almost completely alien from its original form, even though it was now several times more efficient.

So, tonight, just as I was considering rage-quitting and finding some small animals to crush, I check my problematic code one more time and I was using a "<" rather than an ">"!!!!

RAGE!

Comments

Cesar 14 years, 3 months ago

I was almost sure this was going to be about 64digits' mind altering code.

Acid 14 years, 3 months ago

:\

Lapixx 14 years, 3 months ago

I was almost sure this was going to be about 64digits' mind altering code

That doesn't make sense, the title is "stupid code…" O.o

Juju 14 years, 3 months ago

Reverse psychology mind-altering code.

Infinity_Plus 14 years, 3 months ago

That's happened plenty of times to me, Darth :P I hate finding out all of my work was thrown off by one little symbol or a mistyped variable.

Josea 14 years, 3 months ago

Using almost exclusively while loops is now a feature?

Scott_AW 14 years, 3 months ago

I'm used to seeing my code transform as I go back and clean stuff up. Sometimes I'm wondering what I was thinking…

Vance_Kimiyoshi 14 years, 3 months ago

My most common mistake (and a very stupid one) along those lines is forgetting function calls. I'll write a bunch of flawless functions, run it, and wonder why it's not working only to realize I forgot to call one or more functions somewhere.

God, compiler, the functions are there, I have to tell you when to call them, too? D:

blackhole 14 years, 3 months ago

Never, ever assume that taking the address of a function will always return the same location in memory.

Also never needlessly export or attempt to import template inline'd functions.

I've also been able to crash the VC++ compiler many times, and have succeeded in exposing various compiler bugs relating to its inability to properly deal with virtual inheritance.

I also have a bad habit of calling virtual functions that either don't exist yet or no longer exist.

I also panic about performance issues after I forget that I have my "give CPU cycles back to system" turned on.

Half my errors are caused by me misusing my own code rather then it doing anything wrong.