Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nsutton

macrumors member
Original poster
Dec 29, 2009
92
0
6 Feet Under
I'm 3 weeks into teaching myself python. I started with online tutorials. That gave me a decent grasp to build games and stuff. So far i've made a text based game and now im finishing the ren'py 2d version of it...

My question is, Should i pick up a book on python blaze through it to learn.
or should I attempt bigger game projects and learn by problem solving what i need to know to complete the game?

Thanks
 

Mernak

macrumors 6502
Apr 9, 2006
435
16
Kirkland, WA
If you can keep doing what you want to without a book, then go ahead and do it. But depending on what you want to do, having good reference books can be easier than looking stuff up im(ns)ho. Also there are a lot of cases where figuring stuff out yourself is going to be a lot more difficult (especially when dealing with datatypes, efficiency, and design patterns). But, honestly, if you just want to complete the game, and you have been fine so far, I doubt that you will run into problems.
 

notjustjay

macrumors 603
Sep 19, 2003
6,056
167
Canada, eh?
I think it's going to be a mixture of both. Some things you learn by doing. You will use Google a lot to look up function names. For example, what's the name of the function to get the length of a string? You Google "Python string length" and you've got it.

In that respect you don't really need a book because online searches can help. You just need to figure out what you want to do, and Google for help with the API. No beginner's book can cover everything in the language that you might want to do so you would end up searching online anyway.

"Figuring out what you want to do", as you have no doubt discovered by now, is the real problem. Here's where books can help. You should read about theories, data structures, and techniques, to get you thinking about how to solve the problems you've got. Then it just becomes a matter of implementing the code in whatever language you've chosen.

For example, books about data structures will teach you about queues and stacks and trees and linked lists. How to store lists of things, sort them, how to search for things. Books about software design patterns will help you think about your problems in terms of things like state machines, singletons, and object pools, or help you to avoid mistakes like writing "God Objects" or using "magic numbers". A book about graphics techniques might teach you about double buffering. You might even go so far as to study machine learning techniques, like decision trees and neural networks.

To summarize: To take an algorithm or design you've already got, and turn it into Python code, you can learn by doing and Googling for API syntax. To learn how to better design programs and algorithms, read books.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.