Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

878861 Posts in 32941 Topics- by 24349 Members - Latest Member: Ozymandias

May 22, 2013, 08:47:52 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Post if you just laughed at your code.
Pages: 1 ... 8 9 [10] 11 12 ... 29
Print
Author Topic: Post if you just laughed at your code.  (Read 36321 times)
Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #135 on: December 10, 2011, 09:54:01 AM »

I think motion_add is a function that takes the result of a number of calculation as parameters and that he used parentheses around them and indented the calculations as line code for readability.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
J. R. Hill
Level 10
*****


The perfect farmer's tan.


View Profile WWW Email
« Reply #136 on: December 10, 2011, 05:21:36 PM »

Every time I get bored programming, I write an obscure function that is completely unnecessary and I always give it a ridiculous name.  E.g.
Quote
protected function yoDawgLetsSetHimUpTheBomb():int
{
   return thisVariableIsTheCapitalBAsInBoyBombMayne;
}

Edit:  Please tell me I'm not the only one who does this.
« Last Edit: December 11, 2011, 09:45:22 PM by J. R. Hill » Logged

InfiniteStateMachine
Level 10
*****



View Profile WWW Email
« Reply #137 on: December 10, 2011, 06:41:10 PM »

urg for some reason I have a weapon factory in my hud namespace. I can't remember when that was supposed to make sense.
Logged

Serapth
Level 2
**


View Profile
« Reply #138 on: December 12, 2011, 08:41:53 AM »

I don't still have the code, and I didn't actually write it, but I recall coming across:



// whatever you do, don't remove this comment.


And the worst part is, if you removed the comment, everything went to hell in a handbasket.  I never did actually hunt down the problem behind this, so no doubt, someone else is going to have inherited the "comment of death" and probably left it in place as well!
Logged
rivon
Level 10
*****



View Profile
« Reply #139 on: December 12, 2011, 03:54:23 PM »

Probably some invisible control character or whitespace thingy...
In the IOCCC compo there was once a submission which was empty but was a fully functional C application (at least that's what I read few days ago).
Logged
eclectocrat
Level 5
*****


Most of your personality is unconscious.


View Profile WWW
« Reply #140 on: December 12, 2011, 10:33:57 PM »

Code:
local tgtx, tgty = action.target:get_location()
local fx, fy = action.actor:get_location()
local x, y = action.target:get_location()

WTF? How tired was I when I wrote that?!  Tired
Logged

I am eclectocrat.
I make Mysterious Castle, a Tactics-Roguelike (TIGSource devlog).
Zack Bell
Level 8
***



View Profile WWW
« Reply #141 on: December 14, 2011, 12:23:00 AM »

I had some functions inside functions, and it was really hard to read what part did what. Then I had an an idea, and this happened:
Code:
        motion_add
        (
            point_direction
            (
                x+(sprite_width/2),
                y+(sprite_width/2),
                other.x+(other.sprite_width/2),
                other.y+(other.sprite_height/2)
            ),
            (other.sprite_width*other.sprite_height*.8)/
            (
                point_distance
                (
                    x+8,
                    y+8,
                    other.x+(other.sprite_width/2),
                    other.y+(other.sprite_height/2)
                )
                *100
            )
        )

At least I can read it now.

Oh gosh, haha. This is great.
Logged
pixhead
Level 4
****


fish_master57@hotmail.com
View Profile Email
« Reply #142 on: December 15, 2011, 02:58:50 PM »

I looked at my old Java project. Not only was is super over engineered, it also had no comments(despite a few here and there).

No wonder it turned into a such a freaking mess  Cheesy
Logged

"Games are made by artists, so to not consider them art is an insult to the artists who work on them." - Some guy on IGN.
Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #143 on: December 15, 2011, 03:38:37 PM »

What good is an architecture if you cant have some abstract factory factories accessed through command visitors that are composed by decorations?
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
Klaim
Level 10
*****



View Profile WWW
« Reply #144 on: December 15, 2011, 03:56:38 PM »

Then let them be generated at compile-time through meta-expressions choosing each possible member functions availability and behaviour depending on your instantiation context.


No wait, that's C++.  Tired
Logged

http://www.klaimsden.net | Game : NetRush | Digital Story-Telling Technologies : Art Of Sequence
J. R. Hill
Level 10
*****


The perfect farmer's tan.


View Profile WWW Email
« Reply #145 on: December 15, 2011, 05:00:53 PM »

Having some trouble getting a sprite to animate.  Source filename is "static.png"   Facepalm

//Actually, it turns out I overrode the entire game's screen refreshing altogether.
« Last Edit: December 15, 2011, 05:43:31 PM by J. R. Hill » Logged

InfiniteStateMachine
Level 10
*****



View Profile WWW Email
« Reply #146 on: December 16, 2011, 01:22:08 AM »

What good is an architecture if you cant have some abstract factory factories accessed through command visitors that are composed by decorations?

I just shot myself in the face
Logged

InfiniteStateMachine
Level 10
*****



View Profile WWW Email
« Reply #147 on: December 16, 2011, 01:24:48 AM »

was just reviewing some old code for an XNA 2D rapid prototyping lib I made a year ago to see if it's viable to release for new students at my college.

The fucking basic sprite class is 5 inheritance levels deep. I don't think I've ever come across the need to use about 3 of the the children in that inheritance chain either.

Anyways if anyone ever needed an example of someone who is too "class happy" I'm happy to share the source  Waaagh!
Logged

Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #148 on: December 16, 2011, 04:53:53 AM »

Tell the to refactor into a Flyweight State and Command class architecture where the MVC graphics layer is Observing the sprites.

</pattern_jokes>
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
DareM
Level 0
***



View Profile WWW Email
« Reply #149 on: December 16, 2011, 05:18:14 AM »

My coding problem would be trying to follow the simple rule : less code is better.

This would make me try to squeeze way too much into a single line, everything in a single file.

You can imagine that more compressed does not necessarily mean less code but it certainly means less readable and less reusable.

I am trying to cure myself of this disease but there's certainly no quick way.
Logged

Altitude0 - Arcade Plane Racing for Windows PC
http://www.altitude0.com
Pages: 1 ... 8 9 [10] 11 12 ... 29
Print
Jump to:  

Theme orange-lt created by panic