Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Funniest line of code ever ?

4: Adsense
  • You cannot reply to this topic
126 replies to this topic

#121 OandO   Members   

1541
Like
10Likes
Like

Posted 19 January 2015 - 09:14 PM

*
POPULAR

typedef float flaot; // Quicker than learning to tpye accurately.

Edited by OandO, 19 January 2015 - 09:15 PM.


#122 Bearhugger   Members   

1276
Like
3Likes
Like

Posted 25 January 2015 - 02:31 PM

try {

    //
    // Some Java code that throws a lot of checked exceptions.
    //

} catch (SomeCheckedException e) {
    // I DON'T ALWAYS WRITE EMPTY CATCH BLOCKS
} catch (AnotherCheckedException e) {
    // BUT WHEN I DO, I'M CODING IN JAVA
}


#123 Brain   GDNet+   

18901
Like
0Likes
Like

Posted 25 January 2015 - 05:03 PM

I just had to share this from my r-type clone from 1998.

 

Procedure DrawFloor(FloorStep:Integer);
begin
_RangeCheck:=True;
{Enable CJEPROC flag for clipping of sprites}
Flr.PlotVirtual(31-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(47-FloorStep,16,ScreenPtr); {Don't even think of accusing}
Flr.PlotVirtual(63-FloorStep,16,ScreenPtr); {me of being a lazy coder,}
Flr.PlotVirtual(79-FloorStep,16,ScreenPtr); {'coz this chunk of calls is}
Flr.PlotVirtual(95-FloorStep,16,ScreenPtr); {about ten times faster than}
Flr.PlotVirtual(111-FloorStep,16,ScreenPtr); {a loop, so there!}
Flr.PlotVirtual(127-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(143-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(159-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(175-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(191-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(207-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(223-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(239-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(255-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(271-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(287-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(303-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(319-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(335-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(351-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(367-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(-1-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(15-FloorStep,16,ScreenPtr);
If (Level=2) or (Level=3) then
begin
Flr2.PlotVirtual(31-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(47-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(63-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(79-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(95-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(111-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(127-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(143-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(159-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(175-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(191-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(207-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(223-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(239-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(255-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(271-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(287-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(303-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(319-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(335-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(351-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(367-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(-1-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(15-FloorStep,184,ScreenPtr);
end;
_RangeCheck:=False;
{Disable it again for increse in speed}
end;

 

The scary thing was, on my 386 at 25mhz it was noticeably faster, even without needing to profile to notice! I feel dirty just re-reading it...


Games Currently In Development: Firework Factory | Seven Spells Of Destruction | Latest Journal Entry: Radioactive goop, flashing lights and lots more! (21-Jul-2016)

#124 kalle_h   Members   

2463
Like
1Likes
Like

Posted 25 January 2015 - 05:10 PM

float4 color = u_texture.Load(uv, int2(+0, +0));

This was causing crash bug on intel gpu's on our shipped game. Offsetting by zero isn't that wise thing to do but who would have guessed the implications.



#125 SmkViper   Members   

5396
Like
1Likes
Like

Posted 26 January 2015 - 08:37 AM

I just had to share this from my r-type clone from 1998.
 


Procedure DrawFloor(FloorStep:Integer);
begin
_RangeCheck:=True;
{Enable CJEPROC flag for clipping of sprites}
Flr.PlotVirtual(31-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(47-FloorStep,16,ScreenPtr); {Don't even think of accusing}
Flr.PlotVirtual(63-FloorStep,16,ScreenPtr); {me of being a lazy coder,}
Flr.PlotVirtual(79-FloorStep,16,ScreenPtr); {'coz this chunk of calls is}
Flr.PlotVirtual(95-FloorStep,16,ScreenPtr); {about ten times faster than}
Flr.PlotVirtual(111-FloorStep,16,ScreenPtr); {a loop, so there!}
Flr.PlotVirtual(127-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(143-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(159-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(175-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(191-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(207-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(223-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(239-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(255-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(271-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(287-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(303-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(319-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(335-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(351-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(367-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(-1-FloorStep,16,ScreenPtr);
Flr.PlotVirtual(15-FloorStep,16,ScreenPtr);
If (Level=2) or (Level=3) then
begin
Flr2.PlotVirtual(31-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(47-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(63-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(79-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(95-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(111-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(127-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(143-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(159-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(175-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(191-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(207-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(223-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(239-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(255-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(271-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(287-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(303-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(319-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(335-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(351-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(367-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(-1-FloorStep,184,ScreenPtr);
Flr2.PlotVirtual(15-FloorStep,184,ScreenPtr);
end;
_RangeCheck:=False;
{Disable it again for increse in speed}
end;
 
The scary thing was, on my 386 at 25mhz it was noticeably faster, even without needing to profile to notice! I feel dirty just re-reading it...


This is not entirely surprising, the overhead of incrementing and doing a conditional branch can be significant, and compilers of the time weren't smart enough to do this thing for you. Now days the compilers are smart enough to do this behind the scenes if they think it will actually benefit your code based on various metrics.

#126 AndreTheGiant   Members   

329
Like
6Likes
Like

Posted 23 February 2015 - 08:09 AM

*
POPULAR

The best one from recent memory is this:

 

int seven = 9; // this MUST be 6 to work.



#127 Orymus3   Members   

18728
Like
0Likes
Like

Posted 26 February 2015 - 07:51 PM


int seven = 9; // this MUST be 6 to work.

 

Ouch.


-=- My Articles -=-
Getting Games Done - Method and tools on how to start a hobby project and get it Done!

The Art of Enemy Design in Zelda: A Link to the Past - Reverse-engineering functional enemy design from applied example.

Retro Mortis - "RTS" - Article Series (4 Parts) on the history of RTS development (4th part finally released!!!)