Page 1 of 1

learning to code

PostPosted: 02 Mar 2012, 00:23
by ctdabomb
Does anyone know a good way to learn c++ or Python? I have tried before and failed. :(

Re: learning to code

PostPosted: 02 Mar 2012, 08:59
by Edward_Lii
Hello ctdabomb,

ctdabomb {l Wrote}:Does anyone know a good way to learn c++ or Python? I have tried before and failed. :(

The best way to learn is IMHO practicing, practicing and practicing. ;)

Of course you'll have to understand the basics first, although there are a lot of online resource I prefer a book to learn from.
C++ and Python are two different languages and you should focus on one first.
It's a matter of choice, but C++ contains some topics that might be difficult to understand the first time.

Once you've made a choice you should install the needed tools/programs so that you can compile the code (not needed for Python BTW).
Although a complete IDE might make things easier, I'd say start with a text-editor of choice (preferably with syntax highlighting).
That way any compile or syntax errors (and the compiling and/or linking itself) must be done by you and not the IDE giving you a better understanding of how it works.

Start with a Hello World program, then go through the topics about variables, if-else statements, functions, objects, etc...
Once you know the basics you can start writing simple programs (e.g. a program that keeps a TODO list).
There's no need to use third party libraries to make a complete GUI for it, a command line interface is enough. (taskmanager -add "Feed the cat")
Note that it doesn't really matter if you succeed in those small programming exercises, you will always learn something from it.

When you feel confident enough you can start writing your own (small) project or contribute to an other project.
There will however be another obstacle: understanding someone else code.
If it's the library you use for rendering or the source code of the project your contributing to, you'll have to understand how it works or how to use it.
Knowing the syntax of the language and the basics doesn't mean you can read and/or understand every program written in that language.

I think this is enough information to get you started?
Also besides practicing asking questions can really help when your stuck. :)

Re: learning to code

PostPosted: 02 Mar 2012, 11:29
by qubodup
Are you getting stuck and get distracted when you don't manage to achieve something or are you having problems getting started and don't know where to begin?

Step-by-step tutorials in game making might make it easier, for example this video of creating space invaders with pyglet in 40 minute.

There should be quite some tutorial links on our wiki as well, if that helps.

Is the trouble writing the code or something else like managing files, picking an editor, compiling or running the binary or understanding error messages and finding solutions for them?

Re: learning to code

PostPosted: 02 Mar 2012, 17:57
by Sauer2
@cdtabomb:

I would really recommend to stick with Python for the beginning, because as opposed to C++ it is consistent and doesn't have all the old school stuff built in. For example in C++ there are three incompatible ways to clean unused objects off the memory and in Python you don't even need to care about it. Heck, Python even includes some nice Turtle Graphics learning environment, if you demand it. :D

Also, there is not C++, there are several types of C++ styles, which are in use today, mostly mixed together(meaning you have to deal with all of them):
* the old "C with classes style", with C style char strings and alloc/free for example used in Me And My Shadow, to be compatible with SDL, i guess.
* the c++ standard library style: using Classes for pretty much everything, even for iterators.
* the "we use templates and boost as much as we can because it is so mighty" fraction, with mighty as "will compensate something else".

Better, you learn some high level programming languages first, then maybe C, and if you still really feel the urge and want to become a commercial game developer so bad, you may take a look at it. I keep it like with Perl: Beeing able to read it? Close enough. :cool:

I have to admit: This sounds like a bad excuse. But unless you really want to use C++, it's not worth the pain trying.

Re: learning to code

PostPosted: 02 Mar 2012, 20:32
by ctdabomb
okay, thanks for the suggestions. I will try will python first.

Re: learning to code

PostPosted: 02 Mar 2012, 20:53
by Sauer2
Cool, I'll keep my fingers crossed.

Re: learning to code

