Tag Archives: windows

Gripes with Python

22 Jan

When I started my rather large undertaking to try to complete 12 games in 12 months I took python as my language of choice. I had very little experience in it and wanted to becoming versed in the language and its intricacies by the end of the year.

For January I decided to write a small text-based adventure (specifications will be put up shortly) it seemed to be right up Pythons alley, lots of string manipulations, none to very little data storage and the code is almost script like rather than a complete program because no external modules are used. All my code is kept in a box.net folder along with a python setup executable so that I can access the data and code / debug from anywhere on almost any computer. This setup was perfect for about 2 days when I started to run into various problems.

Gripe 1 – No proper IDE
Before everyone starts chewing off my head, I come from a C / C++ background with a Windows OS. I use Linux (Ubuntu or Fedora) and have love / hate relationship with it, I regularly use the command line for compiling and debugging and often switch between Visual Studio my IDE of choice and Notepad++ when coding. However Python has no proper IDE for Windows that can match Visual Studio for convenience and in my humble opinion quality, it just works and if I’m not mistaken that Python unofficial motto.

Gripe 2 – Whitespace or Tabs
Many people attribute this as a key component for improved productivity. For me however its been nothing but a headache. I’ve been forced to change my entire coding methodology as I can’t move from Visual Studio to Notepad++ with causing some sort of white space error. I spend more time trying to correct syntax errors than actual coding.

Gripe 3 – Lack of Braces
Using braces comes naturally to me because of use in C / C++. Python does not use any while this is not a major problem I find the syntax rather a little difficult to read as I find it difficult to find out where a condition ends particularly when it is multi-lined.

Gripe 4 – Multiple Versions
Python has far too many versions and to use any tool created I need to use a different version of Python or jump through hurdles to print “hello world”. While trying to program games I’m dabbling in the Google App Engine and it requires Python 2.5, I use IronPython in Visual Studio which is compatible with Python 2.7 and when I’m using Pygame or Panda 3D I need to use Python 3+. It is very annoying as each implementation has different syntax and modules are not cross-compatible with Python 2+ and Python 3+, with most not having finished conversion as yet.

Even though I have some genuine problems and irritation working with python I’m finding its community to be very helpful and patient with new users particularly those on r/python.

Code samples are readily available in Python, especially for those looking for large projects that include scaling and other popular buzzwords used today. There are some very interesting projects that are written in Python and following them, editing some of the source is interesting and makes for a good challenge.

It is very easy and very quick to write simple scripts and small utility programs. But only if the modules you hope to use are compatible with the version of python you have installed.

The biggest relief for me was the built-in data structures, I did not have to look for or write my own templated data structures. Along with data structure I find that I prefer Python’s weakly typed arrays, mixing numbers and strings without the use of a custom data structure is a real time saver.

Overall while I’m struggling with the language I’m going to continue using it as it has a lot of scope for the future with its popularity in web app development and game scripting. Hopefully the guys on top sort a few of the language issues and move to Python 3+ and we can all live in peace.

Get into Game Programming

10 Nov

Information, especially finding good information takes time and patience especially since it is spread all over the internet, creating and maintaining a list of this is hard and extremely time-consuming. This guide attempts to educate you in-game programming, how to start, what to do and eventually how to break in and build a portfolio.

About Game Programming
The games industry, is a very profitable, very competitive industry. It has very high barriers to entry, because it is a very difficult field. Programmers are constantly learning and becoming fluent in programming languages, scripting languages, game engines, graphics engines, tool kits, directx, opengl, openal, ai, various API, SDK’s, methodologies, math etc. By keeping the barriers at such a hight they manage to separate the motivated (ie. those who want to get in) and those who just feel like it (ie. those who think its cool, easy or are just lazy). A few things that you should know are the long stressful hours through out development and more so during milestones and crunch time, salaries are also not high by comparison to other fields of development.

But it has its advantages, programming games is very cool and a lot of fun and like me I’m sure other programmers hobbiest or professional get that happy, fuzzy feeling when they see something they created being played and enjoyed by others. It is also a very dynamic work environment where you are surrounded by like-minded, smart and creative people, the work itself is challenging and no two problem are the same. More importantly these people will get that obscure Star Wars or Doctor Who reference 🙂

How to Start
At the heart of any game is the engine, which does the herculean task of rendering images and processing input. To have any interactivity at all you need to know how to program.

Which Language should I use?
You have countless choices of programming languages to learn for a variety of platforms, fortunately these languages all quite robust share common elements, learning one means that you can quickly pick up and learn another in a relatively short time.

I have adopted a five star system where one is the easiest and five the hardest, these are my opinion and I have tried to make them as beginner friendly as possible.

Compiled Languages
C ****
Regarded as many as the greatest of modern programming languages, It is very robust and portable, the same code can be ported to Linux or Windows with very little changes being made. It has a community online whom you can get help from and countless tutorials and lessons. You have access to thousands of libraries written over the last 30+ years that will make life easier. Used to be the industry standard.

C++ *****
This is the industry standard today, it is used in almost all major platforms from the PC to the Pandora. As a result of its wide spread use it is a very powerful language that is a superset of C, as a result you have access to thousands of libraries written for C and the thousands more written for C++, can write extremely portable and reusable code thanks to Object Oriented Programming features such as data abstraction, encapsulation, polymorphism, and inheritance. Unfortunately it is not one of the easier languages to learn.

