User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Video Tutorials

Thu Dec 15, 2011 5:06 pm

Great tutorial series. As a thought it may be better to use RPCEmu, or Qemu ARM so that at least the CPU is in the same series. Just a thought, your videos are great (except for the choice of Python [worlds 3rd worst programming language]).
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Thu Dec 15, 2011 7:30 pm

Quote from liz on November 21, 2011, 22:34
Absolutely - although we're not in charge of curricula, we're very keen to see people learning Python in particular, so it was great to see you run with it.

Thats the reason I chose Python, because that's what the R-Pi Foundation seem to be pushing.

Also, I know arm emulation will better represent the platform but it is harder to set up. That's why I just went with x86, to not scare people off on the first tutorial.

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Sun Dec 18, 2011 10:05 pm

Tutorial 7: Object Oriented Game Programming with Python and PyGame

[embed]www.youtube.com/watch?v=seUxf-AxyzE[/embed]

Jim Brown
Posts: 31
Joined: Wed Dec 28, 2011 10:00 am

Re: Video Tutorials

Wed Dec 28, 2011 10:59 am

I concur these are good tutorials. Nice work Liam

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Mon Jan 02, 2012 11:44 pm

Jim Brown said:


I concur these are good tutorials. Nice work Liam


Thanks for watching Jim… I seem to have lost all of the videos when the forums switched .

Heres the latest:


Scotty
Posts: 4
Joined: Tue Jan 03, 2012 10:36 am

Re: Video Tutorials

Wed Jan 04, 2012 10:56 am

Great tutorials Liam, they've certainly got me interested.

DavidS, if it's better to use RPCEmu, or Qemu ARM would you be willing to show us how?

Also if Python is a poor programming language, what would you recommend.

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Wed Jan 04, 2012 11:10 am

Hi scotty Thanks for the comment. I went with virtualbox because it was easier to set up and wanted it to be easy for the viewers to not put them off. Personally, I wouldn't use python for a big project. But...

It does get results quick without having to learn a lot of syntax... and that's what we want to get people interested.

mightygoose
Posts: 85
Joined: Mon Jan 02, 2012 1:53 pm
Contact: Website

Re: Video Tutorials

Wed Jan 04, 2012 12:29 pm

Liam, these look fascinating, perhaps you could go back and do an ARM reinstall at a later date. Perhaps run a more intermediate class later on. I am not trying to push you into doing it; i appreciate your start simple approach. When i get round to setting aside an evening or three i am sure i will struggle even with the basics. However it is good to maintain an interest in completeness. A tutorial series does not always have to remain linear and some sideways steps here and there are often nice tie offs of tangential suggestions that occur along the way, (this being a classic example).

At any rate i am very appreciative of your work. Keep it up.

6 + 1 =/= half a dozen of the other.

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Sun Jan 08, 2012 8:28 pm

Hi mightygoose. I'll be honest, I don't see the point in doing an ARM reinstall that much as the Raspberry Pi's will hopefully be released at the end of the month! I don't have the time either with college exams and stuff - the tutorials have to be fairly quick for the next couple of weeks. I do take your point about not remaining linear though. It's definitely a possibility in the future...

Anyway... Tutorial 10 - Feeding PiSnake will be up in about 10 minutes at this link...

http://www.youtube.com/watch?v.....EQublWVxmM

User avatar
meltwater
Posts: 1015
Joined: Tue Oct 18, 2011 11:38 am

Re: Video Tutorials

Thu Jan 12, 2012 10:14 am

Hi Liam,

Excellent tutorial videos by the way, excellent way to get people used to using linux without too much heartache.

I have a request for a future tutorial:

http://www.raspberrypi.org/for.....et/#p29200

The idea being that introducing the ability to remote control through the web by sending small messages opens up a range of interesting uses, particularly when you add hardware too.

Keep up the great work!
______________
http://www.themagpi.com/
A Magazine for Raspberry Pi Users
Read Online or Download for Free.

