From e838d76e72dce8fa678deddf3d7babbc099782b2 Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Wed, 18 Jun 2025 16:57:52 +0200 Subject: [PATCH] Add Pokitto frontend --- README.md | 18 ++++++++++------ TODO.txt | 1 + frontend_espboy/frontend_espboy.ino | 10 +++++---- frontend_nibble/frontend_nibble.ino | 13 ++++++------ frontend_ringo/frontend_ringo.ino | 5 +++-- renderer.h | 32 +++++++++++++++++++++++------ 6 files changed, 54 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 27d479c..3becd6a 100644 --- a/README.md +++ b/README.md @@ -45,16 +45,22 @@ Please note however the game is still relatively simple and so **the physics IS - **No build system** is used, everything is in a **single compilation unit**, to build the game only a single compiler invocation is needed. This removes another bloat and dependency. - The compiled game INCLUDING ASSETS is **extremely small** -- depending on platform, game and compilation settings, a playable executable can take only around 128 kB; in normal scenarios it will most likely fit under 400 kB. - It is **exceptionally portable and future proof** thanks to having no dependencies besides C99 compiler. So far it was ported to: - - GNU/Linux, possible backends: SDL2, CSFML, X11 - - OpenBSD - - web browser JavaScript (via emscripten) - - TODO + - **GNU/Linux**: via SDL2, CSFML or X11 + - **Window$**: via SDL2 + - **OpenBSD**: via SDL2 + - **web browser**: via translation to JavaScript with emscripten + - **Circuitmess Ringo AKA MAKERphone** (32b 160 MHz, 520 KB RAM) + - on resource-limited computers in very limited ways (simplest rendering with low FPS, only loading tiniest maps, no ghosts, replays or audio): + - **Pokitto** (32bit 48 MHz CPU, 36 KB RAM) + - **Circuitmess Nibble** (32b 160 MHz CPU, 80 KB RAM) + - **ESPboy** (32b 160 MHz CPU, 80 KB RAM) - It also goes without saying the physics is **100% deterministic**, it behaves the same on every platform, independantly of rendering FPS. Besides others this allows for recording and playing back very small replays and creating press forward maps. - It is **super moddable and hackable**, the code is relatively simple and **well commented**, written to encourage hacking. There are no obstacles such as DRM, anti-cheating, obfuscation etc. Cheating and hacking is allowed, do literally what you want. -- **No codes of censorship, flags, furry mascots or similar political bullshit**. This is just a game. -- **No "modern" bullshit such as OOP, meme design patterns, scripting, sandboxes, "memory safety" and similar shit**. +- **No codes of censorship, flags, furry mascots or similar political bullshit.** +- **No "modern" bullshit such as OOP, Python, Docker, meme design patterns, scripting, sandboxes, "memory safety" and similar crap**. - It is **absolutely and completely public domain free software with ZERO conditions on use** under CC0, it is legally more free that most "FOSS" software, there is no copyleft or credit requirement, you can do ABSOLUTELY anything you want with the project. This is a **selfless project aiming for no benefit of the creator** (include any non-financial benefit as well), this is made purely to bring more good to the world without gaining any advantage for self. - This game has **PURE SOUL** and REAL oldschool graphics in the "PS1" style. No Unity or Unreal, no "retro" imitation shaders, no assets from a store. This isn't a wannabe retro 90s pretender, this IS a real 90s game. +- The game is **finished**, no need to update it ever. ## Manifesto diff --git a/TODO.txt b/TODO.txt index ce20cd0..1445830 100644 --- a/TODO.txt +++ b/TODO.txt @@ -16,6 +16,7 @@ fuck issue trackers :D - make some kinda repo for world record runs? how will they submit it? - final tests: - very long replay DID 1x + - absence of music file - different resolutions KINDA DID 1x - different settings (332, POTATO, ...) - crazy shit with physics KINDA DID diff --git a/frontend_espboy/frontend_espboy.ino b/frontend_espboy/frontend_espboy.ino index c207dda..65ee032 100644 --- a/frontend_espboy/frontend_espboy.ino +++ b/frontend_espboy/frontend_espboy.ino @@ -23,10 +23,9 @@ TFT_eSPI tft; #define LCR_SETTING_GHOST_MAX_SAMPLES 0 #define LCR_SETTING_332_COLOR 1 #define LCR_LOADING_COMMAND wdt_reset(); -#define S3L_SORT 0 -#define LCR_SETTING_MAP_MAX_BLOCKS 512 -#define LCR_SETTING_MAX_MAP_VERTICES 500 -#define LCR_SETTING_MAX_MAP_TRIANGLES 600 +#define LCR_SETTING_MAP_MAX_BLOCKS 280 +#define LCR_SETTING_MAX_MAP_VERTICES 300 +#define LCR_SETTING_MAX_MAP_TRIANGLES 300 #define LCR_SETTING_REPLAY_MAX_SIZE 0 #define LCR_SETTING_CAR_SHADOW 0 #define LCR_SETTING_PARTICLES 0 @@ -37,6 +36,9 @@ TFT_eSPI tft; #define LCR_SETTING_POTATO_GRAPHICS 1 #define LCR_SETTING_ENABLE_DATA_FILE 0 #define LCR_SETTING_ONLY_SMALL_MAPS 1 +#define S3L_SORT 0 +#define S3L_Z_BUFFER 0 +#define S3L_MAX_TRIANGES_DRAWN 16 #include "game.h" diff --git a/frontend_nibble/frontend_nibble.ino b/frontend_nibble/frontend_nibble.ino index 2280426..d19c995 100644 --- a/frontend_nibble/frontend_nibble.ino +++ b/frontend_nibble/frontend_nibble.ino @@ -16,21 +16,20 @@ #define LCR_SETTING_RESOLUTION_SUBDIVIDE 2 #define LCR_SETTING_GHOST_MAX_SAMPLES 0 #define LCR_LOADING_COMMAND wdt_reset(); -#define S3L_SORT 0 -#define LCR_SETTING_MAP_MAX_BLOCKS 400 -#define LCR_SETTING_MAX_MAP_VERTICES 450 -#define LCR_SETTING_MAX_MAP_TRIANGLES 600 +#define S3L_SORT 1 +#define S3L_Z_BUFFER 0 +#define S3L_MAX_TRIANGES_DRAWN 32 +#define LCR_SETTING_MAP_MAX_BLOCKS 350 +#define LCR_SETTING_MAX_MAP_VERTICES 300 +#define LCR_SETTING_MAX_MAP_TRIANGLES 500 #define LCR_SETTING_REPLAY_MAX_SIZE 0 #define LCR_SETTING_CAR_SHADOW 0 #define LCR_SETTING_PARTICLES 0 #define LCR_SETTING_LOG_LEVEL 0 #define LCR_SETTING_LOD_DISTANCE 100 #define LCR_SETTING_CAR_ANIMATION_SUBDIVIDE 0 - #define LCR_SETTING_FPS 25 - #define LCR_SETTING_POTATO_GRAPHICS 1 - #define LCR_SETTING_ENABLE_DATA_FILE 0 #define LCR_SETTING_ONLY_SMALL_MAPS 1 diff --git a/frontend_ringo/frontend_ringo.ino b/frontend_ringo/frontend_ringo.ino index 4e1bfe2..606e5b2 100644 --- a/frontend_ringo/frontend_ringo.ino +++ b/frontend_ringo/frontend_ringo.ino @@ -13,9 +13,9 @@ #define LCR_SETTING_RESOLUTION_SUBDIVIDE 2 #define LCR_SETTING_MUSIC 0 #define LCR_SETTING_GHOST_MAX_SAMPLES 0 -#define LCR_SETTING_MAP_MAX_BLOCKS 512 +#define LCR_SETTING_MAP_MAX_BLOCKS 650 #define LCR_SETTING_MAX_MAP_VERTICES 1024 -#define LCR_SETTING_MAX_MAP_TRIANGLES 1500 +#define LCR_SETTING_MAX_MAP_TRIANGLES 1550 #define LCR_SETTING_REPLAY_MAX_SIZE 0 #define LCR_SETTING_CAR_SHADOW 0 #define LCR_SETTING_PARTICLES 0 @@ -26,6 +26,7 @@ #define LCR_SETTING_TEXTURE_SUBSAMPLE 4 #define LCR_SETTING_ENABLE_DATA_FILE 0 #define LCR_SETTING_ONLY_SMALL_MAPS 1 +#define LCR_SETTING_SKY_SIZE 1 #define S3L_PERSPECTIVE_CORRECTION 0 #include "game.h" diff --git a/renderer.h b/renderer.h index f2b917f..53eed21 100644 --- a/renderer.h +++ b/renderer.h @@ -29,9 +29,15 @@ #define S3L_RESOLUTION_X LCR_EFFECTIVE_RESOLUTION_X #define S3L_RESOLUTION_Y LCR_EFFECTIVE_RESOLUTION_Y #define S3L_PIXEL_FUNCTION _LCR_pixelFunc3D -#define S3L_PERSPECTIVE_CORRECTION 2 -#define S3L_NEAR_CROSS_STRATEGY 1 -#define S3L_Z_BUFFER 1 + +#ifndef S3L_PERSPECTIVE_CORRECTION + #define S3L_PERSPECTIVE_CORRECTION 2 +#endif + +#ifndef S3L_NEAR_CROSS_STRATEGY + #define S3L_NEAR_CROSS_STRATEGY 1 +#endif + #define LCR_FONT_PIXEL_SIZE (1 + LCR_EFFECTIVE_RESOLUTION_X / 512) #define LCR_ANIMATE_CAR (LCR_SETTING_CAR_ANIMATION_SUBDIVIDE != 0) #define LCR_ANT_RESOLUTION (LCR_EFFECTIVE_RESOLUTION_Y <= 110) @@ -41,9 +47,16 @@ #define S3L_PERSPECTIVE_CORRECTION 0 #define S3L_NEAR_CROSS_STRATEGY 1 #define S3L_FLAT 1 - #undef S3L_Z_BUFFER - #define S3L_Z_BUFFER 2 // simplified - #define S3L_MAX_TRIANGES_DRAWN 64 // lower, in case sorting was turned on + + #ifndef S3L_Z_BUFFER + #define S3L_Z_BUFFER 2 // simplified + #endif + + #ifndef S3L_MAX_TRIANGES_DRAWN + #define S3L_MAX_TRIANGES_DRAWN 64 // lower, in case sorting was turned on + #endif +#else + #define S3L_Z_BUFFER 1 #endif #define S3L_NEAR (10 * (S3L_F / 16)) // too low value will cause overflows @@ -1041,8 +1054,15 @@ uint8_t _LCR_buildMapModel(void) if ( LCR_renderer.mapModel.vertexCount >= LCR_SETTING_MAX_MAP_VERTICES - 16 || LCR_renderer.mapModel.triangleCount >= LCR_SETTING_MAX_MAP_TRIANGLES - 16) + { _LCR_cullHiddenMapTris(); + if (LCR_renderer.mapModel.vertexCount >= LCR_SETTING_MAX_MAP_VERTICES - 16 + || LCR_renderer.mapModel.triangleCount >= LCR_SETTING_MAX_MAP_TRIANGLES + - 16) + break; // didn't help, no need to continue + } + for (int i = 0; i < blockShapeByteCount; ++i) { if (vi == 0)