PICO-8 is an excellent tool to use if youre looking to learn game development.
you might build retro, 8-bit style games and distribute them online for anyone to play.
PICO-8 offers its own sprite editor and music composer to build complete standalone games.
To get familiar with how PICO-8 works, its best to start simple.
Running the PICO-8 Console
PICO-8 is a virtual console and game development tool.
you’re free to use it to build and distribute simple retro-style games.
PICO-8 uses a subset ofLua, a popular gamedev programming language.
To open your local cartridge folder in your computers file surfing app, typeFOLDERon the PICO-8 command line.
Introducing the Game Loop
Whichever language youre using, game development typically centers around a game loop.
These functions are special because PICO-8 calls them automatically, when necessary.
you could see how these work by creating the skeleton of a game.
This first revision will display a cursor on the screen that moves as you move your mouse.
Start by setting up any required actions in_init().
This function isnt strictly part of the game loop since it only runs once, on start.
To support mouse input, this is the place to keep track of the pointers position.
PICO-8 includes stat as a built-in function.
It gives various details about the current environment, including the mouse, keyboard, and date/time.
Finally, define a_drawfunction to display a pointer on-screen.
Try removing this line to see what happens when you dont reset the screen.
Drawing the Remaining Game Elements
Tic-tac-toe takes place on a grid of nine squares.
you’re free to recreate this using four lines: two horizontal and two vertical.
Youll need to draw two intersecting diagonal lines:
The remaining drawing function isdraw_square.
It draws the symbol (cross or nought) in a given grid square, if there is one.
To complete that function, though, youll need to pull up the game state.
For example:
PICO-8 arrays begin at index 1, not index 0 as is typical in many languages.
It looks for non-empty matching values in the appropriate positions in the main grid array.
Packaging Your Game
Theres no point in creating a game unless others can play it.
Fortunately, PICO-8 has you covered.
UseEXPORT TICTACTOE.BINto create them.
Whichever format you choose, PICO-8 will export your files in the cartridge folder.
PICO-8 Might Be Just the Beginning
This simple game has plenty of potential for follow-up work.
You could make improvements to the graphics or add some logic to the CPUs moves.
You could also make a two-player version and allow the player to choose their symbol.
Most PICO-8 game developers make their creations available for free.