learning to code

learning to code

Postby ctdabomb » 02 Mar 2012, 00:23

Does anyone know a good way to learn c++ or Python? I have tried before and failed. :(
Some people are like slinkies... not really good for anything, but you still can't help smiling when you shove them down the stairs.
ctdabomb
 
Posts: 1075
Joined: 13 Dec 2011, 21:21
Location: halfway there

Re: learning to code

Postby Edward_Lii » 02 Mar 2012, 08:59

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. :)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: learning to code

Postby qubodup » 02 Mar 2012, 11:29

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?
User avatar
qubodup
Global Moderator
 
Posts: 1671
Joined: 08 Nov 2009, 22:52
Location: Berlin, Germany

Re: learning to code

Postby Sauer2 » 02 Mar 2012, 17:57

@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.
Last edited by qubodup on 02 Mar 2012, 20:27, edited 1 time in total.
Reason: preventing shitstorm
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Re: learning to code

Postby ctdabomb » 02 Mar 2012, 20:32

okay, thanks for the suggestions. I will try will python first.
Some people are like slinkies... not really good for anything, but you still can't help smiling when you shove them down the stairs.
ctdabomb
 
Posts: 1075
Joined: 13 Dec 2011, 21:21
Location: halfway there

Re: learning to code

Postby Sauer2 » 02 Mar 2012, 20:53

Cool, I'll keep my fingers crossed.
Last edited by qubodup on 03 Mar 2012, 02:11, edited 1 time in total.
Reason: sidediscussion moved to private messaging
User avatar
Sauer2
 
Posts: 430
Joined: 19 Jan 2010, 14:02

Re: learning to code

Postby ctdabomb » 06 Mar 2012, 18:36

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. :(
Some people are like slinkies... not really good for anything, but you still can't help smiling when you shove them down the stairs.
ctdabomb
 
Posts: 1075
Joined: 13 Dec 2011, 21:21
Location: halfway there

Re: learning to code

Postby Edward_Lii » 06 Mar 2012, 18:56

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. ;)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: learning to code

Postby ServalKatze » 06 Mar 2012, 23:00

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/
User avatar
ServalKatze
 
Posts: 17
Joined: 07 Jan 2010, 11:21
Location: Germany

Re: learning to code

Postby xahodo » 27 May 2012, 22:14

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?
xahodo
 
Posts: 61
Joined: 23 Mar 2010, 15:11

Re: learning to code

Postby LordW » 27 Jul 2012, 03:41

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
User avatar
LordW
 
Posts: 9
Joined: 27 Jul 2012, 03:00

Re: learning to code

Postby Jastiv » 06 Sep 2012, 06:38

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.
User avatar
Jastiv
 
Posts: 285
Joined: 14 Mar 2011, 02:18
Location: Unitied States of America - East Coast

Re: learning to code

Postby Evropi » 19 Sep 2012, 13:30

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.
You just wasted 3 seconds of your life reading this.
User avatar
Evropi
 
Posts: 385
Joined: 02 Sep 2012, 16:18

Re: learning to code

Postby semiletov » 01 Oct 2012, 21:58

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.
semiletov
 
Posts: 11
Joined: 26 Sep 2012, 21:36

Re: learning to code

Postby charlie » 02 Oct 2012, 10:52

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
Free Gamer - it's the dogz
Vexi - web UI platform
User avatar
charlie
Global Moderator
 
Posts: 2131
Joined: 02 Dec 2009, 11:56
Location: Manchester, UK

Re: learning to code

Postby ballist1c » 16 Dec 2012, 03:35

Image Joseph "ballist1c" Calabria

Bloodlust // Abuse // Insidious // Longest Yard 2000
User avatar
ballist1c
 
Posts: 449
Joined: 24 Jul 2012, 02:32
Location: Connecticut (USA) [East Coast]

Who is online

Users browsing this forum: No registered users and 1 guest

cron