0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Real Programmers...
[Re: Captain_Kiyaku]
#318073
04/04/10 20:16
04/04/10 20:16
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
HeelX is right. The code should also speak for itself. Otherwise it is too complicatedly written. No need to comment what function PLAYER_GetName() does.
Last edited by Joozey; 04/04/10 20:18.
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
Re: Real Programmers...
[Re: TWO]
#318669
04/09/10 04:56
04/09/10 04:56
|
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B
Expert
|
Expert
Joined: Feb 2006
Posts: 2,185
|
I agree with HeelX, I generally don't comment most of my code. I'm anal about the design of my code, I like to make it look pretty and it needs all of the indentions to be correct or else you can't tell where each thing begins and ends, but I also use variables and functions that are easy to read. I don't ALWAYS comment, but I might every once in a while. Here's a random code example from Kino One:
function skinchange()
{
var hp;
var newhp;
while(me)
{
newhp = my.health;
if (newhp < hp)
{
my.skin = ent_skins(me);
wait(1);
my.skin = 1;
}
hp = my.health;
wait(2);
}
}
You might not understand exactly what the code is for at first glance, but you do understand what it does. The code reads: "check the enemy's health, if the enemy's health is lower now than it was two frames ago, change the enemy's skin to his last one". At very first glance it doesn't look that way, but because of the name of the function and variables you can tell what the variables hold and what the function is supposed to do. The code is used for flashing enemy models to their last skin which is a "white" skin used to achieve a "flashing" effect when an enemy is damaged. My big problem is though, because of my lack of commenting a lot of times when you look at some functions you can't really tell what the variables are for, but I generally do that after working on a game for a while, and for prototyping, but when prototypes make it in the final game then the variables might be the same. It does make some things confusing, but for most global variables I TRY (don't always do) to make the variables understandable.
Last edited by mpdeveloper_B; 04/09/10 05:03.
- aka Manslayer101
|
|
|
|