The Daily Click ::. Forums ::. General Chat ::. "Proper" coding
 

Post Reply  Post Oekaki 
 

Posted By Message

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
24th December, 2008 at 16:26:30 -

So, just wondering.. how many of you guys actually use "proper" techniques? You know, stuff like commenting, writing pseudocode, that sort of thing.

I learned pseudocode back from my first days programming. It seemed pretty useless, more of a newbie-ish thing to train you to program. Now that I'm doing more advanced stuff, I think it looks more like that thing with arithmetic in school where they make you write long additions when using a many digit number. Sure, it's pretty worthless early on, but later, it's just confusing to do so much of it in my head.

IMHO, flowcharts are a waste of time, though. Only once in a while for hugely complex code, but I'd suggest it for people who are new to programming who are doing something above what they're familiar with.

Comments.. now I'd encourage you to toss them in every few lines. It really helps a lot in the future. I occasionally forget to put in comments after coding too fast, but I always go back and write them. Heck, basic 2 word ones will do, even abbreviations. It helps find things in long code and lets you understand it at glance. And color-coding buggy code also helps a lot.

So, am I really the only one doing this, or do other people do it more than me?

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th December, 2008 at 16:31:32 -

I didn't start grouping events until a good while after I started clicking, which not only helps with organization, but is necessary for some systems to work. I still don't comment often-- just when I need to keep track of what a value is (e.g. Value A = whether or not objects has been selected) so that I don't accidentally use the same value twice. And sometimes, when I have a chunk of code that looks complicated, but is really just a huge set of objects coded in a similar way, I leave a comment to tell what it does in short. That way I don't get confused or overwhelmed later.

I honestly don't know how you pseudocode in MMF. O_o I thought MMF was pseudocode. In fact, I'm not even sure what pseudocode really is. >_O I thought it was writing code in words that are easier to understand than full-fledged code.

Oh, and yea. I think flowcharts are a waste of time and brainpower. When I had to make one in Game Dev class, I just slapped one together in MSPaint to make the teacher happy. UTTER waste of time.

Edited by OMC

 

  		
  		

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
24th December, 2008 at 17:02:38 -

Heh, ever seen an event with 3 conditions taking up 8 lines in the expression editor? Or one in the event list with 20+ actions? Those things look like this:
http://i262.photobucket.com/albums/ii89/smuz86/tgproblem2.gif

Note that you still can't scroll up on 75% zoom. The actions aren't simply fake example copies; they just haven't been changed from the paste yet at the time I got tired and decided to take a screenshot.

That's when you need pseudocode

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th December, 2008 at 17:17:10 -

O_________________O Yeah, that's complex. I would undoubtedly make one error that would throw the whole thing off. Expression editor strings are hard not to ruin.

 

  		
  		

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
24th December, 2008 at 17:45:50 -

I used to not comment (KnP) then eventually got into the practice after making something one night (very very late) then not understanding what it did in the morning. I did that quite a bit. Now I have groups of just comments with update logs, ideas, formulas, story, etc.

 
Craps, I'm an old man!

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14562

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
24th December, 2008 at 17:59:41 -

I do comment but i also use a pieces of text to seperate groups of events that are within the same MMF group.

I never use flowcharts of pseudo code, IMO thats pretty pointless unless you're trying to sell your idea to someone to get them on board for a team project. All in all I would rather be doing something creative than paper work.

 
.

Bibin

At least 9001

Registered
  01/07/2005
Points
  308

Silver Cup WinnerGOTW Winner!Has Donated, Thank You!VIP Member
24th December, 2008 at 20:59:29 -

I use comments in things that get quite complex. La Bola had some crazy stuff going on to get it to fit within 20 events.

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
27th December, 2008 at 03:16:36 -

Recently, I'm finding it a lot easier to sketch through the code on paper, then put it in a more proper form in a comment. It's easier to cross out a few lines and rewrite them on paper, but messier But on paper, it's much easier to read something like
X/Y + A/B


