kiddRaddical
|
|
« 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
|
|
|
Logged
|
posting (too) regularly on Twitter: @EthanRedd EthanRedd.com
|
|
|
Eendhoorn
Level 6
Quak
|
|
« 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
|
|
|
Logged
|
|
|
|
justinfic
|
|
« 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: // HAVE FUN WITH THIS ONE FUCKER AHAHAHAHAHA return false;
|
|
|
Logged
|
Twitter | Current Project: Heavy drinking
|
|
|
Evan Balster
|
|
« Reply #383 on: March 19, 2013, 12:39:27 AM » |
|
That is absolutely glorious, Fic.
|
|
|
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
|
|
« Reply #384 on: March 19, 2013, 04:17:46 AM » |
|
|
|
|
Logged
|
|
|
|
AlexStv
|
|
« 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. jediAcademy/codemp/qcommon/stringed_ingame.cpp:41:// Yeah, it's hardcoded. I don't give a shit. jediAcademy/tools/ModView/modviewdoc.cpp:88:void FuckingWellSetTheDocumentNameAndDontBloodyIgnoreMeYouCunt(LPCSTR psDocName) jediOutcast/codemp/ghoul2/G2_bones.cpp:326: // why I should need do this Fuck alone knows. But I do.
|
|
|
Logged
|
|
|
|
Klaim
|
|
« 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: // HAVE FUN WITH THIS ONE FUCKER AHAHAHAHAHA return false;
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: /// 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
|
|
« 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. jediAcademy/codemp/qcommon/stringed_ingame.cpp:41:// Yeah, it's hardcoded. I don't give a shit. jediAcademy/tools/ModView/modviewdoc.cpp:88:void FuckingWellSetTheDocumentNameAndDontBloodyIgnoreMeYouCunt(LPCSTR psDocName) 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 I guess it's just a dirty bug.
|
|
|
Logged
|
|
|
|
JobLeonard
|
|
« 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 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
|
|
« 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 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
|
|
« 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
|
|
|
Logged
|
|
|
|
Postmita
TIGBaby
|
|
« 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
|
|
|
|
|
BleakProspects
|
|
« 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
|
|
« Reply #394 on: April 15, 2013, 10:54:30 PM » |
|
Bahahaha awesome Hope it didn't take longer than an hour.
|
|
|
Logged
|
|
|
|
_Tommo_
|
|
« Reply #395 on: April 16, 2013, 02:05:58 AM » |
|
WTF was I thinking?
I... I... Master, please teach us (but on the other hand it's better than wasting a day to have a "real" solution!)
|
|
|
Logged
|
|
|
|
JobLeonard
|
|
« 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
|
|
|
Logged
|
|
|
|
Muz
|
|
« 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
|
|
« 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
|
|
« 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
|
|
|
|
|