PX8 is an open source fantasy console (128x128 pixels) in Rust, where the cartridge code could be in Python or Lua.
It is still in development but the main features are:
- 128x128 pixels, 16 colours
- Python 3 / Lua 5.X support for the cartridge
- Controls with dpad + 2 buttons (gamecontroller/joystick support)
- No limit size in the code !
- Unlimited sprites (8x8)
- Map support (128x32)
- Edition of the cartridge data
- PX8 format to use your favorite code editor
- Screenshot (PNG) / Video recording (GIF)
- Pico-8 (P8/P8.PNG) cartridge format support
- Mainly run @60 FPS
It should work on all platform (Linux/OSX/Windows), and on tiny hardware like Raspberry Pi (with opengl enabled).
The console is inspired from Pico-8, so you can play Pico-8 cartridges (P8/P8.PNG).
- Youtube Video
[] (https://youtu.be/b-secxed-fk "PX8 SKI")
- Recorded GIF
The time for each frame is slow (10ms) in the GIF, and doesn't correspond to the speed of the game (see the previous videos on Youtube).
- PX8
You can get directly the latest version via git:
git clone https://github.com/Gigoteur/PX8.git
cd PX8
Or you can get binaries for multiples platforms directly on itch.io:
- Raspberry Pi (available)
- Windows (Work in progress)
- Linux (Work in progress)
- Mac (Work in progress)
You will need multiple things:
- SDL2
- python3
- libreadline
Packages:
- libsdl2-dev
- libreadline-dev
- libpython3-dev
Please enable the GL Driver (7 - Advanced Options -> Ac - GL Driver -> Yes) via:
sudo raspi-config
You could build PX8 with cargo directly, in release mode for example, with the support of Python and Lua.
cargo build --features="cpython lua" --release
You should be able to run it directly by providing the path of the cartridge:
./target/release/px8 -s 4 ./games/ski/ski.px8
The '-s' option is the scale, so you can increase it, or in fullscreen by using '-f' option.
You can edit the cartridge by using the specific '-e' option:
./target/release/px8 -s 4 -e ./games/ski/ski.px8
Player 1:
- cursors, Z,X / C,V / N,M
Player 2:
- ESDF, LSHIFT,A / TAB,Q,E
System shortcut:
- F2: FPS debug
- F3: Take a screenshot
- F4: Take a video
- F5: Save the current cartridge
- F6: Switch between editor/play mode
PX8 could call 3 functions:
- _init : Called once on cartridge startup, mainly to initialize your variables
- _update: Called once per visible frame, mainly to get keyboard input for example
- _draw: Called once per visible frame, mainly to draw things on the screen :)
def _init():
print("INIT")
def _update():
px8_print("UPDATE")
def _draw():
px8_print("DRAW")
Format | Read | Write |
---|---|---|
P8 | β | β |
P8.PNG | β | π΄ |
PX8 | β | β |
See API
API | Python | Lua |
---|---|---|
sfx | π΄ | π΄ |
music | π΄ | π΄ |
API | Python | Lua |
---|---|---|
cartdata | π΄ | π΄ |
dget | π΄ | π΄ |
dset | π΄ | π΄ |
API | Python | Lua |
---|---|---|
camera | β | β |
circ | β | β |
circfill | β | β |
clip | π΄ | π΄ |
cls | β | β |
color | β | β |
cursor | π΄ | π΄ |
fget | π΄ | π΄ |
flip | π΄ | π΄ |
fset | π΄ | π΄ |
line | β | β |
β (px8_print) | β | |
pal | β | β |
palt | β | β |
pget | β | β |
β | β | |
pset | β | β |
rect | β | β |
rectfill | β | β |
sget | β | β |
spr | β | β |
sspr | β | β |
API | Python | Lua |
---|---|---|
btn | β | β |
btnp | β | β |
API | Python | Lua |
---|---|---|
map | β (spr_map) | β |
mget | π΄ | β |
mset | π΄ | β |
API | Python | Lua |
---|---|---|
rnd | β (random.randint) | β |
flr | β (math.floor) | β |
ceil | β (math.ceil) | β |
cos | β | β |
sin | β | β |
atan2 | π΄ | β |
sqrt | β (math.sqrt) | β |
abs | β (math.abs) | β |
sgn | β | β |
band | β | β |
bor | β | β |
bxor | β | β |
bnot | β | β |
shl | β | β |
shr | β | β |
sub | β | β |
API | Python | Lua |
---|---|---|
cstore | π΄ | π΄ |
memcpy | π΄ | π΄ |
memset | π΄ | π΄ |
reload | π΄ | π΄ |
API | Python | Lua |
---|---|---|
stat | π΄ | β |
peek | π΄ | π΄ |
poke | π΄ | π΄ |
API | Lua |
---|---|
add | β |
del | β |
min | β |
max | β |
mid | β |
foreach | β |
count | β |
all | β |
The version of LUA in Pico-8 has some differences with the original one.
Lua features | Compatibility |
---|---|
Compound assignment operators | β |
Single line shorthand for if then else operator | π΄ |
Not Equal To | π΄ |
GFX: β
MUSIC: π΄
PX8 + Python + Pymunk