Tuesday, December 17, 2013

GitHub Pages, Bootstrap, and markdown

Since I started to move the example code for my son's tutorials to GitHub, I decided to document the tutorials and functionality with GitHub tools.

I initially started with the README.md file in my GitHub repositories.  This required me to learn Markdown Syntax.  The syntax is straightforward and take about 30 minutes to learn.  GitHub has version for Markdown that they're call GitHub Flavored Markdown (GFM).

This was pretty fun since I could use lists, headings, and embedded images in the README.md file. 

I then noticed that there is a wiki link to the right of each repository.  I created a wiki for the lessons and even put the YouTube videos into the wiki.


Today, I found out that GitHub has a feature called Pages to create a full project site.  I created a video overview of Pages and wrote a blog post here.

I created a full website for my project repository in 6 minutes.

Since I was on a roll and had some spare time, I read more about GitHub Pages and realized that the web pages were stored in my repository on the GitHub server and could easily be updated with git.

To make a more dynamic web site, I looked at bootstrap.  I created a test site for json_loader using the Carousel template for Bootstrap.

I ended the day by watching this awesome video by  David Cochran of Twitter.


Friday, December 13, 2013

PGS4A Installation Tutorial

Just saw this tutorial by Shems Eddine on getting PGS4A running.  Installing pgs4a is a common question.

Since I haven't had problems with the installation and I am running pgs4a primarily on Linux, I haven't been able to help with this problems.  Please see Shem Eddine's Journal for some great tips.  The tutorial is focused on Windows, which is great for all you Windows programmers out there.

If you're still stuck, there's the pgs4a forum.


JSON Map Loader for Android Games Written in Python (Pygame and PGS4A)

I recently changed my son's lesson on 2D tile maps to focus on creating a json_loader that can read in different types of maps.  json_loader will allow you to quickly create 2D tile games on Android.  It is for children learning to program in Python.  The example loader is not intended for production applications.   You can create fairly large maps with Tiled and have your player explore a small fanasy world.

The full source code for the loader is available on github.


You can get the package at the link above or with git.
  $ git init
  $ git pull http://github.com/codetricity/json_loader



 There are three skeleton program to get you started:




Maze.  This is the only game that is fun enough to be playable.  If you add a timer onto this game and a way to save the time scores, you'll have a fully playable game.  Even with the basic skeleton, the game is still playable.  You can create several maps with Tiled and then have a series of simple map games on your phone.









Adventure Map.  The game is fully playable with the character moving around the screen with either a keyboard or touchscreen.  The game doesn't have a layer to find things such as treasure or monsters.  You'll need to add this layer and write the code to take an action such fight the dragon with a sword.  For an idea of what to do with a map game, see my son's game Swarm that he developed when he was 13 years old.  Note that Swarm doesn't use json_loader.  Each map was created with Python code, not with a map editor.  It took a while to build the different levels.



















Scroller. I also started on a 2D scroller game using json_loader.  The player scrolls and can jump around the screen.  However, the platforms don't work.  The character will fall right through the platform in the air.  I wrote a number of blog posts on 2D side-scroller games.  Here's another one.


Once you get the code, run the example program with:

$ python main.py

The default screen size is 480 x 320.

You can load a different map by opening main.py in a text editor and changing:

    map_file = "maps/map.json"


    map_file = "maps/test_map.json"

If you use test_map.json, you will have a maze game.

If you want to experiment, you can use the unfinished scroller game with:
  
  $ python scroller_example.py

If you do create a game with json_loader, take a video of the game and put a link to the video in the comments.


Sunday, December 8, 2013

Slick Pygame / Ren'Py Game - Save the Date

Funny, challenging and mildly addictive.  Save the Date is short and it will be tough to play it just once.   If  your date ends in disaster, you'll want to give it another go.  My son played it about three times.  We haven't won yet.  The game is free and worth the short download and 30 minutes of time playing.

 Save the Date is written in Python, Pygame, and Ren'Py.  The game's author is Chris Cornell.  The impressive music is by Francisco Cerda.  Save the Date was was a 2013 IndieCade Nominee.

I believe that the author of Ren'Py is Tom Rothamel, the same person that developed Pygame Subset for Android.  Both of these projects are very high quality and are widely used by an active community.

Friday, December 6, 2013

Sharp and Clean Symbols from GLYPHICONS


 

As I was reviewing the Bootstrap site, I noticed that there were references to GLYPHICONS.  I like this type of clean icons and may incorporate some of them into future games.

There are different licenses available.  One of the licenses is for a free version of 470 GLYPHICONS and 50 GLYPHICONS Social that are distributed under the Creative Commons license.  The author is Jan Kovarlk.

Many games and applications are moving to a cleaner, simpler icon style.


Thursday, December 5, 2013

kivy - alternative to Pygame

 

I looked at pyglet two years ago in October of 2011.    Since that time, I haven't gone back to it.  I've been focused on Pygame Subset for Android.  As far as I know, Pyglet doesn't work on Android phones.  I also like the Pygame documentation more than the Pyglet documentation.

Another library, kivy, does work on Android.  It should also work on iOS.  I haven't tried it myself on either Android or iOS.  My son and I have used it on Linux and it does work great on Linux.

My son was able to build a pong game from the tutorial in one session.  Kivy has a lot of potential and I want to go back to it.

The reason I'm still using Pygame for my lessons is that my son is still getting used to object oriented programming.  With Pygame, the program is can be made more easily with one long block of code.  He can then go back to change the program components into functions or classes.

With kivy, he has to immediately start using classes.

Here's the basic "Hello, World" in Kivy.




While this is actually shorter than a Hello World program in pygame, it does require class instantiation, which is a bit difficult to understand for a young teenager.

The kivy documentation is also considerably weaker than the pygame documentation.  Since kivy is a younger project, I've also experienced more problems with getting the libraries to work all the time on my Linux system.  For example, when I updated Ubuntu 12.04 to the beta NVIDIA Driver, 325, kivy stopped working.  However, pygame was still working.  This may be due to an error with the NVIDIA driver GL implementation and have nothing to do with Kivy.  However, it does show that with less people using Kivy, more things can go wrong.

The advantages I can see for kivy are:

  • multi-touch support.  This is huge.  Pygame only supports a single point.  Although there are some hacks to use the joystick module to detect multiple inputs, it's not that clean a solution.  Getting multi-touch support is a major draw.
  • iPhone, iPad support.  It doesn't look easy to do and I've never done it.  There are some apps on the Apple Store.  So, it's possible to get it to work.  I'm sure it will get easier as the platform matures.
  • GPU acceleration.  The fancy OpenGL ES 2 support makes it easier to do cool 3D effects
  • Android and iPhone support is provided by the core maintainers.  For Pygame, we need to rely on the separate pygame subset for android project (which probably won't support multi-touch since the key developer wants to keep the feature set similar to what is on the base pygame library.)
  • The development community around adding features to the platform seems to be more active than the pygame development community.
The downsides for the purpose of teaching:
  • Pygame documentation is better
  • More people use Pygame and there are more examples of Pygame code
  • The larger pygame community means that most problems have already been solved by other people.  Much more answers on stackoverflow
  • Kivy uses the KV Design language in a separate file.  It gets a bit like JavaScript where you have multiple languages for one application.  There's upsides and downsides to this approach.  The main downside is that there's a slightly steeper learning curve for the kids.
Despite the shortcomings, I'm most likely going to revisit kivy in my curriculum after my son gets through his 2D Maze games.    This assumes that I don't start on django.