Edited by Muz

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14562

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
27th December, 2008 at 04:09:49 -


Originally Posted by Muz
But on paper, it's much easier to read something like
X/Y + A/B



Not if your handwriting is as bad as mine.

 
.

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
27th December, 2008 at 05:13:10 -

I have recorded my voice before. In stead of commenting. Than kept the sound file in the same folder as the game.

Edited by Pan-tosser

 
https://www.facebook.com/nathon.brown.7

RedEnchilada

formerly RedEchidna

Registered
  01/08/2008
Points
  301

VIP MemberWii OwnerThe Cake is a LiePicture Me This Round 24 Winner!
27th December, 2008 at 14:39:55 -

I tend to use event groups unless I'm making a really simple game, myself. As far as comments go, though, I don't use them a lot unless I'm making a tutorial.

Also, what is psuedocode?

 
http://www.youtube.com/watch?v=WYrSD35vHo4
woooooooooooooooooaah maaaaaaaaaaaaaaaaaaaaan

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
1st January, 2009 at 08:22:45 -

This is psuedocode:
http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html

It's something like a middle point between real coding and comments. Helps a lot, depending on how complicated the code is, but for really simple games, it just gets in the way

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
1st January, 2009 at 15:31:16 -

I sometimes use psuedocode when programming some sort of complex engine. As for grouping and commenting, I do that all the time. I even color-code my comments.

Sometimes I like to use fastloops to perform function calls too.

As for 8-line bits of code in the expression editor, I either macro recurring long bits of the code or break it up into separate actions to make it more readable. I did this in the archery physics engine I published here recently, using a "coeff" alterable value to store the value of a complex radical.

Unless I've got a markerboard with a lot of space to work with, I wouldn't make a flowchart. When I do real programming, though, I sometimes make relational flowcharts to clarify IS-A and HAS-A or USES relationships.

Edited by Cazra

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
12th February, 2009 at 09:31:37 -

Sometimes I comment things, sometimes I don't, but I almost always put at least a few things into groups now.

I used to never comment anything and most the time not group. I regret not commenting my "Elf beatemup movement", because now when I look at the code, I don't understand what's going on. Haven't looked at the code in awhile, but I bet it's still confusing.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
12th February, 2009 at 12:50:41 -

I use groups extensively, which helps avoid commenting since commenting in the list editor i've found is frustratingly buggy (e.g. new comments often show up about 3px tall and you have to resize them).

I've found that the more detailed groups you have, the less comments you need and the more structured your code becomes. Sometimes I actually have only 2 lines of code in a whole group by itself. So for instance, Geronimo's player movement uses these groups:

Player Movement

Motion Variables
Left/Right
Gravity
Jump
Move
Initialise Move Safely
Safety Loop
Test and Cap Inertia
Standing on Floor
Obstacle at Top?
Obstacle at Left?
Obstacle at Right?
Animation
Stopped
Walking
Jumping
Falling
Throwing
Hurt
Player Dies
Jump Attack
Throw Stones Attack
Throw Stones - Apply Velocity


As you can imagine, with that many groups, the need to comment code is minimal.

You can also tuck most of the code away, and see how it's working just from the group names. So in the case of the movement part, I can tell just from the group names that:

1. Motion variables are read from the keyboard input (move left/right, jump, etc) and applied to his internal inertia.
2. Move Safety is initialised (in such a way that it can be recycled and used by other objects later without conflict)
3. The safety loop is run to test for collisions and push out.
4. Tests are run to determine if the player is now next to a wall above, below, left or right, and in any of these cases his inertia in that direction is cancelled (so his gravity doesn't keep building up while he's standing on the floor).

And that's it, that's how his movement works. I actually had almost no recollection of how his movement worked before this, since I hadn't touched it in months. But just reading the group headings reminded me of the whole process

