11 March 2016 - Forum Rules

Main Menu

Writing clean code tips?

Started by InfamousKnight, April 09, 2013, 10:02:50 PM

Previous topic - Next topic


Quote from: furrykef on April 12, 2013, 10:24:35 PM
GUIs aren't graphics, though. Graphics is not so bad. Interactive graphics, still not so bad. GUI code, on the other hand, is the work of madmen.

The point is more about game state and thinking in terms of frames per second. The sooner you get out of console turn-based mode, the sooner you understand the relationships between game state and time, which is a good thing for learning to program games better, which I understand to be IK's goal here? It doesn't matter so much if the game is turn based.

(inb4 curses and aalib... yes, I know curses, that's how I pulled off my "pong on a Cray" stunt in high school. It is sufficiently close to graphics/GUI to not be part of what I mean by "console based" in the above paragraph)

Quote from: Bregalad on April 11, 2013, 05:41:21 AM
I think the << surcharge for cout is dumb as this has no relationship with the original intent of << (left shifting). But I can't blame people that use this sine it appears to be a standard convention in C++ to call the overloaded << operator on strings instead to call a printf function.
For years I would prefer printf to cout, even in C++, because it would add a nasty number of kilobytes to the executables, a good way to make sure beginner code takes longer to load off the disk than it takes to run ;)
we are in a horrible and deadly danger


Quote from: Klarth on April 13, 2013, 01:01:24 AM
I suggest for Infamous to start reading books and source code from others so he can gain a better sense of how to organize his code.  Also, start using multiple source files.

I have done that in the past. My first little turn based RPG was really basic. You had a one on one battle and the fights were really boring so I moved on to something harder. And that was this turn based system that allowed as many people on the field you like. Now that card game I created some time ago I got the idea of using multiple struct arrays for teams which really made me feel good about programming. I love it how I have my storage for my enemies. I should make an allies struct too and just have that players struct as the field.

Just to let you know, I abandoned the triple triad project. I made it to the logic part and was having a hard time. I could have read that DS source code and found the logic but I had better things to do. And writing multiple source codes, I would have to read up on that. I've seen people do it. And they make some decent games. And about the GUIs, they're just tedious. Not really hard.

This should be a big discussion for those users who are in the same state as me.

I have a question about the rules, it says on it that you can't do necromancy on topics. Could the OP resurrect the topic?


The error you keep making is that you overestimate your skill and the complexity of the code you wrote so far. And as long as you don't change that attitude, this discussion will get nowhere as you refuse to accept the feedback you get.
Any decent programmer could write the programs you showed here in less than an hour, and certainly better. That may sound harsh to you, but if you can't accept that, then you don't need to ask for feedback and are just wasting everyone's time. We already had this in each of your threads.



Quote from: InfamousKnight on April 13, 2013, 04:03:30 PM
>.> I understand that.

Doesn't seem that way when there is a new topic by you every week with the same issues and the same mistakes and the same poorly thought out opinions.
All my posts are merely personal opinions and not statements of fact, even if they are not explicitly prefixed by "In my opinion", "IMO", "I believe", or similar modifiers. By reading this disclaimer you agree to reply in spirit of these conditions.


Quote from: KaioShin on April 13, 2013, 04:21:57 PM
Doesn't seem that way when there is a new topic by you every week with the same issues and the same mistakes and the same poorly thought out opinions.

That game is just an example of poor code. And the codes somewhat dirty. I just felt really accomplished when I first made it.