Followers 0

# My programming style

## 43 posts in this topic

No u

https://github.com/id-Software/DOOM-3-BFG/blob/master/neo/framework/Common.cpp

void idCommonLocal::FilterLangList( idStrList* list, idStr lang ) {

idStr temp; // <-- THIS
for( int i = 0; i < list->Num(); i++ ) {
temp = (*list)[i]; // <-- HERE
temp = temp.Right(temp.Length()-strlen("strings/"));
temp = temp.Left(lang.Length());
if(idStr::Icmp(temp, lang) != 0) {
list->RemoveIndex(i);
i--;
}
}
}

Edited by polyfrag
0

##### Share on other sites
9 year old game based on an even older engine code base still - chances are that code existed back in the 90s and hasn't been updated.

So, no, you remain wrong.. but hey, here's an idea, if you don't want to listen to people who know more than you don't start threads like this? Edited by phantom
0

##### Share on other sites

OP, you do realize that you are using code that is almost 20 years to justify your preconceived notions about how code should be? Do you not think that John Carmack's code or software architecture and engineering would have improved in the last 20 years? Do you think he even still uses C, as opposed to C++. When I say C++, I mean C++ 11 (the latest standard). Even if he did use C, he would be using C 99 or 11 (as in 1999 or 2011, respectively, the new standard). In the newest standards of C, you can declare variables wherever you like. Plus the hardware that he worked on is far far different than it is today.

By the way, using globals is tantamount to mentioning Hitler in an internet argument. You've lost :(

In all seriousness, GameTutorials.com is not the place you want to be learning game programming. Like I said before, that site should have died in the 90s.

0

##### Share on other sites

9 year old game based on an even older engine code base still - chances are that code existed back in the 90s and hasn't been updated.

So, no, you remain wrong.. but hey, here's an idea, if you don't want to listen to people who know more than you don't start threads like this?

Well now I know.

By the way, using globals is tantamount to mentioning Hitler in an internet argument. You've lost

So I'm supposed to add an extra argument to every function where I want to use it? I'd have to rewrite all my rendering code to include a reference to the shader in use. There's like 50 functions. Plus I'd have to modify them internally to use that variable.

Edited by polyfrag
0

##### Share on other sites

So I'm supposed to add an extra argument to every function where I want to use it? I'd have to rewrite all my rendering code to include a reference to the shader in use. There's like 50 functions. Plus I'd have to modify them internally to use that variable.

yep.. you really should.

But.. honestly ( and I think the other guys in this thread will agree with me).. I don't give a damn if you do or not... it's your code, your time, your money, your game.

All I can do is provide a feedback to the questionable code you have posted bragging about it. The fact that you did not have a single one positive feedback should suggest you that you are on the wrong side of the road... if you still feel we are stupid and you are the smart one... keep writing crappy code, post it and feel proud about it... be my guest.. it's fun to read for sure.

0

##### Share on other sites

Let's back up for a minute. What is this code for anyway? A game? A map renderer? Something else?

Personal note: did you use this same type of code when you made Pong?

0

##### Share on other sites

It's a game of course. I do have map renderers.

Personal note: did you use this same type of code when you made Pong?

I didn't pick up any of my mentioned habits until 2009.

Edited by polyfrag
0

##### Share on other sites

Personal note: did you use this same type of code when you made Pong?

I was a lot more verbose and didn't use Hungarian notation. I didn't pick up any of my other mentioned habits until 2012.

Edited by Josh Petrie
0

##### Share on other sites

Didn't post to avoid being mean but seeing the turn of this thread, this code (the original post one) in an interview = immediate fail for me, you wouldn't last 1 minute. Even more so if you felt it was good or learn worthy, it's begginer level at best.

0

##### Share on other sites

Didn't post to avoid being mean but seeing the turn of this thread, this code (the original post one) in an interview = immediate fail for me, you wouldn't last 1 minute. Even more so if you felt it was good or learn worthy, it's begginer level at best.

Just to be clear. There's nothing wrong with beginner level code. You just have to acknowledge that's beginner level code and accept that there are better ways to go about writing the code.

0

##### Share on other sites
Well so far I'm the only one posting about *innovations*.
0

##### Share on other sites
Maybe you all see my code as wrong because you were taught a certain way. I'm self-taught. I learned from books. Don't know what current industry standards are.
0

##### Share on other sites
What makes your code so good?
0

##### Share on other sites

Well so far I'm the only one posting about *innovations*.

Maybe you all see my code as wrong because you were taught a certain way. I'm self-taught. I learned from books. Don't know what current industry standards are.

Well those aren't "innovations". Everyone has seen that code hundreds of times in their careers. It's the reason everyone is able to tell you better ways of writing and approaching your code.

Also, a lot (but not all) of the people in this thread have a CS degree and have been in the industry for years. So it's not only about what they were taught. They have years of real world experience of solving complex problems.

And lastly, don't claim ignorance as the reason for obstinately challenging everyone who has posted here. It would be best for you to step back and seriously take what they are saying into consideration.

0

##### Share on other sites

This is what I'm taking in September at BCIT Computer Systems 2 year diploma followed by 2-year Bachelor of Technology with Game Development option http://www.bcit.ca/study/programs/cst http://www.bcit.ca/study/programs/825hbtech Do you think that will be as good as a Bachelor of Computer Science degree from a university? Good enough?

Edited by Josh Petrie
0

##### Share on other sites

dude what's wrong with u? Seriously.. Doom3 was released in 2004!! By a guy famous for being "late to the C++ party".... with a 3 year typical dev time.. the code probably started in 2001... with a lot of cut & paste from older engines.

Do you realize it's 2013 don't you? Compilers are fine, computers are fine.. C++11 is almost a decent language to work with.. optimization techniques do not rely on those stuff anymore.. it's all about memory access and multithread and COMPLEXITY MANAGEMENT.. you are trying to solve problems that dont even exist anymore.

0

##### Share on other sites

I smell hypocrazy. You talk about innovation, and yet you show code from +10 years ago to justify your inferior coding conventions. I'm not sure, something doesn't sound right here... somebody help me out plz?

</irony>

Seriously, even if those out-dated code sources were actually the way to take your coding style from... what would be so special about your coding style then? I mean, why don't I make such a thread, claming to have developed the next best coding convention, by using the "const" keyword to disallow modification of variables in my program. Yeah, totally frigging awesome, nobody would have thought about that. (damn, irony wasn't really off). And if what gets written in such a wasn't so obviously right, but outdated and rather beginner-ish, you should be fully accepting of the fact you are getting criticised and offered constructive help, rather than calling the other, more experienced people wrong.

<general rant>

SERIOUSLY, whats up with people nowadays? Whats so hard at accepting you are wrong? Not aimed at the OP directly, but everybody and their sister tries to justify all their actions up until the end, even if it is obvious they are wrong, bringing the most ludacris excuses / "proofs" they are right. Whats so hard on saying " oh, yeah, I see now, I was wrong, thanks for offering me a better way" ? But, I digress...

Edited by Juliean
0

##### Share on other sites

This topic was of questionable utility to begin with and has degenerated significantly from there, so I'm locking it. I've also restored attempts on the part of some users to sanitize the thread by deleting their posts. Please don't engage in such childish behavior.

Have a nice day.

Edited by Josh Petrie
0

##### Share on other sites
This topic is now closed to further replies.
Followers 0

• 19
• 14
• 23
• 11
• 28