Game programming witth python

393 62 1
Game programming witth python

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] • Table of Contents Game Programming with Python, Lua, and Ruby By Tom Gutschmidt Publisher: Premier Press Pub Date: 2003 ISBN: 1-59200-079-7 Pages: 472 Get ready to dive headfirst into the world of programming! "Game Programming with Python, Lua, and Ruby" offers an in-depth look at these three flexible languages as they relate to creating games No matter what your skill level as a programmer, this book provides the guidance you need Each language is covered in its own sectionyou'll begin with the basics of syntax and style and then move on to more advanced topics Follow along with each language or jump right to a specific section! Similar features in Python, Lua, and Rubyincluding functions, string handling, data types, commenting, and arrays and stringsare examined Learn how each language is used in popular game engines and projects, and jumpstart your programming expertise as you develop skills you'll use again and again! Features The three scripting languages are all discussed separately, each with their own section A great tool for learning high-level languages Suitable for beginners, game developers, or programmers Comes with finished and tested open source game code and scripts [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Game Programming with Python, Lua, and Ruby By Tom Gutschmidt Publisher: Premier Press Pub Date: 2003 ISBN: 1-59200-079-7 Pages: 472 • Table of Contents Dedication Acknowledgments About the Author Letter from the Series Editor Introduction What's in This Book? Why Learn Another Language? What's on the CD-ROM? Part ONE: Introducing High-Level Languages Chapter High-Level Language Overview High-Level Language Roots How Programming Languages Work Low-Level Languages Today's High-Level Languages The Pros of High-Level Languages Cons of High-Level Languages A Brief History of Structured Programming Introducing Python Introducing Lua Introducing Ruby Summary Questions and Answers Exercises Chapter Python, Lua, and Ruby Language Features Syntactical Similarities of Python, Lua, and Ruby Hello World Samples Summary Questions and Answers Exercises Part TWO: Programming with Python Chapter Getting Started with Python Python Executables Python Debuggers Python Language Structure Creating a Simple User Interface in Python A Simple GUI with Tkinter Memory, Performance, and Speed Summary This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Questions and Answers Exercises Chapter Getting Specific with Python Games The Pygame Library Python Graphics Sound in Python Networking in Python Putting It All Together Summary Questions and Answers Exercises Chapter The Python Game Community Engines Graphics Commercial Games Beyond Python Summary Question and Answer Exercises Part THREE: Programming with Lua Chapter Programming with Lua Lua Executables and Debuggers Language Structure Memory, Performance, and Speed Summary Questions and Answers Exercises Chapter Getting Specific with Games in Lua LuaSDL Gravity: A Lua SDL Game The Lua C API Summary Questions and Answers Exercises Chapter The Lua Game Community Game Engines Graphics The Games Themselves Beyond Lua Summary Exercises Part FOUR: Programming with Ruby Chapter Getting Started with Ruby Debuggers Language Structure Memory, Performance, and Speed Summary Questions and Answers Exercises Chapter 10 Getting Started with Ruby Games FXRuby Ruby and OpenGL Ruby and SDL This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Ruby and SDL Summary Questions and Answers Exercises Chapter 11 The Ruby Game Community Ruby and Game Engines Ruby and Graphics Ruby and Games Beyond Ruby Summary Questions and Answers Exercises Part FIVE: The Wrap Up Chapter 12 Using Python, Ruby and Lua in Development High-Level Languages in the Development Cycle Extending Python, Lua, and Ruby Python versus Lua Versus Ruby Summary Exercises Appendix A History of Computer Programming Appendix B Meet the Family ABC Ada AFNOR C C++ Cobol Eiffel FORTRAN GNU Octave Java Icon Modula Pascal Perl PHP Prolog PureBasic Smalltalk Squeak [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Dedication This book is dedicated to Hailey and Sidney, the two biggest game players in our household [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Acknowledgments I would like to thank, in no specific order, the following individuals:André LaMothe and the staff at Premier Pressespecially my editors Emi Smith, Mitzi Koontz, and Estelle Manticas I would also like to thank my past editors Todd Johnson and Kieron Murphy I want to thank my parents, Katherine and James, for being so supportive over the years Thanks also to my sister Tanya and her husband David, as well as to the rest of my immediate familyAlex, Raleigh, Steve, Stephanie, May Lou, Dodie, Dick, Bobbie, and Sophiefor their encouragement I want to especially thank my loving and wonderful wife Susan for putting up with my writing mood swings and geek chattering, and for being so kind when I was slumped over a desk for months in a dark office, furiously typing and staring into the cold blue monitor Next year I'll try getting some sun [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] About the Author Thomas Gutschmidt has been professionally involved in the computer industry for the past seven years and currently works for a large software company headquartered in Redmond, Washington He has been a freelance author and writer for three years and has been involved in several open source game projects and module development projects He currently lives in the Northwest with his wonderful wife, Susan, their four cats, two rats, several goldfish, and the occasional urban wildlife refugee [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Letter from the Series Editor Game development has reached a fever pitch in the past couple of years photorealistic rendering, advanced physics modeling, a million-plus polygon worldsand multiprocessor consoles and PCs are powering the revolution At the same time, experimentation with scripting languages to help control the high-level aspects of games has gone from a convenience to an absolute necessity No longer can game programmers think of something as absurd as writing a game in C/C++ Game engines may be written in C/C++, but gamesno longer Today's state-of-the-art games are controlled almost exclusively with scripting languages In the past, scripting languages were custom-made or derivative works made up of the C/C++ compiler and creative use of the pre-processor Times have changed, and today developers are faced with a number of potential scripting languages to use in their games Notable players are Python, Lua, and Ruby Each of these languages has advantages and disadvantages, but any of them can the job Game Programming with Python, Lua, and Ruby takes you on a tour and tutorial of each language, highlighting its strengths and weaknesses and offering you detailed examples of getting each language up and running and interfaced to your game and host languages, such as C/C++ With Game Programming with Python, Lua, and Ruby, you won't spend a lot of time learning irrelevant materialinstead, you'll get just the information you need Tom Gutschmidt delivers a non-biased view of each language and gets you up and running as soon as possible in each of the most popular scripting languages todayPython, Lua, and Ruby Sincerely, André LaMothe Series Editor [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Introduction This book is unusual because it covers game programming in three different scripting languages in three separate sections Python, Lua, and Ruby are wonderful languages used all over the world to build efficient, flexible, scalable, and well-integrated programs and systems For the same reasons that these languages have been great choices for other projects, Python, Lua, and Ruby also are great for making games This discovery, in fact, was made over a decade ago Chances are you've played a computer game that utilized one of these languages during development You may be currently working through game levels that were designed with Lua, or playing on a graphics engine prototyped in Python, or using an Internet ladder developed with Ruby [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] What's in This Book? This book is written for programmers of all skill levels Some readers will want to jump immediately to a specific section, while others will want to read the book in a linear fashion To make it easy, each language section starts with a chapter of introduction that covers the basics of syntax and style and then follows up with chapters in which I'll go into more depth Each language is presented in a similar way, so that it is easy to skip around and hit the sections in the book that interest you most Part One is an introduction to high-level languages It outlines the features of high-level languages, summarizes their history, and touches on game shops and projects that use them This part also covers specific similarities of Python, Lua, and Ruby syntax and discusses features like common functions, string handling, data types, comments, and arrays and lists Parts Two, Three, and Four jump into the languages themselves, first with a speedy overview and quick tour, then with specific multimedia libraries, common commands, and the scripting of a few games The parts wrap up with a discussion of a few of the popular game engines, projects, and industry examples Part Two belongs to Python, Part Three is Lua's, and Part Four covers Ruby Part Five focuses on extending game programming into even more languagesa powerful ability each of these languages shareand then wraps up the book with how high-level languages fit into the development cycle [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Cobol Cobol is short for Common Business Oriented Languages Cobol goes way back to the 1950s and is considered one of the old timers (with FORTRAN being its father) Cobol's focus was, of course, business applications that ran on large computers Back in the 1950s Cobol wasn't really considered high-level, it was considered wordy The wordiness makes it easy to follow the business jargon, but it also requires a lot more typing than other languages [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Eiffel Released by Bertrand Meyer in 1986 Eiffel is considered an object-oriented language, has automatic garbage collection, and possesses interfaces to routines written in other languages It is implemented as a C preprocessor [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] FORTRAN FOTRAN is an acronym for FORmula TRANslator It is probably the oldest high-level language, originally designed at IBM by John Backus in the late 1950s The language has branched into several different versions, many of which are still in use today FORTRAN's niche is mathematical computations, and it is most commonly used in universities [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] GNU Octave Used for numerical computations, GNU Octave has lots of tools for common math and algebra functions and tasks GNU Octave is customizable, can run via command line or through batch, and can dynamically load up FORTRAN or C for other tasks GNU Octave is distributed under the GNU General Public License published by the Free Software Foundation [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Java Originally developed by Sun Microsystems for set-top boxes and handheld devices in an incarnation known as Oak, Java moved to the World Wide Web in 1995 and took off because it was multi-platform Java is similar to C++ but was designed with OOP and security in mind from the ground up, and efforts were made in its structure to remove features that caused common errors and bugs (like pointers and garbage collection) [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Icon Icon is another high-level language used often in research and text processing Icon was developed at the University of Arizona and is loosely based on Bell Lab's Snobol [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Modula Short for MODUlar LAnguage, Modula precedes Modula-2, developed as a system language for the Lilith workstation The central concept behind Modula is the modulea programming construct that can be used to encapsulate a set of related subprograms and data structures Modules are also restricted in their visibility from other portions of the program Modula-2 precedes Modula-2+ and Modula-3 [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Pascal Pascal was developed in the late 1960s by Niklaus Wirth and was named after Blaise Pascal, who was a 17thcentury French mathematician who constructed early adding machines In addition to being high-level, Pascal is also a structured programming language, which forces design into its very nature Pascal is often used as a teaching tool because of its regimented structure [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Perl Short for Practical Extraction and Report Language, Perl was released in 1987 by Larry Wall, who developed the language while working for the National Security Agency Larry wanted his language to be based on common sense programming techniques and wanted applications developed with Perl to be quickly and easily written Perl was built originally as a simple language to scan text files, extract information from those files, and print reports based on that information It has blossomed into a full programming language with hundreds of supplemental libraries Perl is easy to learn and is commonly found on the Internet, used in conjunction with CGI and HTML [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] PHP PHP is a domain-specific language for Web server-side scripting PHP embeds itself into HTML to create dynamic Web pages The language has a syntax similar to Perl's or C's and is comparable to CGI; its primary strength is in database access PHP was originally developed in 1994 but has gone through at least one major rewrite and has had many contributors [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Prolog Short for PROgramming LOGic, Prolog is a high-level language based on the discipline of traditional logic While most computer languages perform a sequence of commands, Prolog has an entirely different approach Prolog first creates definitions and assumptions and then uses them to solve logic problems For Prolog, a program is just a list of facts and rules Prolog is most often found in AI experiments and expert systems (programs that function like human experts) [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] PureBasic A high-level language based on BASIC, a revival of sorts that focuses on keeping programming linear and simple PureBasic is a good learning tool with a few games under its belt, including Bricklinerby Wegroup, Krakout Unlimited(a remake of the Commodore 64 game Krakout), and a few titles by Reelmedia [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Smalltalk Smalltalk was created by Software Concepts Group (i.e.Xerox) in a development led by Alan Kay in the early 1970s Smalltalk took the concepts of class and message from Simula-67 and made them pervasive, basically creating the quintessential object-oriented language Early versions were Smalltalk-72, Smalltalk-74, and Smalltalk76; now we're on Smalltalk-80 [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com [ LiB ] Squeak Disney and Paul Allen's Interval Research Lab helped develop the open source Squeak language Squeak has three environments: one for young children, one for middle school through adult age, and one for experts who are into "deep computing." [ LiB ] This document is created with a trial version of CHM2PDF Pilot http://www.colorpilot.com Before you start This file is not for reading, but just for acquaintance with the book you are going to buy Do not ruin your eyes reading it from a monitor or pda Just decide is the book worth your money Buy hardcovered books, support authors and publishers Like the book? Buy it! ... Specific with Python Games The Pygame Library Python Graphics Sound in Python Networking in Python Putting It All Together Summary Questions and Answers Exercises Chapter The Python Game Community... Exercises Part TWO: Programming with Python Chapter Getting Started with Python Python Executables Python Debuggers Python Language Structure Creating a Simple User Interface in Python A Simple GUI... Getting Specific with Games in Lua LuaSDL Gravity: A Lua SDL Game The Lua C API Summary Questions and Answers Exercises Chapter The Lua Game Community Game Engines Graphics The Games Themselves Beyond

Ngày đăng: 25/03/2019, 15:46

Tài liệu cùng người dùng

Tài liệu liên quan