Build Status

PX8

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).

[PX8 SKI] (https://youtu.be/b-secxed-fk "PX8 SKI")

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).

Download

You can get directly the latest version via git: git clone https://github.com/Gigoteur/PX8.git cd PX8

Binaries

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)

Requirements

You will need multiple things: * SDL2 * python3 * libreadline

Linux

Packages: * libsdl2-dev * libreadline-dev * libpython3-dev

Raspberry Pi

Please enable the GL Driver (7 - Advanced Options -> Ac - GL Driver -> Yes) via: sudo raspi-config

OSX

Build

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

Run a cartridge

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.

Edit a cartridge

You can edit the cartridge by using the specific '-e' option: ./target/release/px8 -s 4 -e ./games/ski/ski.px8

Keyboard Shortcut

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

Game controller / Joystick

Change shortcuts

Add player

Create a new cartridge

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 :)

Python

``` def _init(): print("INIT")

def update(): px8print("UPDATE")

def draw(): px8print("DRAW") ```

Lua

```

```

Cartridge format

Format | Read | Write ------------ | ------------- | ------------- P8 | :whitecheckmark: | :whitecheckmark: P8.PNG | :whitecheckmark: | :redcircle: PX8 | :whitecheckmark: | :whitecheck_mark:

API documentation

See API

PX8 Format documentation

Compatible API with Pico-8

Audio

API | Python | Lua ------------ | ------------- | ------------- sfx | :redcircle: | :redcircle: music | :redcircle: | :redcircle:

Cart Data

API | Python | Lua ------------ | ------------- | ------------- cartdata | :redcircle: | :redcircle: dget | :redcircle: | :redcircle: dset | :redcircle: | :redcircle:

Graphics

API | Python | Lua ------------ | ------------- | ------------- camera | :whitecheckmark: | :whitecheckmark: circ | :whitecheckmark: | :whitecheckmark: circfill | :whitecheckmark: | :whitecheckmark: clip | :redcircle: | :redcircle: cls | :whitecheckmark: | :whitecheckmark: color | :whitecheckmark: | :whitecheckmark: cursor | :redcircle: | :redcircle: fget | :redcircle: | :redcircle: flip | :redcircle: | :redcircle: fset | :redcircle: | :redcircle: line | :whitecheckmark: | :whitecheckmark: print | :whitecheckmark: (px8print) | :whitecheckmark: pal | :whitecheckmark: | :whitecheckmark: palt | :whitecheckmark: | :whitecheckmark: pget | :whitecheckmark: | :whitecheckmark: print | :whitecheckmark: | :whitecheckmark: pset | :whitecheckmark: | :whitecheckmark: rect | :whitecheckmark: | :whitecheckmark: rectfill | :whitecheckmark: | :whitecheckmark: sget | :whitecheckmark: | :whitecheckmark: spr | :whitecheckmark: | :whitecheckmark: sspr | :whitecheckmark: | :whitecheck_mark:

Input

API | Python | Lua ------------ | ------------- | ------------- btn | :whitecheckmark: | :whitecheckmark: btnp | :whitecheckmark: | :whitecheckmark:

Map

API | Python | Lua ------------ | ------------- | ------------- map | :whitecheckmark: (sprmap) | :whitecheckmark: mget | :redcircle: | :whitecheckmark: mset | :redcircle: | :whitecheck_mark:

Math

API | Python | Lua ------------ | ------------- | ------------- rnd | :whitecheckmark: (random.randint) | :whitecheckmark: flr | :whitecheckmark: (math.floor) | :whitecheckmark: ceil | :whitecheckmark: (math.ceil) | :whitecheckmark: cos | :whitecheckmark: | :whitecheckmark: sin | :whitecheckmark: | :whitecheckmark: atan2 | :redcircle: | :whitecheckmark: sqrt | :whitecheckmark: (math.sqrt) | :whitecheckmark: abs | :whitecheckmark: (math.abs) | :whitecheckmark: sgn | :whitecheckmark: | :whitecheckmark: band | :whitecheckmark: | :whitecheckmark: bor | :whitecheckmark: | :whitecheckmark: bxor | :whitecheckmark: | :whitecheckmark: bnot | :whitecheckmark: | :whitecheckmark: shl | :whitecheckmark: | :whitecheckmark: shr | :whitecheckmark: | :whitecheckmark: sub | :whitecheckmark: | :whitecheck_mark:

Memory

API | Python | Lua ------------ | ------------- | ------------- cstore | :redcircle: | :redcircle: memcpy | :redcircle: | :redcircle: memset | :redcircle: | :redcircle: reload | :redcircle: | :redcircle:

Peek Poke

API | Python | Lua ------------ | ------------- | ------------- stat | :redcircle: | :whitecheckmark: peek | :redcircle: | :redcircle: poke | :redcircle: | :red_circle:

Specific Lua functions

API | Lua ------------ | ------------- add | :whitecheckmark: del | :whitecheckmark: min | :whitecheckmark: max | :whitecheckmark: mid | :whitecheckmark: foreach | :whitecheckmark: count | :whitecheckmark: all | :whitecheckmark:

Pico-8 compatibility

The version of LUA in Pico-8 has some differences with the original one.

Lua features | Compatibility ------------ | ------------- Compound assignment operators | :whitecheckmark: Single line shorthand for if then else operator | :redcircle: Not Equal To | :redcircle:

GFX: :whitecheckmark:

MUSIC: :red_circle:

Screenshots and Records

With a physical engine

PX8 + Python + Pymunk