<Day2> - Programming..

Posted by AkumaXxX (12 posts) - 4 months, 14 days ago

oh C++. Why do you have to be so complicated?

Man.. This DIY style programming studying is really tough. NO. I am not giving up, but I gotta admit that I have felt that I just want to give up all of this.

It's not that there are so many things to learn here. Well, because I know that if you want to learn something, you gotta be patient with it.

The problem with me and C++ is the fact that I keep forgetting the HUMONGOUS AMOUNTS of styles that are involved.. with coding programs.

Now, my goal is to develop an app (preferbly game. mm.. classic RPG/Adventure style) and it just looks like a far way to go.

I just want to say this on here that all the game devs are amazing. No matter how they learnt all that crazy complex codings and sh** but man..

they are good.

Yeah.. I can't believe I'm ranting already on day 2 of my blog on GB but bear with me..

I'm getting there.. I'm getting there.

#1 Posted by AkumaXxX (12 posts) - 4 months, 14 days ago

oh C++. Why do you have to be so complicated?

Man.. This DIY style programming studying is really tough. NO. I am not giving up, but I gotta admit that I have felt that I just want to give up all of this.

It's not that there are so many things to learn here. Well, because I know that if you want to learn something, you gotta be patient with it.

The problem with me and C++ is the fact that I keep forgetting the HUMONGOUS AMOUNTS of styles that are involved.. with coding programs.

Now, my goal is to develop an app (preferbly game. mm.. classic RPG/Adventure style) and it just looks like a far way to go.

I just want to say this on here that all the game devs are amazing. No matter how they learnt all that crazy complex codings and sh** but man..

they are good.

Yeah.. I can't believe I'm ranting already on day 2 of my blog on GB but bear with me..

I'm getting there.. I'm getting there.

#2 Posted by csl316 (4714 posts) - 4 months, 14 days ago

No one can master anything in two days.

#3 Edited by xMEGADETHxSLY (455 posts) - 4 months, 14 days ago

Day, 700. Been writing and building a idea.

progress none

hopefully you get this done, slow and steady wins the race

#4 Posted by 49th (1777 posts) - 4 months, 14 days ago

What a coincidence, I've just been doing a C++ uni project with OpenGL for the past few hours.

I feel like I finally sort of understand what I am doing pretty much, and have vague ideas about how to go about getting it to do what I want (after trial and error of course).

I'd suggest just starting to make simple games - just do it and google concepts and useful pieces of code. I find it way easier to understand when I can see what it is doing.

Even though I don't want to do programming in the future it feels good to understand after struggling for a while.

#5 Posted by EVO (3505 posts) - 4 months, 14 days ago

Touche. I've been trying to wrap my head around C# the past few days.

#6 Edited by M3RPHY (236 posts) - 4 months, 14 days ago

Dude...C++? I admire your tenacity.

To quote Stroustrup (the father of C++, and a generally awesome dude):

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off."

Edit: I generally think it's a bad idea for new programmers to start with C++, unless you are of a particularly masochistic and determined breed (especially when self taught). It's really really easy to get discouraged when you've fought a compiler for weeks just to segfault while drawing a rectangle. Something like C#/XNA or Python/Pygame will allow you to *actually get something up and running* and will let you focus on your program design rather than trying to hunt down an irrelevant compiler error. (Example: When you close your class definition, for the love of god, don't forget a semicolon. Your compiler will try extra hard to fuck you on this and refuse to tell you what's actually wrong).

If you're enjoying yourself, forget everything I just said. C++ amazingly powerful and I love it; I'd just hate to see someone who wants to get into programming throw up double middle fingers and never code again because of a bad C++ experience. If you have any questions, feel free to PM me.

#7 Posted by EXTomar (2128 posts) - 4 months, 14 days ago

If there is "complexity" in C++ it is because the tech it takes to actually run software is complex. In any event, you would not be a "master" of any language binding in two days.

#8 Posted by M3RPHY (236 posts) - 4 months, 14 days ago

@EXTomar said:

If there is "complexity" in C++ it is because the tech it takes to actually run software is complex. In any event, you would not be a "master" of any language binding in two days.