Java ***
Java is a strange language it is not exactly a compiled language and nor is it an interpreted language.
I’m not entirely familiar with and nor am I fond of Java and this may colour my opinion. It is a very powerful language but its scope in-game development so far has been extremely limiting, however it is used for a lot of web-based games, applets, mobile applications and the Android OS contains sections of code written in Java. It is not very difficult to learn in fact John Carmack suggested that beginners start learning programming using Java, as you can immediately start making simple 2D games, but unless utilized properly it is very slow.

C# ***
This is Microsoft response to C++, it is a very robust language and you can port your game from the Xbox 360 to the PC or vice versa with almost no trouble. It is a fairly easy language to learn and also integral to the industry. You also have access to XNA framework which is used by companies to make Xbox Live games. You can easily create Windows applications with speed and without hassle compared to the other languages.

Interpreted Languages
Python **
Python is a hybrid, an extremely powerful language with EVE Online being coded entirely in Python, Civilization 4 also has python bindings as a part of it to allow the mod community to easily modify and create for the game. In my opinion python has not exactly found its place in the industry because it can do so much, but common uses for it are in scripting and indie gaming.

Lua **
I have never used Lua so I am unable to judge it, but from what I read and the few tutorial I checked out, it is not very hard to learn and a very strong scripting language.

Order in which to learn
This is by no means the best order to learn the languages, but it allows you to get familiar with the concepts of programming and the methodologies without getting bogged down and hopefully motivate you to pursue the other.

1) Python
2) C
3) C++

I have not included Java, C# as you can study those after you master the languages above. Java and C# have been excluded particularly because they were created to make the developers life easier tend to lull beginners into a false sense of security as a lot of the backend and low-level development is hidden. While this has its positives in the hands of an experienced programmer in the hands of a beginner it can cause all sorts of headache and code bloat. There is a reason that C++ is the industry standard not just in games but also in various fields of software development because of its low-level access.

Lua is not mentioned as until you have knowledge on programming you wont know how to include it in your game.

A word of warning though, once you learn the three languages above you still have a very long way to go before you can make a full 3D game or even a 2D one, most of the code you will write in the beginning will only run on the command line. But don’t fear once you master the basics you can advance to the fun stuff.

Which Books should I read?
The following is a set of Books that I have read, No review is given just how easy is it to follow, also most of these are not about game programming they are about learning the language.

Language Title Author Ease of Use
C How to program in C Dietel *
C The C Programming Language Kernigham & Ritchie ***
C++ Accelerated C++ Koening & Moo ***
C++ The C++ Programming Language Stroustourp ****
C++ Beginning C++ Game Programming Dawson **
C++ Thinking in C++ Vol. 1, 2 Eckel ***
Python Learning Python Lutz *
Python Programming Python Lutz **

Check the following for more recommended books with review.
Daniweb Recommended Books C

Daniweb Recommended Books C++

Peer Reviews

Reviews and Recommendations by Yaustar – Also has link to free ebooks

GameDev Books

Which Online tutorials should I follow?

In all honesty it is better to follow a book rather than a tutorials as it may lead to shortcuts and bad habits, but a few that I check out are:

Language Website
Various http://www.functionx.com
C/C++ http://www.cprogramming.com
C++ http://www.cplusplus.com

I N33dZ t3H h3lP?!!@??
First off, never start a forums topic like that, your going to get banned. Secondly read this.

The best forums for programming help are:

In the next few days I will add information on game engines that will be a natural progression to what you’re learning and a proper list of web resources.

Feel free to comment, question, suggest or criticise.

Installing Ubuntu on Acer Aspire One

24 Mar

Installing Linux on the Acer Aspire one is a hit and miss proposition as you don’t know how much work you will to do to make it work smoothly and without a hitch.

Until now I had fedora 10 installed without any problems and while I had not tested everything on it the wifi was working out of the box which was fantastic and saved me a lot of trouble of going through the internet and mucking about the system until it worked. The only problem I had was that the font size was on the large side and even though I made adjustments to the font size to make it smaller it kept bugging me. Also note that the fedora software repositories are vast and installing things is a breeze and usually involves just finding the RPM -> download and let the package manager install it.

I gave Ubuntu another try last night and despite my earlier grief I managed to get the wifi working, and now its still working almost 24 hours later although I haven’t updated the system in fear of the wifi failing again.

Installing Fedora or Ubuntu.

Part A
Getting the OS on a USB:

  1. Download the OS from the Ubuntu website
  2. Download Unetbootin
  3. Plug in a formatted USB which is 1GB or more
  4. Open Unebootin and look for Disk Image and select it and where the ‘…’ are press and go to where you downloaded Ubuntu and select it. *
  5. By default it chooses the USB, so all you need to do now is press ok and wait while it creates a bootable USB.
  6. After it is done reboot and press F12 when you see the ACER startup screen.
  7. Choose the USB option.
  8. Select default and wait for the Ubuntu Live CD to load.
  9. * Alternatively you can skip step 1 and use Unebootin to download the Ubuntu distribution you want to use.

    Part 2 coming tommorow.

Programming Challenge: Battle Ships

14 Mar

I have been studying programming for about a year now and want to challenge myself to see how much I know and still need to learn so I decided to make a small game based on battle ships.

Its going to be a fairly simple console based version to which I am hoping to add features and functionality as I learn more and more.


  • Written in C language to be ported later to C++ or C# and made a console program
  • Should display the screen using X
  • The ships will be displayed using DDDD for destroyer, and be allowed to place vertical or horizontally
  • Basic battleships rules apply
  • It will have single player initially and hopefully multiplayer on both the same machine and over a network
  • Cross platform compatibility on Linux and Windows
  • Specs maybe changed or updated at a later date

Software Used:

%d bloggers like this: