Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411415 Posts in 69361 Topics- by 58415 Members - Latest Member: sophi_26

April 16, 2024, 02:17:19 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Post if you just laughed at your code.
Pages: 1 ... 18 19 [20] 21 22 ... 27
Print
Author Topic: Post if you just laughed at your code.  (Read 86554 times)
kiddRaddical
Level 0
***

ALT UNIVERSE SEGA SATURN DEV


View Profile WWW
« Reply #380 on: March 10, 2013, 09:42:50 PM »

Using raycasts, caching results in variables of the format [prefix]Out. Must've made a typo, cause my debug log just said:

" 'dOubt' Does not exist in the current context."

Getting personal advice from your debug logs: priceless  Cheesy
Logged

posting (too) regularly on Twitter: @EthanRedd
EthanRedd.com
Eendhoorn
Level 6
*

Quak


View Profile
« Reply #381 on: March 18, 2013, 02:51:29 PM »

Just wrote this regular expression to search for lua functions in middleclass classes. It totally looks like zoidberg or some crab guy. I am way too exited about this  Durr...?

Code:
(\w)+:+(\w*)
Logged

justinfic
Level 1
*



View Profile WWW
« Reply #382 on: March 18, 2013, 10:18:58 PM »

A loooooong time ago (like 2008?ish) I wrote a collision detection system in C++ that takes any two Shape objects, then depending on their subclass, executes a function that checks against those two shapes. It's pretty tight, but I didn't bother implementing every function at the time. Especially the reeeeeally complex ones. Years passed, deeds became legend, legend became myth, blah blah, and I forgot about them.

While trying to debug why two objects with complex shapes weren't hitting each other, I eventually figured maybe my collision detection function was incorrect, and found this as the entire body of the function:

Code:
// HAVE FUN WITH THIS ONE FUCKER AHAHAHAHAHA
return false;

 Lips Sealed
Logged

Twitter | Current Project: Heavy drinking
Evan Balster
Level 10
*****


I live in this head.


View Profile WWW
« Reply #383 on: March 19, 2013, 12:39:27 AM »

That is absolutely glorious, Fic.  Grin
Logged

Creativity births expression.  Curiosity births exploration.
Our work is as soil to these seeds; our art is what grows from them...


Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
JobLeonard
Level 10
*****



View Profile
« Reply #384 on: March 19, 2013, 04:17:46 AM »

:D

Highly relevant comic
Logged
AlexStv
Level 0
**


Based on real events!


View Profile WWW
« Reply #385 on: April 05, 2013, 01:49:47 AM »

Not my code but the Jedi Academy source code was just released and it's full of great comments.

Quote
jediAcademy/codemp/qcommon/stringed_ingame.cpp:41:// Yeah, it's hardcoded. I don't give a shit.
Quote
jediAcademy/tools/ModView/modviewdoc.cpp:88:void FuckingWellSetTheDocumentNameAndDontBloodyIgnoreMeYouCunt(LPCSTR psDocName)

Quote
jediOutcast/codemp/ghoul2/G2_bones.cpp:326:             // why I should need do this Fuck alone knows. But I do.
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #386 on: April 05, 2013, 04:04:12 AM »

A loooooong time ago (like 2008?ish) I wrote a collision detection system in C++ that takes any two Shape objects, then depending on their subclass, executes a function that checks against those two shapes. It's pretty tight, but I didn't bother implementing every function at the time. Especially the reeeeeally complex ones. Years passed, deeds became legend, legend became myth, blah blah, and I forgot about them.

While trying to debug why two objects with complex shapes weren't hitting each other, I eventually figured maybe my collision detection function was incorrect, and found this as the entire body of the function:

Code:
// HAVE FUN WITH THIS ONE FUCKER AHAHAHAHAHA
return false;

 Lips Sealed

Hahaha that one is good.

I use a macro for this kind of stuff (UCX_NOT_IMPLMENTED_YET), it generate a debug-break (which generate a crash in release) with the message "NOT IMPLEMENTED YET!!! DO IT NOW!!!!!!!".

I also have a macro for remembering to write a function before compiling:

Code:
/// Use this macro when you just want to remember to implement a function before compiling
#define UCX_DO_IT_NOW       static_assert( false, "NOT IMPLEMENTED : DO IT NOW!" );
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #387 on: April 05, 2013, 07:59:58 AM »

Not my code but the Jedi Academy source code was just released and it's full of great comments.

Quote
jediAcademy/codemp/qcommon/stringed_ingame.cpp:41:// Yeah, it's hardcoded. I don't give a shit.
Quote
jediAcademy/tools/ModView/modviewdoc.cpp:88:void FuckingWellSetTheDocumentNameAndDontBloodyIgnoreMeYouCunt(LPCSTR psDocName)

Quote
jediOutcast/codemp/ghoul2/G2_bones.cpp:326:             // why I should need do this Fuck alone knows. But I do.

I downloaded that source to look for a weird bug I had when I was younger and I had been playing JKA. It occured when you:
-Jumped up slightly
-In the air you had to kick in any direction with staff lightsaber
-Then, in the same moment you hit the ground, you had to jump & kick at the same time. That made you jump skyyyy high.