My new book: goo.gl/dmVtsc

Meltwater's Pi Hardware - pihardware.com

Like the MagPi? @TheMagP1 @TheMagPiTeam

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Fri Jan 13, 2012 4:01 pm

Hi meltwater

This is something that I think will be really interesting and I'll definitely do something like this when I can find something that it would tie in well to. Can you think of anything specific?

Jaseman
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
Contact: Website

Re: Video Tutorials

Fri Jan 13, 2012 11:51 pm

Watched all the tutorials.

You're some kind of genius in my eyes.

It seems like a lot of effort to get a raspberry to randomly appear on top of a background!  I know, you're setting up all the classes and defining the .... whatever the def sections are know as.  Also giving some very good examples, to demonstrate techniques of writing code.

I think I'll pick it up better, tinkering with some code of my own.  Just being able to open a screen/window and display a background pic and then place some objects over it will be useful in itself!

I don't think I would attempt to write games. I'll probably start by making a simple slideshow program.  Would be nice if I could launch some background music to go with it and throw in a bit of Hello World for good measure.

One important thing I need to know is how to compile my program into a standalone app.  I thought about also trying the windows version.  I think you need to have GTK runtime installed.  You need that to run GIMP on windows as well.  After all - you want to be able to show off your creations to your friends, without them having to have Geany installed.  Presumably the pygame libraries get wrapped up into the executable file too.

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Sat Jan 14, 2012 10:30 am

Thanks Jaseman

Yeah that's a pretty good idea actually. I'll definitely make a tutorial on running stuff on windows.

The def sections are known as functions or procedures.

A slide show app wouldn't be too bad. You'd just have to move the images rectangle across the screen.

Cheers,

Liam.

gjs
Posts: 153
Joined: Fri Dec 02, 2011 8:04 pm

Re: Video Tutorials

Sat Jan 14, 2012 2:26 pm

Hi Liam,

Excellent work.  Well done and thank you.

My 2 cents:  Keep doing what you're doing.  Don't get distracted by the "… use ARM version…don't use Python…do it my way…" brigade.

Cheers.

Jaseman
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
Contact: Website

Re: Video Tutorials

Mon Jan 16, 2012 1:20 am

Here's my first attempt at a Python program.  It's not as advanced as I would like - but it's a start and it works, so can't complain.  It's a very very basic slideshow.  You just need to go on your web browser and save three 800x600 wallpapers in the same folder where you save this program and name them slide1.png, slide2.jpg and slide3.jpg

#!/usr/bin/env python

#Import the modules and initiate pygame
import pygame, sys, random, os, time
from pygame.locals import *
pygame.init()

#This is the number of seconds to display each slide
slidedelay = 5

#Define the total number of slides
slides = 3

#The window title along the top
slidetitle = ["Slide 1", "Slide 2", "Slide 3"]

#Screen size for each slide x = width y= height
slidex = [800, 800, 800]
slidey = [600, 600, 600]

#The background image to load
slideimg = ["slide1.png", "slide2.jpg", "slide3.jpg"]

#Subtitles
slidetext = ["That's fabulous darling", "Welcome", "Bye"]

# this l variable is just for a loop

l = 0

def openwindow( windowtitle, windwidth, windheight, backgroundfile, message ):

#This makes sure the programs screen is centred
os.environ['SDL_VIDEO_WINDOW_POS'] = 'center'

#The Window Title
pygame.display.set_caption(windowtitle)

#Open/Adjust The Program Window
screen = pygame.display.set_mode((windwidth, windheight), 0, 32)

#Load the background image
background = pygame.image.load(backgroundfile).convert()
screen.blit(background, (0,0))

#Set up the font
font = pygame.font.Font(None, 36)
text = font.render(message, True, (0, 0, 0))

#Display text shadow
textRect = text.get_rect()
textRect.centerx = screen.get_rect().centerx - textRect.centerx
textRect.centery = screen.get_rect().centery * 2 - textRect.centery - 20
screen.blit(text, (textRect.centerx, textRect.centery ))

