Polybox - Late ninties, PS1 inspired fantasy console

Overview

Polybox

Polybox is an in-development PS1 era fantasy console, a bit like Pico-8, but with simple 3D as well as 2D.

polybox render

It's still rather primitive and early in development, mostly it's just a dedicated PS1 renderer right now with an old fashioned fix function pipeline. You render objects like this:

gpu.MatrixMode(EMatrixMode::Projection);
gpu.Identity();
gpu.Perspective((float)320, (float)240, 1.0f, 20.0f, 60.0f);

gpu.MatrixMode(EMatrixMode::View);
gpu.Identity();
gpu.Translate(Vec3f(-1.5f, -1.5f, -2.0f));

gpu.BeginObject3D(EPrimitiveType::Triangles);
    gpu.Color(Vec4f(1.0f, 0.0f, 0.0f, 1.0f));
    gpu.Vertex(Vec3f(1.0f, 1.0f, 0.0f));

    gpu.Color(Vec4f(0.0f, 1.0f, 0.0f, 1.0f));
    gpu.Vertex(Vec3f(1.0f, 2.0f, 0.0f));

    gpu.Color(Vec4f(0.0f, 0.0f, 1.0f, 1.0f));
    gpu.Vertex(Vec3f(2.0f, 2.0f, 0.0f));
gpu.EndObject3D();

gpu.DrawFrame((float)winWidth, (float)winHeight);

The above gives you the following output:

polybox render

Current features

  • PS1 era fixed-function 3D rendering
  • Special shaders for emulating PS1 era look
  • Basic flat and smooth shaded lighting
  • Gltf model loading
  • 2D sprite drawing
  • Depth cueing fog

Planned features

  • Audio
  • Input
  • A Lua VM customized for emulating programming on PS1 hardware limits
  • A development environment for making games with the console
  • Development tools such as level editors made in the lua development environment
  • Some sample games

Supported platforms

Currently only Windows 64 bit. It shouldn't be that hard to port to other platforms though, as it uses bgfx for rendering and SDL for platform stuff. But it's early enough I have no interest in porting and testing on other platforms.

Documentation

Also too early for this, but the codebase is extremely simple and hopefully self documenting. The main API that is of interest is the GraphicsChip.h file. The entire rendering API is contained there in a very small amount of code, so small I can list it here,

void Init();
void DrawFrame(float w, float h);

// Basic draw 2D
void DrawSprite(const char* spritePath, float x, float y);

// Basic draw 3D
void BeginObject3D(EPrimitiveType type);
void EndObject3D();
void Vertex(Vec3f vec);
void Color(Vec4f col);
void TexCoord(Vec2f tex);
void Normal(Vec3f norm);

void SetClearColor(Vec3f color);

// Transforms
void MatrixMode(EMatrixMode mode);
void Perspective(float screenWidth, float screenHeight, float nearPlane, float farPlane, float fov);
void Translate(Vec3f translation);
void Rotate(Vec3f rotation);
void Scale(Vec3f scaling);
void Identity();

// Texturing
// ENable/Disable texturing
void BindTexture(const char* texturePath);
void UnbindTexture();

// Lighting
void NormalsMode(ENormalsMode mode);
void EnableLighting(bool enabled);
void Light(int id, Vec3f direction, Vec3f color);
void Ambient(Vec3f color);

// Depth Cueing
void EnableFog(bool enabled);
void SetFogStart(float start);
void SetFogEnd(float end);
void SetFogColor(Vec3f color);

Compiling

The project uses premake5, which is packaged alongside the project, as well as all the dependencies you'll need. You simple run premake5.exe vs2019 (or another project type) and you'll get your project you can compile with