Didn't really find any answer to that  Sad
I guess it's just a dirty bug.
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #388 on: April 05, 2013, 08:08:10 AM »

I downloaded that source to look for a weird bug I had when I was younger and I had been playing JKA. It occured when you:
-Jumped up slightly
-In the air you had to kick in any direction with staff lightsaber
-Then, in the same moment you hit the ground, you had to jump & kick at the same time. That made you jump skyyyy high.

Didn't really find any answer to that  Sad
I guess it's just a dirty bug.
Sounds like a floating point divide by near-zero error.

EDIT: The paging, it burnssss!
Logged
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #389 on: April 05, 2013, 08:42:57 AM »

I downloaded that source to look for a weird bug I had when I was younger and I had been playing JKA. It occured when you:
-Jumped up slightly
-In the air you had to kick in any direction with staff lightsaber
-Then, in the same moment you hit the ground, you had to jump & kick at the same time. That made you jump skyyyy high.

Didn't really find any answer to that  Sad
I guess it's just a dirty bug.
Sounds like a floating point divide by near-zero error.

EDIT: The paging, it burnssss!

Yeah, I thought that the cause might be some division fail.. Namely, there's a division by forceJumpCharge and a timer - by guess I think that when you land and jump right away, one of these is very, very little.
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #390 on: April 05, 2013, 12:37:08 PM »

So if you time it correctly you jump sky high, and the suspects are forceJumpCharge and a timer?

Book 'm Danno Noir
Logged
Postmita
TIGBaby
*


View Profile
« Reply #391 on: April 05, 2013, 07:11:55 PM »

I have laughed at my own code a few time. Recently I discovered that "if" statements only seem to work if you are checking the right variables. Gave me a little relief that I wasn't losing my mind, but also planted some doubt that maybe I was.
Logged
Eigen
Level 10
*****


Brobdingnagian ding dong


View Profile WWW
« Reply #392 on: April 11, 2013, 10:43:54 AM »

Code:
// Divide into 256 x 256 pieces

int pieceSize = 128;

Huh?
Logged

BleakProspects
Level 4
****



View Profile WWW
« Reply #393 on: April 15, 2013, 06:50:54 PM »

I just made the most retarded programming decision in my life.

here's the problem:
I have a bunch of different kind of ramps. Basically, each "ramp type" is a combination of whether or not each top vertex of a cube is lowered into a ramp. So there are ~16 ramp types.

Supposing I have a bunch of these ramps all next to each other, how can I efficiently render them without rendering any non-visible faces? Basically, I needed a function that, given two ramps next to each other and a face, returned whether or not the face should be drawn.

After spending a lot of time trying to derive the solution to this problem and running into a bunch of corner cases, I got frustrated, gave up and decided to do it all by brute force. It turns out that combinatorically, this blows up to 784 cases.

So I just made an array that was 784 large. Then I wrote a script to loop through all the cases and prompt me on whether or not to draw the face in that situation. Looks something like this:



The red face is the face in question, and I press "t" or "f" to decide whether or not to draw it. It then loops through every case. The program spits out C# code which then runs in my game and fills the giant array.

After a few runs of this program, I finally made no mistakes and the thing works perfectly.

WTF was I thinking?
« Last Edit: April 15, 2013, 07:07:36 PM by BleakProspects » Logged

Geti
Level 10
*****



View Profile WWW
« Reply #394 on: April 15, 2013, 10:54:30 PM »

Bahahaha awesome Coffee Hope it didn't take longer than an hour.
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #395 on: April 16, 2013, 02:05:58 AM »

WTF was I thinking?

I... I... Master, please teach us Hand ClapEpileptic

(but on the other hand it's better than wasting a day to have a "real" solution!)
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #396 on: April 16, 2013, 04:46:11 AM »

Quite often, "real" solutions are for when you need general solutions, which kind of misses the point of optimisations.

Like the name of the Processing sketch Tongue
Logged
Muz
Level 10
*****


View Profile
« Reply #397 on: April 18, 2013, 12:02:46 AM »

I was rushing through testing a file output function. Not wanting to bother finding the folder of my app, I just copied it from another function. Also copied the file name too.

Turns out that I just overriden my main database file with some dummy text. It killed the whole app, but thankfully, it's recoverable. Would've been more amusing if the database was located in the root directory, since I overrode all the root protection stuff to debug faster.
Logged
2DArray
Level 0
**


View Profile
« Reply #398 on: May 07, 2013, 08:23:10 AM »

My line ended with "List.<int[,]>();" and suddenly I feel like I'm typing in Wingdings.
Logged
Belimoth
Level 10
*****


high-heeled cyberbully


View Profile
« Reply #399 on: May 07, 2013, 11:41:00 AM »

If keyboards had wingdings instead of a numpad or something I would enjoy coding with them.
ZODIAC SYMBOLS EVERYWHERE
Logged

Pages: 1 ... 18 19 [20] 21 22 ... 27
Print
Jump to:  

Theme orange-lt created by panic