Escape from Oof World – Adventures in programming the Atari 2600
New! You can now play Escape from Oof World in the browser, click below:
I suspect you have two questions here. What the heck is Oof World? And what is an Atari 2600?
Let me address the second question first. This, my friends, is the Atari 2600:
Yes, the grand-daddy of all home computer consoles, running cartridges that could hold a whopping 4k of memory.
The games looked like this:
Awesome right? This is what I grew up with. And I loved it. For some reason recently, I’ve been pining for my past and I think I love the old Ataris even more than ever. Wait. How the heck did they make that game?
Anyway, so having noticed a resurgence in retro-gaming, and a relatively new basic programming language for the Atari 2600, I decided to try my hand at writing a game for it!
Which leads to the second question. What is Escape from Oof World? Well that’s the name of the game I’ve been writing. Inspired by my 5-year-old’s love for a range of cuddly toys that he decided to call Oofs! Here’s my favourite Oof:
He’s my favourite for 2 reasons;
1 he looks funny, 2 my son calls him “Lord Dark Oof” – love it!
So, let’s write some code!
- A computer!
- batari Basic
- Visual bB
- Stella (Atari 2600 emulator)
- Infinite patience (I failed on this one, but hey, I got there in the end)
Look here for batari Basic and Visual bB:
All the nitty gritty on programming and commands for batari Basic is here:
Stella is here: https://stella-emu.github.io/downloads.html
Read the instructions and follow the setup exactly, and you’ll be up and running in minutes.
Ahem. Anyway. So the Atari 2600 has the following available to it:
Playfield – the background graphics. A whole 32 pixels wide and 11 pixels deep…
Player0 – 1st sprite
Player1 – 2nd sprite
Missile0 – 1st player missile
Missile1 – 2nd player missile
Ball – ball!
Not a lot to work with is it? Fear not, there are lots of tricks to get more out of it. batari Basic, has a few extra kernels up its sleeve to make things easier too. For instance, the DPC+ kernel will allow extra “virtual” sprites – although a bit of flicker will be introduced. Plus higher resolution playfields.
BoRing! Show me some code
Okay! I’m going to assume now that you’ve installed everything you need and have created a new empty project.
So, first of all, lets draw a sprite. Sprites can be up to 8 pixels wide (although you can stretch them) and any number of pixels high.
Lets use this handy tool to draw something:
Let’s make an Oof!
So, above, I have expertly drawn 2 frames of animation. On the PlayerPal editor, there’s an option to generate code – select this and click on generate batariBasic code.
Paste the result into your project:
rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288
set kernel_options player1colors playercolors pfcolors
player0x = 50
player0y = 50
rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME…
if f = 10 then player0:
if f = 10 then player0color:
if f = 20 then player0:
if f = 20 then player0color:
if f=20 then f=0
if joy0right then REFP0 = 0
if joy0left then REFP0 = 8
if joy0right then player0x = player0x + 1
if joy0left then player0x = player0x – 1
if joy0up then player0y = player0y – 1
if joy0down then player0y = player0y + 1
Now, click the save icon and then the run icon:
Your first bit of Atari 2600 code ! Use the arrow keys to move the Oof around 🙂
There you have it. Your first piece of Atari 2600 basic code!
Now, I’ve thought about going deeper into detail on all the different commands and kernels etc., but why reinvent the wheel? The links in this blog should be enough to get you started, but I am more than willing to answer any questions you may have: email@example.com
In the meantime, here’s a little sample of Escape From Oof World, complete with title screen!