Comments
  • 'EncodeBase64' & 'DecodeBase64' functions causes compile fail.

    'EncodeBase64' & 'DecodeBase64' functions causes compile fail.

    Both 'EncodeBase64' and 'DecodeBase64' have a return types of 'string', but attempt to return a integer in the form of NULL on lines 52 and 86, when certain conditions are met.

    I know next to nothing about how this might break the engine, but as a quick fix, I set both to return NULL as a string rather than a literal.

    opened by TheBorinator 1
  • Cannot open include file: 'format': No such file or directory

    Cannot open include file: 'format': No such file or directory

    When downloading a clean unedited version of Polybox, and attempting to build, I (maybe more people) run into a issue, multiple errors saying: Cannot open include file: 'format': No such file or directory which is preventing me from building. Is this a issue on my end, or a already known issue? And what is a solution/workaround?

    EDIT: Is there a include dependency or something different needed? I have saw fmt/<file>.h in multiple files, is fmtlib missing? And if so, how to correctly include it?

    opened by Jesse2431 1
  • Building

    Building

    Hi, I'm trying to build the project on Linux (not sure if that's possible). I'm getting this:

    $ lua premake5.lua                                                                                                                    
    lua: premake5.lua:2: attempt to index a nil value (global 'path')
    stack traceback:
            premake5.lua:2: in main chunk
            [C]: in ?
    

    I don't know the first thing about lua, and I tried both 5.1 and 5.4. I tried googling this message but most answers point to a scoping problem specific to the script, not missing dependencies (might be wrong though).

    Would you know what needs to be installed and how to build the project on Linux?

    opened by nukeop 0
  • FMV playback?

    FMV playback?

    Games in the PS1 loved their full motion video.

    It allowed them to display bombastic action, cinematic moments or even full-scale animations alongside the models (one famous example is some of the action moments in Final Fantasy VIII)

    phoboslab's pl_mpeg.h is the best single header lib for this kind of application, MPEG-1 video being very close to what the Motion Decoder in the PS1 hardware decoded blocks of. A file can also include MP2 audio thus also providing pretty much everything else needed for FMVs. The creator even outlines how to create a suitable file using FFmpeg.

    I'd only look into this after all the basic features of Polybox are done, specially if you look into doing the decoding in a thread (mimicking how it works in actual hardware)

    opened by GithubPrankster 0
  • PS1 Semi-Transparent modes?

    PS1 Semi-Transparent modes?

    These are quite a special feature of the PS1's GPU which tend to give even the transitions in games a really neat look, and come in 4 forms. They are implemented in emulators like Ares pretty succinctly as well. Very interesting project and I wish to keep an eye on it! :0

    opened by GithubPrankster 1
Owner
David Colson
Programmer at Cloud Imperium Games. This is all side projects and miscellaneous stuff. Interested in physics, maths, games and graphics.
David Colson
A port of the FNF Sonic.EXE mod to PS1. (Sunky and Multiplayer Update)

PSXFunkin VS Sonic.EXE on the PS1 ooga booga hes gonna getcha Compilation Refer to COMPILE.md here Disclaimer This project is not endorsed by the orig

Lord Scout 3 Sep 29, 2021
Emulation of classic VA synths of the late 90s/2000s that featured the Motorola 56300 family DSP

Gearmulator Emulation of classic VA synths of the late 90s/2000s that used the Motorola 56300 family DSP This project aims at emulating various musica

null 167 Jan 5, 2023
A late bound, hope-for-the-best dyld shared cache extractor

yolo_dsc A late bound, hope-for-the-best dyld shared cache extractor why? There are other dsc_extract utilities. They usually require some combination

Rick Mark 14 Mar 17, 2022
EKF-based late fusion

深蓝学院多传感器融合感知课程 项目实现了Lidar与Camera的后融合感知算法,融合的算法基于扩展卡尔曼滤波(Extended Kalman Filter,EKF)。输入数据为Lidar检测结果以及Camera检测结果,检测算法与Apollo 6.0一致,Lidar检测算法为PointPillar

深蓝学院 9 Dec 7, 2022
An in-progress matching decompilation of Final Fantasy VII For the PSX.

