Tuesday, January 3, 2012

A letter to my cousins: A Suggested Route for Learning Python and Game Programming

So a new year, and a new resolution to write some more articles on this blog.  I thought I would start off by sharing a letter I sent off to a few of my middle school grade cousins who approached me about learning to program games over the holiday week.  I'm the first to admit I've never written a game, but I have written a considerable amount of code and am aware that game programming is no small feat of coding.  Without further blabbering this is what I pulled together for them (and a link to a google docs version for easier reading).


                    Hey there cousins :)
So I've been puzzling over the best way to present this information to you and give you some direction in the mean time.  I've pretty much just opted for the stream of consciousness approach (or, type as I think).
First your going to need some tools.
An archive manager, this will let you open files zipped up in zip, rar, or other formats.  I prefer 7zip for windows, you can get it here:  http://downloads.sourceforge.net/sevenzip/7z920.msi
Next you will eventually need a version control package so you may as well get that, for home projects I'd recommend Mercurial: http://tortoisehg.bitbucket.org/ Make sure you are downloading the 32-bit version of the program.  I would also add the command line program from http://mercurial.selenic.com/wiki/, just grab the latest version and install it(32-bit windows).
It's an installer and free, just run it and your in good shape.
Then I would recommend downloading Python(x,y) which is also free like the above two pieces.  The direct link is: http://ftp.ntua.gr/pub/devel/pythonxy/Python(x,y)-2.7.2.1.exe and you can get more information on the package at: http://code.google.com/p/pythonxy/  It's a package for making scientific applications in python, however it has a full editor suite and includes all the base software you will need to get rolling except pygame itself.
Finally you will need pygame, your going to want this link: http://pygame.org/ftp/pygame-1.9.2a0.win32-py2.7.msi The version of python included with Python(x,y) is version 2.7.2 so this will give you the correct version of this library.  For more information and example projects you can find extra information at http://www.pygame.org/news.html this is the main site of the pygame team.  Once you've developed your skill set the 'cookbook' section of this website will prove invaluable as will the tutorials area.
Now the hard part.
Once you've installed all that stuff, you are ready to go but you have a significant number of hills to climb before you are ready to start writing game engines, game content or things of that nature.  However using python these barriers should be less painful than they could be in other languages and systems.
You have a number of things to learn, and the first among them is how to use your tools.  If you've installed python(x,y) successfully you should find a program called 'spyder2' in your program list.  This is an editor you can use to easily edit python with large amounts of feed back on your code.  It's documentation can be found at http://packages.python.org/spyder/ I would recommend reading at least the overview and the editor sections for now.  You'll also need to know how the consoles work but that's more of an experimentation learning experience.
After you have learned how to open and close files in the spyder editing environment you will be ready to start teaching yourself python.  To this end I'm going to direct you to the book 'learn python the hard way'.  This is not fundamentally more difficult than other ways of learning python, however it is a more classical approach that requires you to type in every line of code in every program you make.  Following through the book and completing all the exercises will go a long way towards teaching you both programming and python.  The HTML (web browser) version of the book can be found here http://learnpythonthehardway.org/book/ or you can buy a copy of the epub book (for reading on a kindle) for 2.99 off the top of the website.  Follow through EVERY lesson, and make sure to read diligently (you can however skip exercise 0 as this tells you how to get python, it may be informative however).  I also strongly recommend you make an honest effort to do any of the 'extra credit' pieces at the end of each example.  This will allow you to explore the functionality the book is teaching you before you move on.  If you do not understand a word in the book, you can find it's definition by going to www.google.com and typing 'define: word you don't know'.  By the end of the book you will be able to generate webpages in python, and make small web based python games.  This is a significant step towards where you need to get to.
After you've completed those exercises and spent sometime manipulating them to change their behavior I would recommend the following articles on a number of topics.  I recommend reading each thoroughly and trying to combine them with some of your developed knowledge of python.  These links are just to get you started but they should be good leaping off points to discover which sections of programming you don't just 'get'.  These are areas you should spend more time researching using tools like www.google.com, http://stackexchange.com/ and Wikipedia.
Version Control Basics (how to use mercurial and why): http://hginit.com/01.html  Start here and go thru the examples, they are excellent.
The Python Style Guide:http://en.wikipedia.org/wiki/Python_syntax_and_semantics and http://www.python.org/dev/peps/pep-0008/  Following this will help make sure your code is readable and correctly commented so others can read it as well
Conditional Statements: http://en.wikipedia.org/wiki/Conditional_(programming)
Boolean Algebra and Logic: http://en.wikipedia.org/wiki/Boolean_algebra_(logic)
Big O Notation: http://en.wikipedia.org/wiki/Big_O_notation
Sorting: http://www.codeproject.com/KB/recipes/SortVisualization.aspx  This provides visualizations into a number of different sort algorithms that will be critical to understand.  I recommend looking up the wikipedia page of each sort type and reading through those articles as well.  Wikipedia is invaluable for this sort of things (IE, http://en.wikipedia.org/wiki/Bubble_sort, http://en.wikipedia.org/wiki/Insertion_sort).