Actually, C++ has been officially acknowledged as being needlessly complex compared to other languages; the issue is with the language itself, rather than just "software is complex", and it's being addressed in the new standard. Nonetheless, I think your overall point stands. Elegant software construction is complex, and it deserves a kind of reverence. One could easily study/work in a particular language (C++ certainly) for a decade and remain an intermediate level coder. That same intermediate coder is also entirely capable of producing functional, working code, but it won't be of the same caliber as a true guru of the language. If you're interested, Code Complete is the undisputed king on this topic.

#9 Posted by bushpusherr (560 posts) - 4 months, 14 days ago

The beauty of programming is exactly how open it is. There may not be any one correct answer to a given problem, which encourages creativity; the kind that offers a tremendous sense of accomplishment when worked through. Keep at it, but be sure to fully understand something before moving on, as a lot of concepts in programming will build off of an assumed knowledge of more basic material.

I often find that a good test of your understanding is to try (or imagine the process of trying) to explain whatever it is you are learning to someone unfamiliar with it. Also, never be afraid to ask for help when having trouble understanding something.

#10 Edited by EXTomar (2128 posts) - 4 months, 14 days ago

Excuse me but that seems like revisionist history at best and flat out wrong at worst. C++ is complex because C is complex. C is complex because assemblers for various hardware platforms where each complex in their own quirky ways. Assemblers for any given CPU were complex only in the sense they were reflections of underlying hardware which were simple but limited in various ways. All of these ripple up to C let alone the object oriented features that went into C++.

Modern software design properly created software and execution platforms on top of that tech to abstract away the complexity but the complexity was never "needless" where in fact it was all necessary.

#11 Edited by M3RPHY (236 posts) - 4 months, 14 days ago

@EXTomar:

For certain applications, C++ is absolutely needlessly complex, especially when you begin to consider the abstractions you're talking about . With C++, don't you think explicit memory management is a pure example of Leaky Abstraction, and consequently, needless complexity - especially in contrast to garbage collected languages like Python or C#? It's unquestionably an implementation detail that can be abstracted away under the majority of circumstances. You are correct, modern software design HAS created platforms on top of tech to abstract away complexity, and on the whole, current interpreted languages/VM languages do a better job than those that compile to native code [C/C++]. Especially for a beginning programmer, period.

"C++ is complex because C is complex." is a gross oversimplification of what C++ actually is. Even ignoring the object orientation of C++, a simple perusal over its error handling will render this point moot, and it most certainly has nothing to do with an assembler. Also, the complexity I referenced earlier in C++11 was local variable type inference, but there are plenty of other examples on that page that needed to be addressed. They also have nothing to do with the underlying hardware you've discussed, and remain general language issues.

#12 Edited by Sisyphean (49 posts) - 4 months, 14 days ago

What kind of learning materials are you using? I've recently become interested in doing some programming myself. There are lots of books out there, and I've been looking for the best ones to suite my needs. Beginning C++ Through Game Programming seems like a fairly decent starting point. It essentially teaches you the absolute basics of C++ from the ground up through programming simple games. Then there's Programming: Principles and Practice Using C++ by Bjarne Stroustrup (the creator of C++). It's a textbook (over 1200 pages) made to teach the general principles of programming, and it uses C++ as its language of choice. It starts out really basic, but it gets fairly advanced later on. Apparently there are several errors in the text (depending on the edition), so it's recommended to keep the author's errata sheet handy. Game Coding Completeis supposed to provide a complete look at how modern games are put together. It's not a "teach you how to program" book, though. You are pretty much expected to have a solid programming foundation.

Anyway, those are some of the more helpful suggestions I've come across.

Edit: Even though I hardly understand much of the details, I found this an enjoyable video: Day 1 Keynote - Bjarne Stroustrup: C++11 Style

#13 Posted by SexyToad (2316 posts) - 4 months, 14 days ago

@AkumaXxX: How are you doing on C++? I mean are you having a difficult time? I've been trying to learn C++myself. I found it gets easer the more you do some codes.

@Sisyphean said:

What kind of learning materials are you using? I've recently become interested in doing some programming myself. There are lots of books out there, and I've been looking for the best ones to suite my needs. Beginning C++ Through Game Programming seems like a fairly decent starting point. It essentially teaches you the absolute basics of C++ from the ground up through programming simple games. Then there's Programming: Principles and Practice Using C++ by Bjarne Stroustrup (the creator of C++). It's a textbook (over 1200 pages) made to teach the general principles of programming, and it uses C++ as its language of choice. It starts out really basic, but it gets fairly advanced later on. Apparently there are several errors in the text (depending on the edition), so it's recommended to keep the author's errata sheet handy. Game Coding Completeis supposed to provide a complete look at how modern games are put together. It's not a "teach you how to program" book, though. You are pretty much expected to have a solid programming foundation.