FFVII An in-progress decompilation of the original US release of Final Fantasy VII on the PSX. Building (Linux) Install build dependencies The build p

null 17 Dec 14, 2022
Send messages to a LED Matrix display through Telegram. Inspired by a tweet from Smarter Every Day

Send messages to a LED Matrix display through Telegram. Inspired by a tweet from Smarter Every Day

Brian Lough 23 Oct 8, 2022
C64 Watch is a customized T-Watch 2020 that was inspired by the Commodore 64 computer. It features a C64 theme and a built-in BASIC interpreter.

C64 Watch C64 Watch is a customized T-Watch 2020 that was inspired by the Commodore 64 computer. It features a C64 theme and a built-in BASIC interpre

Nick Bild 30 Nov 26, 2022
Fast and lightweight username lookup tool inspired by sherlock.

Lightweight username lookup inspired by Sherlock. Created in C++. Features Works on 250+ websites Fast, easy to use and compact How to use $ scout.exe

eternity 10 Jun 23, 2022
Samir Teymurov 1 Oct 6, 2021
Project in the field of Advanced Programming Techniques by prof. Brian Kernighan, inspired by real event that made Ken Thompson invent grep command

ed_to_grep Project in the field of Advanced Programming Techniques by prof. Brian Kernighan, inspired by real event that made Ken Thompson invent grep

mirko 1 Nov 1, 2022
Code for the Arduino-based BadUSB inspired from the legendary Rubber Ducky from Hak5

Arduino BadUSB A Ducky Script interpreter that runs on an Arduino, decodes and executes scripts saved on a microSD card. The goal of this project is t

Jota Lanusse 2 Nov 27, 2022
Bau Bau is a DIY 4 legged quadruped robot inspired for construction robotics course.

Bau-Bau-Robot Bau Bau is a DIY 4 legged quadruped robot inspired for construction robotics course. In this course, we are looking forward to solve a p

Adithya Chinnakkonda 1 Nov 19, 2021
a unix inspired, non posix compliant micro kernel (more of a monolithic kernel for now though) that i am working on in my spare time

toy-kernel a unix inspired, non posix compliant micro kernel (more of a monolithic kernel for now though) that i am working on in my spare time prereq

czapek 13 Nov 27, 2022
A polite conversation is a mini C++ project inspired by the game "The Turing Test".

A polite conversation A polite conversation is mini C++ project inspired by the game "The Turing Test". Installation You need clang and GNU readline l

null 2 Jan 5, 2022
PoC ransomware. Inspired by Mr. Robot

Fsociety Ransomware This is a small piece of software intended to be a PoC (Proof of Concept) of a ransomware with similar GUI to the one seen in Mr.

Benjamín Guzmán 4 Aug 22, 2022
A Quake Enhanced mod to manipulate entities. Inspired by the Half-Life metamod plugin 'Entmod'

QEEntmod A Quake Enhanced mod to manipulate entities. Inspired by the Half-Life metamod plugin 'Entmod' Can be used standalone or easily implemented i

null 2 Jul 5, 2022
An open source alternative to and inspired by IOBit Unlocker

EzUnlock An open source alternative to and inspired by IOBit Unlocker EzUnlock is a simple GUI application for deleting stuck / stale / undeletable fi

null 5 Aug 9, 2022
A Sol-inspired minimalist Lua binding for Zig.

zoltan A Sol-inspired minimalist Lua binding for Zig. Features Supports Zig 0.9.0 Lua tables table creation from Zig get/set/create methods possible k

null 79 Dec 4, 2022
un programma in console scritto in c++ che fa parodia a ordissimo OS // a program written in c++ that is a parody of ordissimo OS

un programma in console scritto in c++ che fa parodia a ordissimo OS // a program written in c++ that is a parody of ordissimo OS -what is this? -its

alex 5 Oct 31, 2021