Object Oriented Programming and Software Architecture: http://www.codeproject.com/KB/architecture/OOP_Concepts_and_manymore.aspx
Software Design Patterns: http://en.wikipedia.org/wiki/Software_design_pattern and specific patterns implemented in python: http://www.python.org/workshops/1997-10/proceedings/savikko.html
Python too executable conversion: http://www.py2exe.org/  and a basic tutorial in it's use http://www.py2exe.org/index.cgi/Tutorial.  This will let you turn your python program into a .exe file you can send to your friends more easily than teaching them how to use and run python.
And finally you'll want to read a book that covers end to end game design, this will include a large amount of math as well as subjects like animating objects and rendering to the screen.  A highly recommended book based on python is Invent Your Own Games With Python.  It can be read online here http://inventwithpython.com/chapters/ or you can purchase it off of amazon here http://www.amazon.com/gp/product/0982106017?ie=UTF8&tag=playwithpyth-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0982106017.  NOTE: While this book can be used in place of the 'learn python the hard way' book, it will lack some of the substance and fine detail that book discusses in teaching you individual lessons.  All that aside it is however an excellent beginning programming book as well.
I wish you the best of luck learning programming/python/game writing/computers and hope this turns out useful for you,
-Garrett
ps. Don't forget, working together will not double your learning, but it will help you both develop much faster.  Also, you should probably print this so you don't lose it.
So to the community at large:  Is this helpful / the right direction to go?  What would you suggest or change about this to gear it more at the target audience (middle-school boys that know they want to write games but don't yet appreciate the scope of what they are getting into).

Thursday, June 2, 2011

Making a Konica Minolta DI-5510 work in Windows 7 x64

Up until recently I've considered myself relatively lucky on the hardware compatibility front when it came to working with older hardware on newer OS's.  However that ended the other day when I had to get a KM DI-5510 working on a Windows 7 64bit system.  The reason being that the looking for drivers that would appear to be related to the printer will return a bunch of drivers from 2002 to 2004.  This is all well and good if your installing in Windows XP, but hits a very hard fast wall trying to add one of these to a modern computer (and yes, a computer from 2002 is no longer modern).


My Google searches unfortunately didn't yield any real fruit for quite some time while looking for these drivers, other than a bunch of junk listings to some 'free driver download' sites.  I eventually had somewhat of an epiphany while reading the not terribly helpful Windows Vista Drivers list on the KM site.  Specifically the controller drivers weren't following their actual name for driver info.  So, while our local DI-5510 uses a Fiery x3e 7255BW-KM, searching for this will not return anything of meaningful use.  However if you search for 'Pi7200e' you'll find exactly what your looking for.  Namely, you'll find the driver page that actually supports the x3e 7255BW-KM controller, which has drivers for basically anything you could ever want.  And to make things more interesting when these drivers install they do in fact say 'x3e ' despite not being labelled as such anywhere on the individual site you arrive on.


As you may have guessed I'm writing this here so that I don't lose it myself, however I figured I would post it publicly so others can refer to it if need be.  So I hope I save somebody time with this little writeup.


The Blue Pill:
Use this link and you'll find the right driver for your OS in the list somewhere.


The Red Pill:
I'm not sure how KM excuses this abysmal relation system between their products, controllers, the alternate names for these devices and the labeling on the systems.  But the drivers at least do exist, they just take forever to actually find.  In the course of my search I also came across a variety of what appear to be abandon KM web properties with ancient versions of this and similar drivers on them.  They are under the same or similar domains and should probably be cleaned up for the sanity of everyone involved.

Saturday, March 12, 2011

Ravens among Eagles in the BSA

Hopefully Modesitt won't take swiping that too personally (also, you should all read 'Octagonal Raven', it's a great book. Whoever 'you all' actually are.). The following post was inspired by an article I read and was disgusted by over at CNN a fair while back. It wasn't until recently that I decided to spend sometime learning Inkscape enough to actually generate this image however.