Anyway, those are some of the more helpful suggestions I've come across.

I would reccomend Beginnng C++ Through Game Programming. That's what I'm using to teach myself. It provides links to download the codes, so you can see how it should look and work.

#14 Posted by TyCobb (994 posts) - 4 months, 14 days ago

May I suggest starting out with simple text based games? If you are 100% sure you want to learn the basics of programming through learning C++, then I would highly recommend starting off small. A text based game will still involve all of the core features to OOP. This will introduce you to C++ without causing you to have a Total Recall moment of your brain melting.

I highly recommend getting the basics down first:

  • Creating and Instantiating classes (not just doing it, but actually understanding what is happening.)
  • Simple Memory Management. C++ will not handle this for you like most modern languages. You need to understand pointers and refs.
  • Simple program flow and condition statements. (If, while, for, etc.)
  • Be able to write code and kind of visualize what it is doing without having to run and debug the program every time you write a single line. I have seen many beginners do this. You should be able to write a lot of code without ever actually running the program. Granted this is something that takes time and comes naturally, but you need to understand what it is you are writing before going too deep into making a game. A game may be the perfect motivation, but start small, otherwise you may just get too frustrated and feel like you wasted your time and didn't learn anything.

With that said, I would highly recommend at least learning C# first. You can learn the basics of OOP a lot quicker and the syntax is a lot simpler to help you learn how to read code faster. Once you get the basics of programming down, it's just a matter of learning the nuances of another language and it isn't just starting at Step 1 again. Now of course, you'll probably still slide back into C++ and it probably will feel like you are starting all over again, but you won't be. Just don't bite off more than you can chew and for the love of God, do not rush.

TLDR: Fucking read it. =)

#15 Posted by Simplexity (1324 posts) - 4 months, 14 days ago

I remember when I decided to try to learn how to program, realized depressingly quickly that I was far too retarded to ever learn it.

I hope you stick with it and succeed though, good luck.

#16 Posted by thatdudeguy (38 posts) - 4 months, 14 days ago

Good luck on the project! And you'll do just fine with C++ as your first language. Many people have. As everyone has pointed out, there are definitely easier languages and game frameworks to learn. But there are only a handful of major hurdles to getting out of the initial frustration zone. Get your prototype:

  • displaying and moving images
  • playing sounds and music
  • accepting user input
  • reading and writing to files

After that, you can learn incrementally what you need at each point. And for C++ there is one book that is worth its weight in gold; Effective C++ by Scott Meyers. It's pretty easily found in PDF form by googling a bit. That book walks through 50 short examples of the right way to do things in C++, and gives you a great tour of the language along the way.

If you're interested in playing with other frameworks, Pygame for Python, Gosu for Ruby, Love for Lua, and Flixel for Flash (using only free Flash tools) are all great, simple frameworks with working examples that you can study and modify. For my hobby game programming, I've switched entirely to Flixel from a handful of custom OpenGL C++ components because I didn't want to deal with the low-level complexity anymore and I like distributing games in the browser. As I make simple 2D games, it was a no-brainer.

In any case, we look forward to hearing more!

#17 Posted by SSully (3792 posts) - 4 months, 14 days ago

@M3RPHY said:

Dude...C++? I admire your tenacity.

To quote Stroustrup (the father of C++, and a generally awesome dude):

"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off."

Edit: I generally think it's a bad idea for new programmers to start with C++, unless you are of a particularly masochistic and determined breed (especially when self taught). It's really really easy to get discouraged when you've fought a compiler for weeks just to segfault while drawing a rectangle. Something like C#/XNA or Python/Pygame will allow you to *actually get something up and running* and will let you focus on your program design rather than trying to hunt down an irrelevant compiler error. (Example: When you close your class definition, for the love of god, don't forget a semicolon. Your compiler will try extra hard to fuck you on this and refuse to tell you what's actually wrong).

