Pokemon on Ubuntu


After obsessively watching some of the twitch plays pokemon stream I was inspired to play some Pokemon again. To play Pokemon on Ubuntu there are only a few steps you have to follow:

  1. Install Visual Boy Advance Express. visualboyadvance is one of the main Gameboy advance emulators for Ubuntu. Express is the visual configuration frontend you can use to customize your experience. To install it, simply enter the following command in your terminal:
    sudo apt-get install vbaexpress
  2. Get the ROM for Pokemon version you want to play. To play Pokemon using an emulator you need a ROM for the game, which is just an image of the actual game. There hundreds of sites that host Pokemon ROMs (and others) like Loveroms. The pages for these sites come and go due to takedown requests/copyright claims so linking them here is not very useful.
  3. Start VBA. You can do this either through the VBA express app icon or by entering the following command in your terminal:
  4. Switch to 128k save type (blank white screen). A lot of people have reported that starting the rom will result in a blank white screen. The fix to this seems to be changing your save type to 128k under (options>emulator>save type>flash 128k)
  5. Press Play, and load the GBA ROM you downloaded. The ROM file should have the extension .gba

That’s it! You’ve just followed the absolute basic steps needed to play Pokemon on Ubuntu. Since the documentation seems to be pretty sparse for vbaexpress here are some essential default controls:

Arrow keys - ←↑→↓
z - A
x - B
enter - Start
backspace - Select
spacebar - Speedup game
(f1-f10) - Load game save state from specified slot
ctrl+(f1-f10) - Save current game state to slot

Screenshot from 2014-03-09 22_21_57Screenshot from 2014-03-09 22_22_16
If you’ve followed the above steps and are still having issues running Pokemon on Ubuntu, please post in the comments below. To increase your chances of a solution being found include as much detail as possible (which version of the game you’re running, what operating system you have, what video card you have and steps to reproduce the issue). Screenshots are also very useful!

Streaming to Twitch.tv from Ubuntu


Recently I found myself needing to stream from my Ubuntu laptop to my twitch feed. Unfortunately almost every link/code snippet I could find online was either using unsupported/deprecated code or was full of syntax errors making it unusable. I’ve put together this simple tutorial for streaming to Twitch.tv with only single script to run.

The script (updated January 25 2013):

#! /bin/bash

# streaming on Ubuntu via ffmpeg.
# see http://ubuntuguide.org/wiki/Screencasts for full documentation

# input resolution, currently fullscreen.
# you can set it manually in the format "WIDTHxHEIGHT" instead.
INRES=$(xwininfo -root | awk '/geometry/ {print $2}'i)

# output resolution.
# keep the aspect ratio the same or your stream will not fill the display.

# input audio. You can use "/dev/dsp" for your primary audio input.

# target fps

# video preset quality level.
# more FFMPEG presets avaiable in /usr/share/ffmpeg

# stream key. You can set this manually, or reference it from a hidden file like what is done here.
STREAM_KEY=$(cat ~/.twitch_key)

# stream url. Note the formats for twitch.tv and justin.tv
# twitch:"rtmp://live.twitch.tv/app/$STREAM_KEY"
# justin:"rtmp://live.justin.tv/app/$STREAM_KEY"

ffmpeg \
-f alsa -ac 2 -i "$INAUD" \
-f x11grab -s "$INRES" -r "$FPS" -i :0.0 \
-vcodec libx264 -s "$OUTRES" -vpre "$QUAL" \
-acodec libmp3lame -threads 6 -qscale 5 -b 64KB \
-f flv -ar 44100 "$STREAM_URL"

What do I do with this? Follow these instructions:

  1. Create twitch_stream.sh. Download the script from here or copy the above raw code and paste it into a file called twitch_stream.sh in your home (~) directory. This will be something like: /home/YOU.
  2. Create .twitch_key. This script looks for the file ~/.twitch_key from which to read your twitch key. Go to http://www.twitch.tv/broadcast/dashboard/streamkey, copy your stream key and paste it into a file called .twitch_key in your home (~) directory.
  3. Make sure you have all the necessary packages installed. To install them run the following command:
    sudo apt-get install ffmpeg libx264-dev libavcodec-extra-53
  4. Make sure twitch_stream.sh has the right permissions. From within your home (~) directory run the following command:
    chmod 755 twitch_stream.sh
  5. Start streaming! From within your Home directory where you should have both the twitch_stream.sh and .twitch_key files run the following command in terminal:
    sh twitch_stream.sh
    If you don’t run into any issues this should start streaming right away. Check your twitch dashboard to see if this is working as expected.
    NOTE – you will probably have to tweak the INRES and OUTRES to match your needs. By default the INRES is set to be your screens width. You probably want to make sure your INRES and OUTRES have the same aspect ratio.

I have also created a gist for this short script so it can be updated as needed that you can find here.

Possible Errors:

  • stream.sh: 40: stream.sh: ffmpeg: not found
    Solution – install ffmpeg using the following command:
    sudo apt-get install ffmpeg
  • Unrecognized option ‘preset’
    Solution – install libx264-dev using the following command:
    sudo apt-get install libx264-dev libavcodec-extra-53
  • [rtmp @ 0xa39a20] Server error: Authentication Failed.
    rtmp://live.twitch.tv/app/: Input/output error

    Solution – get your twitch key again and copy paste it into the ~/.twitch_key file. You may have accidentally clicked reset stream key while copy pasting it.

If you run into any other error messages or dependency issues which streaming to Twitch.tv from Ubuntu please post them in the comments below. The more detail you can include the better! For reference I tested this on ubuntu 13.04.

Play nice
>> All posts, unless specified otherwise, are original and created solely for The Game Engine. Please credit anything you use or reference from this site.
Was this site helpful?
>> The Game Engine is a non-profit personal project. Please consider a small donation so we can keep helping you with your games.