Hyperspace Intro Animation on Pico-8

An in development game that is heavy on perspective and animation, needed a little something extra for it’s intro and cut scenes. The solution was to create a hyperspace star field effect with individual, animated pixels.

My first attempt at the effect was to start each pixel at the screens center and randomly animate the stars outward, the result was less than satisfactory, either the range of the animation was too narrow or it was erratic.

The solution was to at initialization, create two tables, one for Y and one for y with randomly generated  locations on the screen. Interestingly, to limit the resolution of the values in Pico8, we set the upper limit as a parameter of rnd(x) and subtract an amount to set the negative limit of the range, for example :

``````for i=1,stars do -- Generate the two co-ordinate tables used to store each stars x and y
add(starx,((rnd(256)-128))) -- 256 - 128 gives us a resolution between positive 128 and negative 128 i.e. the size of our screen
add(stary,((rnd(256)-128)))
end``````

Tron Style 80’s Animated Landscape on Pico-8

The 8-bit style of the Pico-8 lends itself well to the 80’s cyber genre. I’ve been throwing around some ideas for a demo or potential game. A 3d style animated landscape seemed like a good place to start.

The concept is simple enough, a series of horizontal lines generated in a FOR loop that are animated down the screen, their start time is staggered and the lines are accelerated.

The vertical lines that give the illusion of perspective are generated from two FOR loops, one for either side of the middle of the screen. One loop increments while the other decrements.

The _init statement sets up the foundation objects and variables for the animation. Notice the “start” and “offset” vars, together these control the vertical start position of the horizon. “Start” will adjust the starting spacing of the horizontal lines.

``````
function _init()
start = 5 -- Starting distance between horizontal lines
offset = 55 -- Starting vertical position for lines
lineh = {}
lineh.moveNum = {} -- Create the line object array
last1 = time() -- Init animation timer
start_line_num = 0 -- Init line counter, puts a delay on the for loop
lineCont = {} -- Array 1 of vertical lines (left side of screen)
lineCont2 = {} -- Array 2 of vertical lines (right side)
lineNum = 0 -- Start the vertical lines horizontal
lineNum2 = 0

lineEach = 5 -- Starting position and spacing horizontal lines
end
``````

Pico-8 Particle Animation With Sprite Font

Last months Revision demo party inspired me to take a few evenings to write an “old skool” demo for the Pico-8. It’s a fairly simple demo that is reminiscent of the Amiga and C64 demo scene, it illustrates a randomly generated star field that is animated within the bounds of the Pico’s screen. To add that retro flare, a text marque scrolls across the footer displaying a message. The built in font set didn’t have that sizzle I was looking for, so I opted for a custom sprite based font.

You can watch the full demo over at Pico-8 BBS.

“Ghost in the Shell” Signal Static on the Pico-8

The glitch or static effect that appeared in “Ghost in the Shell” trailers, that have been circulating the last couple of months inspired me to apply a similar effect to a game project in development. What better way is there to demo the effect than in a 8bit “Ghost in the Shell” title screen?

The static effect is reasonably configurable, random and light weight, using very few available tokens. In the game version, additional parameters are available to set width, height and offset’s, to allow targeted areas with the static effect.

Reusable Animated Clouds For the Pico-8

In the process of creating scenery elements, in this case clouds, for a WIP Pico-8 game. I wanted to build a process that could be called at any point in the game and place a unique element within the scene. It quickly became evident that the concept of a reusable function could back fire on my idea of a programable design. This led me to the question: at what point does the processing of parameters and customization of new objects created in a prototype, out weigh a simple tween?

The original concept of unique clouds was scaled back, the weight and token usage didn’t warrant the features that were available for the potential number of times the function would be called.

In this code walkthrough, I’m illustrating how to implement clouds through a window in a section of the screen. With a few minor adjustments, the script could be modified to work full width or the speed adjusted.

Pico-8 Sprite Animation Basics

Creating sprite animation based on user input in Lua is made remarkably handy by a set of functions made available by the Pico-8 environment. I’m going to be extending these core functions with a set of reusable worker functions to establish the foundations of a game engine.

What’s covered in this article:

This tutorial’s goal is help those of us who are new to Lua/Pico-8 to get a working prototype up and running. I’m basing this modal on my experiences developing a simple adventure game.

Setting Up a Pico-8 Workflow

Last Cyber Monday I picked up the awesome PocketChip by The Next Thing. The pleasant bonus to the very capable Linux based system, is that it comes packaged with the Pico-8 virtual console.

The game system, as it’s name suggests, is reminiscent of an 8-bit machine. Complete with the limitations of 32kb “carts” that hold game code, artwork and music. 16 colors and very chippy, chip tune sound generation. The screen size is 127 x 127 pixels. All together the systems capabilities amount to a very convincing retro machine.

The Pico-8 environment also includes a three part IDE: code editor, sprite sheet art package and sound tracker. While it’s possible to use the built in code editor pretty effectively, when the code length gets into the hundreds of lines, code management gets complicated.

To establish a more modern working environment, I installed Pico-8 onto an OSX system. The following guide is intended for Mac users but aspects can be applied to Linux, Windows and CHIP/Raspberry Pi.

Editing Pico-8 Carts

OSX stores Pico-8 carts in the /Users/\$USERNAME/Library/Application Support/pico-8/carts folder, \$USERNAME is your user on the system. On the PocketCHIP and Linux, you can find carts in /home/chip/.lexaloffle/pico-8/carts. Replace “chip” with the systems user.

To make life easier, create a symlink from a dev directory to the cart location.
First create a dev folder in you desired location.
Then from within the cart folder execute:

``ln -s /Users/USERNAME/Library/Application\ Support/pico-8/carts ~/pico-8-dev``

Note the escaped space in “Application Support”. The above example will link the cart location within Pico-8 to the folder pico-8-dev located in the users home folder.