If you're enjoying yourself, forget everything I just said. C++ amazingly powerful and I love it; I'd just hate to see someone who wants to get into programming throw up double middle fingers and never code again because of a bad C++ experience. If you have any questions, feel free to PM me.

I back this post 100%. Go learn Pyton or Java as a starter. The amount of free documentation online for both languages makes it almost unnecessary to buy a book. Also both of these languages, especially python, are much simpler, which will get you to start thinking like a programmer in an easier way. C++ is great, but it can make really easy problems stupidly difficult and it makes for a cruel mistress as a beginning language.

#18 Posted by joemarch (25 posts) - 4 months, 14 days ago

@M3RPHY said:

@EXTomar:

For certain applications, C++ is absolutely needlessly complex, especially when you begin to consider the abstractions you're talking about . With C++, don't you think explicit memory management is a pure example of Leaky Abstraction, and consequently, needless complexity - especially in contrast to garbage collected languages like Python or C#? It's unquestionably an implementation detail that can be abstracted away under the majority of circumstances. You are correct, modern software design HAS created platforms on top of tech to abstract away complexity, and on the whole, current interpreted languages/VM languages do a better job than those that compile to native code [C/C++]. Especially for a beginning programmer, period.

"C++ is complex because C is complex." is a gross oversimplification of what C++ actually is. Even ignoring the object orientation of C++, a simple perusal over its error handling will render this point moot, and it most certainly has nothing to do with an assembler. Also, the complexity I referenced earlier in C++11 was local variable type inference, but there are plenty of other examples on that page that needed to be addressed. They also have nothing to do with the underlying hardware you've discussed, and remain general language issues.

The point, at least I think, that you're trying to make here is that C++ has features that should not be used 95% of the time as there are simply easier, less complex and convoluted solutions to most problems. For that reason alone most beginner C++ code is simply C code with class used in place of struct. However, in some cases C++ code needs many of the abstractions and complexities that you mentioned. Example : manual memory management in a text adventure is unnecessary, manual memory management in, say, the megatexture portion if the id Tech 5 code is necessary. Just curious what you mean by better job in regards to interpreted languages.

However, I do fully back the point that you should probably start with a language other than C++ to start, say, Visual Basic because you can get stuff done relatively quickly and removes you from many of the abstractions (*cough cough* OOP) of other languages (Java). It's hard for many of us that have done it to understand, but I remember learning what a class was and sitting at my computer for an hour confused, this stuff is hard and takes time so you might swell get a good grip on the basics first.

#19 Posted by SpikeSpiegel (6816 posts) - 4 months, 14 days ago

What are you using to teach yourself?

Keep working at it! I'm attempting to teach myself some Python before classes start up again. I'm hoping to eventually be able to make an RPG with turn-based combat.

#20 Edited by Rebel_Scum (353 posts) - 4 months, 14 days ago

@AkumaXxX: Have you any experience in coding in other languages before? C++ probably ain't the best starting point and what TyCobb and M3rphy are saying is pretty good advice. Learning to code just games as a starting point isn't really recommended in learning fundamentals.

#21 Posted by TyCobb (994 posts) - 4 months, 14 days ago

@joemarch said:

However, I do fully back the point that you should probably start with a language other than C++ to start, say, Visual Basic because you can get stuff done relatively quickly and removes you from many of the abstractions (*cough cough* OOP) of other languages (Java). It's hard for many of us that have done it to understand, but I remember learning what a class was and sitting at my computer for an hour confused, this stuff is hard and takes time so you might swell get a good grip on the basics first.

I would have agreed on your Visual Basic suggestion was it still 1997, but it is 2013 and there are far better languages to learn how to program in. Visual Basic .NET is a piece of shit compared to old school Visual Basic. It was hacked to shit in order to get it to function with the .NET framework. You can do so many more things in C# with less code because it was built for .NET whereas Visual Basic was purely kept around for... I can't think of any reason considering you can't even port legacy VB apps to it without practically rewriting everything anyway.

