Repository navigation
Your First Project
This guide creates a minimal BIT8_CLI project and runs your first .b8 program.
Before continuing, make sure BIT8_CLI is installed:
bit8 --versionSee Installation if you have not installed it yet.
Create a new directory:
mkdir my-bit8-game
cd my-bit8-gameCreate a file named:
main.b8
Your project now looks like:
my-bit8-game/
└── main.b8
Open main.b8 and add:
func init()
end
func update()
end
func draw()
cls(0)
pix(32, 32, 7)
endBIT8_CLI accepts func as a convenient form of Lua's function.
This program clears the screen and draws one pixel near the center of the 64×64 framebuffer.
From outside or inside the project directory, run BIT8_CLI with the project path.
For example:
bit8 run .BIT8_CLI loads the project and opens the game window.
You should see your first tiny pixel.
Congratulations. Your project is alive. 👾
A basic BIT8_CLI program can define three lifecycle functions:
func init()
end
func update()
end
func draw()
endCalled when the game starts.
Use it to initialize game state.
Called during the fixed simulation.
BIT8_CLI runs simulation updates at 30 Hz.
Use it for movement, input, game logic, timers, and state changes.
Used to draw the current game state.
Drawing functions such as cls() and pix() normally belong here.
Let's make the pixel move.
Replace main.b8 with:
x = 32
y = 32
func update()
if btn(LEFT) then
x = x - 1
end
if btn(RIGHT) then
x = x + 1
end
if btn(UP) then
y = y - 1
end
if btn(DOWN) then
y = y + 1
end
end
func draw()
cls(0)
pix(x, y, 7)
endRun the project again:
bit8 run .The directional controls now move the pixel around the framebuffer.
BIT8_CLI uses a fixed:
64 × 64
game framebuffer.
Game coordinates use this logical resolution even when the window is displayed at a larger size.
For example:
pix(0, 0, 7)draws at the top-left corner.
pix(32, 32, 7)draws near the center.
You now have a working BIT8_CLI project.
Continue with:
After that, explore:
The single pixel has officially begun its career. 👾
Current Version: 0.1.0