Raven Among Eagles Replacement Logo (all rights reserved)


Anyone that's read some of my non technical postings on here will know my sentiments towards homophobics and zealots tends to lean in the 'burn in hell' level of sympathy. What I don't believe I've mentioned before is that I'm also an Eagle Scout. Which of course means I'm a horrible Eagle Scout as I directly fail the tenant to be 'Reverent'. With a mild secondary failing in the 'Cheerful' category since lets face it, I'm cynical, jaded and mildly sardonic. For the curious, both of those appear as requirements in the BSA 'Law' and are reinforced in the oath. I can't argue with the idea that you want all of your scouts to be cheerful, that's a given, a downer is a downer if they are 8 or 28. What I do take issue with is the arrogance of believing that not having a religion or desiring to sleep with men instead of women inherently makes you less good than your counterparts.

To this end I've created the above logo to stand in protest and replacement of the standard Eagle Scout Badge / Logo as represented below.


To some this may be regarded as an offense against the concept of being an Eagle Scout, basing this claim on the argument that to be an Eagle Scout you must fulfill the Oath and Law. Anyone who believes this is missing the point of being an Eagle Scout. I'm unclear if this is different in other regions of the country, but the God requirements in the northeast are given as much reverence in the Law as it is on our money. It's an incidental hold over, not a fundamental requirement for being an exemplary Scout. These holdovers are to be noted for what they are, bygones of an era where America was considerably less diverse. In much the same way as the concept of God in scouts has been dialed out to accommodate non Christian beliefs, it must also dial out to accept the ever changing landscape of the American public.

Being a scout is about community, friendship, social and life skills as well as the basic core values of patriotism and individualism. Being an Eagle Scout is about leading people in such a way that they can learn those afore mentioned skills and traits. These are not traits that are unique or specific only to prescribed sub branches of the American public. If your starting off that education saying a large segment of the modern American public is 'not good enough', your teaching those same scouts a very specific lesson about equality. Namely, that despite our the Declaration of Independence, we are not in fact all equal but some of us are better than others and those others should be marginalized as a threat.

To put it bluntly, this approach is pathetic. The mentality required to take that position is so juvenile that if that is the true goal of scouting these days, I no longer wish to be associated with it. The world is changing and I'd rather be looked upon as a Raven than an Eagle if the Eagle is going to be used to represent homophobia, religious bigotry and fear. To the Council in charge of the BSA, you are cowards that use your position to marginalize those you are afraid of.

- A Raven Among Eagles

PS. For anyone who wants to pick a passive aggressive fight on the topic, I've made a CafePress shop. It includes the original image as well as a 'Reverent' and 'Morally Straight' subset for those that wish to take that extra leap. Personally I find the water-bottles the most appealing and appropriate form for this protest to take.