I am confused by what you mean by "removes you from many of the abstractions (OOP) of other languages (Java)". Visual Basic is an OOP language; always has been. The .NET version is just as abstracted as before and even more so than legacy VB. I personally despise Java (generics... boy are those practically useless in Java compared to C# 2.0's implementation 8 years ago), but I think it is a great introductory language. At least by sticking with Java or C#, he'll have a lot of C++ syntax down already since they are so similar.

#22 Posted by Phyrlord (143 posts) - 4 months, 13 days ago

Hey if you guys want some real career chances in almost any company or place when your done school or what ever it is you guys are doing. I would say wrap up your C++ days and get Deep into Oracle and SQL databases. Trust me I been working in IT and operations for software company's for years. No matter what one your at, they all have a database and if your the guy who knows the in's and outs, it would be like loosing your right arm without you.

#23 Posted by SpaceKangaroo (113 posts) - 4 months, 13 days ago

I did some C++ game in OpenGL last year for a graphics module, can host the game/source code on some site and link it here if you want.

#24 Edited by M3RPHY (236 posts) - 4 months, 13 days ago

I should make it clear, C++ certainly has its place, and remains a pretty awesome language. C++11 has incorporated a lot of the fixes found in Boost directly into the language. There is a reason it's the de facto standard in professional game development. All I'm really saying is: use the right tool for the right job. Something like Python/C#/Java, even VB.NET (although I wouldn't recommend it, outlined why) is probably a better tool to teach a new programmer than C++. With that said, if you want to learn C++ specifically, I encourage you to do it, and enjoy it! Just take things slow, and have some patience. Programming can be downright maddening, but it's damn fun and rewarding. That's why we all do it :)

#25 Edited by EXTomar (2128 posts) - 4 months, 13 days ago

Again, memory management isn't in C or C++ because hardware doesn't support any more than "allocation" and "free". Should C++ have implied ref style system instead? Maybe but then it would make being compatible with C much more difficult if not impossible in some cases. Do you know why C++ supports multiple inheritance when other languages seem to move away from it? It is because the way linking and binary loading works. Could C++ have enforced a single inheritance instead? Yes but then that would have altered the way the OS loads executable binaries. Java and C# can redefine those rules because they aren't messing with the way the OS loads binaries into memory.

There is also some "grass is greener" going on especially with the example of memory management: Although memory management is a hassle in C/C++, garbage collection is also not efficient. It is great when a language binding can abstract that away from the programmer but all that "fixes" memory leaks and violations but does nothing to address bugs arising from misusing and abusing references. This usually manifests in "assignment vs cloning" where those languages are quite happy with letting you assign when you should be cloning and vice versa. Not to mention does nothing to help when the resource is limited (file handles, db connections, etc) where the programmer is forced to manually manage the resource. But wait, doesn't that mean a programmer is forced to track and manage a resource that looks a bit like memory management? Oh what a cruel world! :)

I'm not saying C or C++ are the "bestest language in the universe" but it gets a bad reputation for erroneous reasons. The "...for some applications X sucks" complaint is meaningless because it is true for all languages. I have extensive experience in C++, Java and Python with some in C# where I have to be frank that none of them really offer a better environment than the other because heinous bugs are still heinous whether or not it flags from a memory violation or an unhandled exception or no errors at all but is happily mutilating the data. For example: The amount of overhead to open a file in C++ is low while the overhead is higher in Java and C# where none of them offer better fault tolerance than the other. There is no compelling reason to suggest one is better or safer than the another let alone which one is the correct way to do it.

Getting back to the topic: What framework is being using to build the game? One thing you should do early is research where figuring out those requirements needs to be done before writing anything for the game. It may turn out there is another framework that is easier to work with some of us can recommend.

#26 Posted by AkumaXxX (12 posts) - 4 months, 13 days ago

thank you guys so much for great comments. I got to find those good books online and order them. So excited to learn more and more everyday! Again, thank you SO MUCH for the recommendations. You are awesome ;)

#27 Posted by M3RPHY (236 posts) - 4 months, 13 days ago

I used one of the older editions of C++ Without Fear when I was just starting out, and really liked it. It's a friendly introduction to the language itself. It doesn't have the gaming context, but it's a great book for someone just starting out. As for frameworks, I've used SFML with C++ before; I personally think it's a little easier to work with than SDL - and it's going to be a lot easier to get something up and running than using raw OpenGL or DirextX, which are both their own unique beasts.

#28 Posted by EkajArmstro (338 posts) - 4 months, 13 days ago

for (int i = 0; i < INT_MAX; i++) {

std::cout << "Good luck!" << std::endl;

}

Please Log In

Use your keyboard!

  • ESC