PostPosted: 06 Mar 2012, 18:36
by ctdabomb
My biggest problem when I was learning before, was that I would get the new thing that the book was teaching, but I couldn't figure out how to use it because I didn't know how to write it. like knowing a language but not knowing how to use the punctuation. :(

Re: learning to code

PostPosted: 06 Mar 2012, 18:56
by Edward_Lii
Hello ctdabomb,

ctdabomb {l Wrote}:My biggest problem when I was learning before, was that I would get the new thing that the book was teaching, but I couldn't figure out how to use it because I didn't know how to write it. like knowing a language but not knowing how to use the punctuation. :(

The book should tell you line for line what that code does, especially in the beginning.
When a new topic is covered, make sure you try out the example code (don't just read it and think you understand, try the code!).
If you get the example running, try to change it slightly (e.g. change the hello world script to greet you)

Experimenting with the code will (hopefully) give you a better understanding what it does and how to use it.
Some books contain exercises at the end of each chapter, for the biggest part the solution is just a modified version of the example code given in that chapter.

Hope this helps. ;)

Re: learning to code

PostPosted: 06 Mar 2012, 23:00
by ServalKatze
I second Edward_Lii's advice. Always experiment with the examples until you really understand it. Then move on. Just don't try to do too much at once... ;)

Not sure which book(s) you're currently using but you may have a look at this one for Python:
http://inventwithpython.com/chapters/

And once you feel comfortable with the language you could try that one:
http://inventwithpython.com/pygame/chapters/

Re: learning to code

PostPosted: 27 May 2012, 22:14
by xahodo
If your target is game development and you need to process lots of data for your game, c++ may be a better option then python.

In that case Thinking in C++ is the book you are looking for. You may want to read "Thinking in C" (same author) before digging into that book, though. Both books have practice questions at the end of each chapter; these questions are a chance to test your knowledge and understanding of the language, they also learn you to code... so do them (if you choose for C++).

Learning to program is a process. You need to understand that programming is a skill which needs time (training) in order to improve. A programming language is just a tool (knowledge).

Perhaps some practical assignments are in order, regardless of language?

Re: learning to code

PostPosted: 27 Jul 2012, 03:41
by LordW
Hello guys! This is my first post :cool:
(sorry for my bad english :eew: )

ctdabomb, I am in the same situation! hehe, I am trying learn how to code, and I have failed a few times too.

This time, I am reading "Programming principles and practice using C++, Bjarne Stroustrup", I don't know if you will like it but I like it a lot. I really recommend to you will give a opportunity to this book.

Another interesting resource what I found is [url="Making Games with Python & Pygame(CC-BY-SA-NC)"]http://inventwithpython.com/makinggames.pdf[/url] but I don't pay much attention to it yet.

I hope this will be useful for you :p

Re: learning to code

PostPosted: 06 Sep 2012, 06:38
by Jastiv
My game, Wograld is written in Java and C, so you won't need those languages to work on it. C++ tends to have some dependency hunts and be platform dependent. The main thing people think about is SDL libraries for graphics in games, but I worry the library developers are going to mess it up. It also has a bunch of object oriented stuff tacked on to the language in a sloppy way. It has neat things like vectors and containers, but plenty of things about it can be hard for a beginner. Python moves to fast and suffers from bit rot. That means if you write something in old python, you may not be able to run it later cause they change it so much. Also, you will not be able to run newer python programs if your version is too old. Python is probably the easier to learn, but actually, I would recommend C for a first language cause you can learn basic concepts without worrying about high level stuff like object oriented just yet. Once you have C down good, I would recommend Java because it is cross platform so your game will already be ported for you.

Re: learning to code

PostPosted: 19 Sep 2012, 13:30
by Evropi
I am only an amateur myself, and though I think I have skill, I don't particularly enjoy programming and don't have any pressing need to make something. I've always wanted to make a game actually, but I have no inspiration whatsoever! The downfall of the artist right there. :)

My advice is to ignore paradigms of structured programming at first and code as you see fit. Try the exercises, every good book has the, and most importantly, code the way you feel like.

If you want to work with a team, you need to learn object-oriented programming or maybe functional programming (though I honestly find it harder than OOP, it's essentially programming for math geniuses). This goes fior both proprietary and open source projects (though you should always work on the latter!). No-one will contribute to your project if you submit crappy code, or likewise, no-one will accept your crappy code into their project.

But my point is that you have to start off small, like you did in school learning maths. Mathematics in education is intentionally taught so not all of the properties of something are not revealed straight off the bat... sometimes going as far as teaching you the wrong way to do things at earlier stages!

You should follow this theory; program however the hell you want, screw the conventions until you can nail down all the concepts of programming. Only after that can you transform the concepts into something truly usable, by learning to write clean and structured code.

Re: learning to code

PostPosted: 01 Oct 2012, 21:58
by semiletov
ctdabomb {l Wrote}:Does anyone know a good way to learn c++ or Python? I have tried before and failed. :(


The best way is to work on a real project. When you know exactly what you want to code, you just learn the language and implement your ideas. The programming language is just a simplified form of your ideas.

Re: learning to code

PostPosted: 02 Oct 2012, 10:52
by charlie
Did you try the pygame tutorials (for python)?

C++ is very hard to pick up, and takes years of learning to become competent. You'll have results much more quickly with something like pygame or love (lua).

http://pygame.org/wiki/tutorials

Re: learning to code

PostPosted: 16 Dec 2012, 03:35
by ballist1c