After a long time I am starting to write a new entry to my blog. During the summer months I kinda forget to write regularly because of the nice weather outside, which I tried to enjoy. And because the weather is still very good, there will be less updates. But to increase the time between the blog posts and being able to produce some more tutorials or games I am starting to use Unity 3D.
I am still creating 2D games only and Unity gives a very good platform to do this in a rapid development environment. Stuff can be created very easily. An additional fine tuning to all parts of the game can be made directly in the game without much compilation time or other stuff. I will try to add an own tutorial for how to use unity to create 2D games asap. But until this article is written, I will give you a link to a site which helped me a lot during my first steps in using unity: unityjumpstart.com.
The presented game and the videos may take a while to watch but he explains everything needed for a simply Space Inviders like game. There are improvements to the development of a game I will mention later in one of my articles, until then watch the videos and try to learn with the free version of unity3d
This is kind of a new update post I want to do at the end of each month, starting with the end of may. Such a post will sum up my advances during the last month. All of these posts will start with a post of the month pointing out an outstanding post in my view. After this I will give other update facts of what I have achieved during the month. In the end each of these posts will try to give you an overview on the statistics for this blog, e.g. spam count visitor count and so on.
Regarding this month I actually did not create as many posts as I liked to. The main post and my only one this month the pygame to Android post. After the post of the month I will continue with an overview on some statistics, regarding the spam and the visitor count on my blog. I do this mainly because I find it interesting and want to give you all an overview on the numbers behind a blog.
Post of the Month
Hence I will review this post a little. Because this is a post I also cross posted on the platform gamedev (Link to the article). The article has not changed much regarding the post here and on gamedev, but due to the fact that a lot more people will read it over there I hope to have some kind of advertising towards this blog. Because writing to an audience is actually more fun than writing just for myself as a reminder of what I have already achieved. The article on its own has a lot to do with the pgs4a setup and example. I have ported this to breakout which I have programmed earlier and added some parts which handled errors which occurred due to updates on python and the Android SDK.
This month I have updated my style to the responsive wordpress theme, which I have found at the word press home page. To finish the theme up I added the nice logo, which is in the look of a python class and tries to define my webpage. Additional to this I added a page today describing my hardware and software setup, giving you an overview on the hardware I run and develop my games on. As far as the end of may is concerned this is it for the updates. Read more ›
Today I want to introduce a way to port game written in pygame to Android. To do so we will use the pygame subset for Android, which can be obtained here. The pygame subset for android has ported a subset of the pygame architecture to the Android architecture. Hence it allows us to easily program games in python and port them to an Android application. This article will explain how to do so by using the breakout game, programmed by myself. In the end we will have a breakout game on our Android device which can be controlled by swipe gestures or by tilting the android device it self.
If you want to rebuild what we will build during this article you will need the following programs:
Device Drivers for your Android device, if you are using Windows and a little help for Linux here
pygame subset for Android (PGS4A), obtainable here
These programs are more or less needed if you want to run the breakout game itself and then later port it to your Android device. If you plan on skip the part, where you run the game on your local PC, the pygame library is not needed. The whole porting and programming is just one more click apart.
Today I want to create a menu in pygame. Not a huge or complicated one, more a simple and easy to use one, where you select the different options with either mouse or keyboard. Each Item should be capable of being displayed somewhere in the center and should only consist of a text explaining the property it handles, e.g. starting or quitting the game.
There are already a bunch of classes and structures which create such menus in pygame, they can easily be found, if you search for menu on the pygame tag search page or do a google search for pygame menu. But because we want to learn how to handle menus ourselves, we implement everything line by line.
To begin, lets identify what a we need:
A text entry, for each menu entry
Event Handling, to enable the menu to be clicked or to change the selected entry
User Events, to enable an event like an clicked Item
So far we have covered text entries in the game pong and event handling for inputs in the first game piece. Hence we have some new parts we try to cover during this game piece, e.g. custom user events or enabling and disabling of text.
In one of my last posts we created the game pong, which is a very basic one file based game. As for a next game I considered to create a breakout game. Hence, I am able to reuse different classes which I have created during the pong game. I.e. the Bar and the Ball class, which only needs some little modifications to be used within a breakout game. To be able to complete the breakout an additional class is needed the Block, which is our enemy in this case. To win we would only need to destroy all our enemies. After adding the the Block class and some additional programming the pong game looked like breakout:
The game is very basic, you have to hit the monkey with the fist, so that he is able to eat ALL of his bananas, if you miss him he falls into the pit and you have to start again. There is currently, no score counting or some kind menu involved in this version. Even if all the bananas are eaten by the monkey the game needs to be restarted, because there is no automatic restart currently implemented. I figured out that for learning basic game development creating menus is not essential.
The programming included steps, like rotating the fist and adding the Block class. A big portion of the programming to this point was splitting up from one game file to multiple files, one for each different class. Also I have created a GameElement as a Basic class, which is the parent of the Bar, Ball and the Block. Also a lot of time was spent for the collision detection and how to decide if the box was hit either on the left or the right side. The source code is available on github For more implementation details continue reading.
The first game piece is the input handling, which is the very basic for every game. Without it you would not able to move around or interact with your virtual world. Even interacting with the menu or closing the game natively would be impossible. In a worst case scenario you can even lose some game relevant data, because you have forgotten to save the current game status, which you wanted to auto load at the next start of the game.
So there should be at least three different kinds of inputs which should be handled in a basic game:
Gaming Input, e.g. move the character
Menu Input, e.g. navigating in a menu or the characters inventory
Interrupting Input, e.g. closing the game or cancelling other interactions
As far as Python and pygame are concerned a basic input handling is done with the help of the event class which is an event queue. During each update cycle this event queue can be read out. It then serves an event structure which can be used to handle all of the above described handlers. If you continue reading, you will see possible implementations on howto handle input events regarding a game implemented with python and pygame.
A game consists of several different game pieces. They are more or less the basics needed in every game, e.g. to allow user input or to control a non player character. This post is about these special game pieces, which I think are in at least every game.
The mentioned game pieces consists as already stated of basic methods, e.g. the input handling, the handling of NPCs, menu handling and so on. In this post I will give you a basic overview on each of these game pieces as well as a very simple implementation, based on the pong game from a previous post.
For this purpose I will describe different game pieces, which are essential in every game in four different blog posts. I will start with the Input Handling or how do I move my character. After that three additional posts will follow, these posts will be about:
The artificial intelligence or where should my opponent hide
The game menu, needed by nearly every game
The main loop, where everything comes together
Each post will have a good practical guide and an overview on different practices and depict the pros and cons of each
After quite some weeks I finally moved on and started the programming. I decided to program with Python especially because I wanted to “learn” the language or at least to be able to apply it. Secondly because of the pygame library. Which has a lot of stuff already included for simple minded and advanced games.
So this setup is quite suited for a beginner like me. I integrated everything into Eclipse and started working my way through a tutorial while using the pygame reference for additional hints and programming help. Ending up with a Game which is contained in the same way in the pygame docs and called chimp.py. After i had implemented the additional tasks, e.g. shrinking the image after x hits I started to wonder if i could create a more suitable game out of this.
I started to rembering that a good basic game was pong, mainly due to the fact that it was stated in a previous post. Based on this and my experiences in pong I created the Game monkey p0ng. Which basically is Pong with some monkey face which is punched by two fists from the left to the right. For this purpose I altered the source code I obtained before and added different regulations to create the above game monkey p0ng. Which is not bad for a first simple game I suppose. The code and the explanations are attached and available after a click…
Even as an experienced programmer it is not as easy as just to start programming a game. So the question would be where to actually begin with the learning, programming, design stuff.
As far as I am concerned i like to start by reading. Reading about the topic what did others do, how did others start. This includes tutorials and recommendations and also read some code from small simple games solved by others. Learning through assimilation could be used here.
Good sites to look out for posts are the gamedev subreddit. Where some articles give good hints on where to start as well as the side bar, which states some basic links like Amit’s Game Programming Information which gives a great comprehension on the different tasks of a game and also gives and FAQ on where to begin.
Another good source for beginners like me is gamedev.net, especially an article I found there about beginning game development depicts a scenario which I liked much. The article tells the new game developer that it is not important which language to use or which library. It tells the reader to actually start programming and try to improve himself with feedback from other developers. The article states some different game to start on and an overview of mechanisms which are learned from these games. But it does not tell the user where to get the desired code reviews from. For most parts forums provide this service or something similar.
In my opinion the way to begin is to actually read a little more about different topics, continued by learning some basic programming principles, e.g. input handling, player handling, npc handling. With the help of those basic principles, which have been applied in different games, e.g. the ones stated in the article above, entering challenges or something similar where the whole game as well as the code is reviewed and you get different types of opinions, for code as well as for the game idea as such.
Beside the opinion and critics you are able to enter only those challenges with the topics you like, which boosts your fun and your endurance because you want to finish the game as well as getting good scores.
This is and should be the first post on my new blog.
For the things being I guess i am supposed to introduce myself and maybe state what this blog is about.
I am an researcher for a german health care company. I have a M Sc in Computer Science. I started this blog mainly to fight my boredom after work, hence this blog has kind of two main purposes. The first one is to fight my boredom by being able to post status updates about the second purpose of this blog, which is game development.
So one would ask why game development. The reasons are quite simple, of course one of them is that I enjoy playing games very much. Another reason would be that game development includes a lot of different parts of computer science, e.g. artificial intelligence, software engineering, data analysis and efficient programming. But game development also includes other arts like design, modelling, story telling and much more.
Because it has so much different aspects I want to build up knowledge in all parts of game development, even the programming and computer science parts, I started this blog.
As stated before I do have a lot of experiences in computer science but only have done little stuff in the field of game development this blog should depict you my learning rate and may even help you when you want to start game development as well.