# Display text
text = font.render(message, True, (255, 255, 55))
screen.blit(text, (textRect.centerx-2 , textRect.centery-2 ))

pygame.display.update()

#This part just keeps the program running in a loop until you quit
while True:

for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()

#Opens a window - "Window Title", width, height, "image" "message"
openwindow(slidetitle[l], slidex[l], slidey[l], slideimg[l], slidetext[l])
l = l + 1
if l > slides - 1:
l = 0
time.sleep(slidedelay)

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Mon Jan 16, 2012 7:22 am

Hey Jaseman!

I'll check that out at some point in the week! Looks good

Cheers,

Liam

Jaseman
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
Contact: Website

Re: Video Tutorials

Mon Jan 16, 2012 6:55 pm

Do you have Skype Liam?

I'm really getting into the ole Python now.

I want to know how to get that sound problem sorted.  I'm not sure if the problem is within Geany or if it's just something to do with Debian or even VirtualBox

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Mon Jan 16, 2012 7:08 pm

Great stuff Jaseman.

I do have an account but I don't even have the software installed anymore lol!

Really glad your enjoying Python...

The reason there is no sound is because there is no sound framework installed. Try doing 'apt-get install alsa-base alsa-utils gamix' as root of course... ALSA stands for advanced linux sound archetecture and should work. If not I'll fire up my virtual machine later tonight and have a look

Jaseman
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
Contact: Website

Re: Video Tutorials

Mon Jan 16, 2012 7:54 pm

Well the messages have changed but not resolved the problem.

The one about dev/sequencer has gone, and been replaced with 'there is no soundcard' and ASLA lib pcm.c:7223:(snd_pcm_recover) underrun occured.

It might be to do with my onboard soundcard.  I'm using a Dell Optiplex GX280.  I know I had trouble getting sound to work on some live CD's.  Works okay with Kubuntu though.

Any thoughts?

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Tue Jan 17, 2012 5:29 pm

I'll try get it working on my VM and let you know

If not though it might just be that your soundcard is not supported. What are the host driver and controller under the audio settins on your VM?

P.S rather than posting all the tutorials seperately - they are here

http://www.youtube.com/raspber.....itutorials

liamfraser280
Posts: 354
Joined: Tue Oct 04, 2011 6:53 pm
Contact: Website

Re: Video Tutorials

Tue Jan 17, 2012 5:57 pm

Really sorry mate.

I can't get anything either :/

My sound card shows up in gamix but I can't get any sound out of it at all!

Ahh well, I suppose we'll just have to wait for the Pi to come out. Should only be a couple of weeks now !

Getting sound on pygame looks really easy though.

Wish I had more time to persue this issue.

Cheers,

Liam

Jaseman
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
Contact: Website

Re: Video Tutorials

Mon Jan 23, 2012 2:18 pm

I created a few functions:

Open pygame graphics window

paste text onto the screen

paste rectangles

paste ellipses

paste circles

paste polygons

paste images

pause for x amount of seconds

For each function you pass values such as the coords, colors, filenames.

Then I've used the open() close() commands to pull in a text file which acts as a sort of script.

The script file will be something like....

PasteText "Jaseman Presents"

which starts in colour 0 and increases to 255 to create a 'fade in' intro effect

Then an image and some geometric shapes and text drop in from each side of the screen (By having a loop to increase/decrease the x, y values).  This creates some movement/animation.

It calls the functions up as necessary as each line of the text file is read into a string variable.

I also managed to create a very basic scrolly text part.

I realised i've created a very basic version of PowerPoint.

At least I've got the graphical side, sorted.  For games, you just add in keydown events to get those graphics to react to you pressing keys, and then work out the behavior stuff - what happens when things collide, boundaries, shields, energy levels and so on.

