News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Writing clean code tips?  (Read 10679 times)

BRPXQZME

  • Hero Member
  • *****
  • Posts: 4572
  • じー
    • View Profile
    • The BRPXQZME Network
Re: Writing clean code tips?
« Reply #20 on: April 13, 2013, 02:24:23 am »
...
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)

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

InfamousKnight

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
Re: Writing clean code tips?
« Reply #21 on: April 13, 2013, 11:57:25 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?

KC

  • Full Member
  • ***
  • Posts: 209
    • View Profile
Re: Writing clean code tips?
« Reply #22 on: April 13, 2013, 02:58:14 pm »
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.

InfamousKnight

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
Re: Writing clean code tips?
« Reply #23 on: April 13, 2013, 04:03:30 pm »
>.> I understand that.

KaioShin

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 5697
    • View Profile
    • The Romhacking Aerie
Re: Writing clean code tips?
« Reply #24 on: April 13, 2013, 04:21:57 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.

InfamousKnight

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
Re: Writing clean code tips?
« Reply #25 on: April 13, 2013, 04:56:09 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.