So it's worth doing. I usually don't do pseudocode though. I'll only bother with pseudocode for expressions (and then it's more like algebra, hence why I built Expression Editor Plus). Flowcharts I'll use for diagrams of an application (e.g. you press this option, go to that screen, press that option, go to that screen, etc).

Now how long is it till James strides in and shows us how many groups are in Tormishire?

 
191 / 9999 * 7 + 191 * 7

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2976

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
12th February, 2009 at 12:51:30 -

I comment as much as I can, cause I know that if I don't it'll come back and bite me in the ass later.

I also usually write pseudocode when attempting something new, like a new complex system or the ilk.

I'm not that good at flowcharts though, but they are a huge asset, especially if you take a break from the game. A flowchart can be easier to read than trying to interpret the event editor.

It's usually a truth, that the more work spent outside MMF, the easier the workflow inside MMF.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

ben mercer

Possibly Insane

Registered
  11/07/2004
Points
  2538
13th February, 2009 at 01:27:48 -

Flowcharts can be AWESOMELY useful, especially with AI... I should really use them more.

 
Stuckboy

JC Denton: "I know your UNATCO killphrase: Laputan Machine."
Gunther Hermann: "I - am - not - a - machi --"
JC Denton: "Sticks and stones..."

Deleted User
13th February, 2009 at 02:16:35 -


Originally Posted by DeadmanDines
I use groups extensively, which helps avoid commenting since commenting in the list editor i've found is frustratingly buggy (e.g. new comments often show up about 3px tall and you have to resize them).

I've found that the more detailed groups you have, the less comments you need and the more structured your code becomes. Sometimes I actually have only 2 lines of code in a whole group by itself. So for instance, Geronimo's player movement uses these groups:

Player Movement

Motion Variables
Left/Right
Gravity
Jump
Move
Initialise Move Safely
Safety Loop
Test and Cap Inertia
Standing on Floor
Obstacle at Top?
Obstacle at Left?
Obstacle at Right?
Animation
Stopped
Walking
Jumping
Falling
Throwing
Hurt
Player Dies
Jump Attack
Throw Stones Attack
Throw Stones - Apply Velocity


As you can imagine, with that many groups, the need to comment code is minimal.

You can also tuck most of the code away, and see how it's working just from the group names. So in the case of the movement part, I can tell just from the group names that:

1. Motion variables are read from the keyboard input (move left/right, jump, etc) and applied to his internal inertia.
2. Move Safety is initialised (in such a way that it can be recycled and used by other objects later without conflict)
3. The safety loop is run to test for collisions and push out.
4. Tests are run to determine if the player is now next to a wall above, below, left or right, and in any of these cases his inertia in that direction is cancelled (so his gravity doesn't keep building up while he's standing on the floor).

And that's it, that's how his movement works. I actually had almost no recollection of how his movement worked before this, since I hadn't touched it in months. But just reading the group headings reminded me of the whole process

So it's worth doing. I usually don't do pseudocode though. I'll only bother with pseudocode for expressions (and then it's more like algebra, hence why I built Expression Editor Plus). Flowcharts I'll use for diagrams of an application (e.g. you press this option, go to that screen, press that option, go to that screen, etc).

Now how long is it till James strides in and shows us how many groups are in Tormishire?



You know, it's funny, but I only started commenting because people were always raving about it. But you know what, when I started commenting, I never finished anything, or became remotely close. I've actually been coding just like you stated here and it works so much nicer, and I usually never comment unless it has something I need to go back to, like inserting variables I haven't fully planned trough, or just temporary debug get this crap to work code. If I were to go back and comment my current project now, it would be a complete waste of time, and would problably take a week or so to do.

Psudocode is good, but unless you fully understand the language your programing in, then you might as well skip it. Flowcharts in my opinion are on the same level as psudocode, it's whichever one you're comfortable with. When I was in school, the logic and design teacher swore by em, thus, that's the system in which he impressed upon us.

 
   

Post Reply



 



Advertisement

Worth A Click