Quite rewarding, however, I'm not quite sure what purpose my program will serve.  The problem is, my python game will never compete against those free java games that you can play online, and certainly nowhere near the league of the games giants that spend millions on each game, and employee a huge team of professional programmers, animators, composers, musicians and actors, plus all the real world simulation stuff (trying to make the game behave like the real world).

One idea I had was to pull in jpg's - still images or even frames from a movie, and trace over the top with polygons, to recreate that image, storing all the vector coordinates.  The idea is to have virtual puppets that act out the parts of a movie.  The advantage would be that to store the vector coordinates would take far less space on disk than the traditional movie format.  To make a decent short animation would take many hours of painstaking work though.

The problem is always that it's easier to pick up some off-the-shelf software that does the same job more efficiently.

Where I do see potential for this is, if you need a bespoke program to perform a particular function.  Perhaps something that captures information from a person or website, performs some calculation and builds a html file to display the results.

Once you've mastered the programming side, you might come across a problem later on and think... I can solve this by writing a little program.

Nodge
Posts: 39
Joined: Tue Jan 24, 2012 10:18 am

Re: Video Tutorials

Tue Jan 24, 2012 10:53 am

Hi Liam,

I'm an absolute beginner with Linux and thanks to your first tutorial I now have Debian running in Virtual Box. In the course of the installation I did experience one glitch that might be worth noting. At some point I was asked for my full name and password (for the root user?). I entered my name as John Jopp. It then asked for a user name and password and I'm pretty sure that "John" was pre-entered which I accepted. Then later after a reboot, I was asked to login again at which I entered "John" and my password. "Incorrect Password"! I'd written it down so I knew it was correct and no amount of swearing persuaded it otherwise. I was totally stumped for a bit and on the point of giving up when I tried entering my name as "john" with a lowercase "j" and got in. If it is the case that usernames can only be in lowercase then it might be worth annotating the video to that effect.

Your subsequent videos dealing with Python are interesting but not really what I'm looking for at the moment. I'm more concerened with the basics of linux - file management and the like. For example, how do I get linux on an sd for the Raspberry Pi? My first project will be to get xbmc running on the Pi. Part of the beauty of xbmc is that you can mess with it and download skins and addons Am I right in thinking the Pi won't be up to running both a browser and xbmc? If so, then can I download the addons from my windows pc and just write them to the Pi's sd card to make them available for xbmc? Or will Windows not be able to write to an sd with a Linux partition on it? Can I share the Pi on my windows network to do this? Or maybe I can use debian in my virtual box to download xbmc addons and to write them to the sd card?

I'm given to understand that the shop will probably be making sd cards preloaded with Linux available which will make things easier but I'd still like to understand what is going on.

Thanks

John

Jaseman
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
Contact: Website

Re: Video Tutorials

Wed Jan 25, 2012 9:28 am

John,

There will be a wealth of instructions available for all those things you have mentioned - Certainly after the Pi is available.

In the meantime there are plenty of linux for beginners websites.  Most of it will be relevant.  Here's just a few I plucked from a quick google search.

http://www.ee.surrey.ac.uk/Tea.....hing/Unix/

http://www.linux.ie/newusers/b.....nux-guide/

http://beginnerlinuxtutorial.com/

http://linuxreviews.org/beginner/

You can try out the commands using your virtual machine.

I guess you want to know the basics of creating directories and moving files around.  You might also want to learn about creating samba network shares.

If you are familiar with MSDOS or windows command line, here's a few tips:

cd - change directory
mkdir - (Like md) - make directory
ls = list structure? its the same as dir command.  ls -l gives you more information
rm - remove - this is like the del command.  I always tag -R onto the end so that subdirectories also get deleted (R stands for recursive).  But be careful with this one!

Nodge
Posts: 39
Joined: Tue Jan 24, 2012 10:18 am

Re: Video Tutorials

Wed Jan 25, 2012 12:19 pm

Thanks for that Jaseman - some usefull links there.

Return to “Staffroom, classroom and projects”