📄 Karakteristiks




Definition: Kolorlando is a 3D game. A voxel world in which you play a voxel character.

About: This file contains extensive ordered lists, google orgcharts and reference images.


📜 Legend

done

not done

not used (done but not implemented)

to-improve

implemented-in

🎮 Game

Runtime and main local systems.

Game Flow:

  1. Load page
  2. Check screen mode
  3. Detect anonymous / log in user

Mindmap

Link

🖥️ Screen
  1. Resizing
  2. script.js, code/graphics/screen.js

  3. Desktop mode, mobile-portrait mode and mobile-landscape mode
  4. code/graphics/screen.js, style.css, script.js

📱 Mobile mode
  1. Left joystick for movement and right joystick for camera
  2. script.js, singleplayer.html, style.css

  3. Pinch to zoom and switch camera mode.
  4. script.js, code/graphics/screen.js

📷 Camera
  1. 3D Camera
  2. script.js, code/graphics/camera.js

  3. Skyrim Camera
  4. Zoomable camera from First Person mode to Third Person Mode script.js, code/graphics/camera.js

  5. WoW Camera
  6. script.js, code/graphics/camera.js

  7. Lego LoL Camera
  8. script.js, code/graphics/camera.js

🎛️ UI - User Interface
  1. Hotbar
  2. 8 item slots code/UI/inventory.js, singleplayer.html, style.css

  3. Minimap
  4. code/UI/minimap.js, singleplayer.html, style.css

  5. Chat
  6. code/UI/chat.js, singleplayer.html, style.css

  7. Consola
  8. Shows FPS (Frames per second) and player coords (XYZ) script.js, singleplayer.html, style.css

  9. Joysticks
  10. Mobile only script.js, singleplayer.html, style.css

  11. Panel menu
  12. Shows Encyclopedia, Inventory, Character, Settings and About code/UI/menu.js, code/UI/menuPanelMarkup.js, singleplayer.html, multiplayer.html, style.css

  13. Icon
  14. Inventory, hotbar, encyclopedia and equipment icons code/UI/icon.js

Link

🧍 Player
  1. Movement, double jump and crouch.
  2. script.js

    Crouch has no dedicated file yet.

  3. Step-up movement over one-block obstacles
  4. script.js

  5. Fly mode
  6. script.js, code/commands.js

  7. Debug mode (see collisions)
  8. script.js, code/commands.js

  9. Inventory
  10. 32 item slots, 99 stack item slots

    code/UI/inventory.js, script.js, singleplayer.html

  11. Customizable characters
    1. Face creator
    2. Clothing design

    singleplayer.html, script.js, code/entities/entityModel.js, sfcFace.js, index.html, /web/SquareFaceCreator/index.html, /web/SquareFaceCreator/script.js

  12. Equipment/wearables
  13. singleplayer.html, style.css

  14. Tools
  15. weapons/goxels (gltf models scaled 0.1 and centered on X Y Z) script.js, code/entities/itemAppearance.js

  16. HUD
  17. with health bar, selected voxel playerHud.js, code/UI/inventory.js, singleplayer.html, style.css

  18. Left and right punch
  19. script.js, code/entities/entityModel.js

  20. Shooting
  21. script.js

  22. Telekinesis
  23. Moving, pulling or pushing objects around from a distance

  24. user profile chart
  25. Little user info panel UI/userProfile.html

🧰 Item
  1. Shared item definitions
  2. Items now have stable ids, labels, descriptions, icons and world appearance data code/item.js

  3. Holdable items
  4. Weapons and tools can declare hand attachment data and action type code/item.js

  5. Wearable equipment flow
  6. Wearable item definitions exist, but the full equipment system is not connected yet code/item.js, singleplayer.html, style.css

  7. Stable inventory item ids
  8. Inventory-facing items are moving away from display-name-only identity code/item.js, code/UI/inventory.js, script.js

🧠 Memory
  1. Anonymous Localhost
  2. world, player,

  3. Logged in online database
  4. world, player,

  5. Multiplayer World Persistence
🌍 World
  1. World Menu Panel
  2. code/UI/worldMenu.html and code/UI/worldMenu2.html

  3. Save / Load world data locally
  4. NPCs (walker, chaser, talker)
  5. code/entities/entity.js, maps/voxelandiaMap.js, maps/cityMap.js, script.js

  6. Animals
  7. No implementation file yet.

  8. Pets
  9. No implementation file yet.

  10. Mounts / Vehicles
  11. code/entities/vehicle.js, script.js

    1. Spaceship
    2. code/entities/vehicle.js, script.js

🧱 Voxel
  1. 12 different voxels
  2. maps/voxelandiaMap.js, code/UI/inventory.js

  3. Voxel placement and removal
  4. script.js, maps/voxelandiaMap.js

  5. Creative mode and Survival mode
  6. code/UI/inventory.js, script.js, singleplayer.html

  7. Boxel Selection Tool
  8. Item created, you can save boxels though command /saveBoxel myHouse and spawn them by /spawn myHouse

  9. Effortless Building
  10. Select a blue voxel box, place blocks in bulk. Save and load voxel data

  11. Chisel and bits
  12. Edit voxels on a 16³ microvoxel basis. Creating custom voxels.

  13. Paint on voxels
  14. Self-explanatory

    Voxel and Boxel classes

    Voxel compatibility layer
    3 classes
    
    .microxel
    -Microxel 
    --position = { x:0, y:0, z:0}
    --color = "#ffffff"
    
    .voxel
    -Voxel
    --position = { x:0, y:0, z:0}
    --color = "#ffffff"
    Will draw a 6 face cube with color on it
    --texture = "grass.png"
    Will draw a 6 face cube with "grass.png" on each face
    --pixelTexture = []
    We will asign a custom texture painting pixels on each face
    --microxels = [];
    
    .boxel
    -Boxel 
    --position = { x:0, y:0, z:0}
    --size = 15^3
    --voxels = []
    
    .world
    -World
    --boxels = []
    
    
🎮 Input / Controls

Desktop

  1. WASD for movement
  2. script.js, singleplayer.html

  3. Space for jump
  4. Cursor for aiming the camera through rotation.

Mobile

  1. Joysticks
⌨️ Commands
  1. /debugmode
  2. Shows debug information like collisions or raycasts code/commands.js, script.js

  3. /flymode
  4. (enables flying) code/commands.js, script.js

  5. /spawn
  6. (respawns player) code/commands.js, script.js

  7. /saveBoxel TreeExample
  8. Saves a Boxel locally using Boxel Selection Tool's selection as reference

  9. /spawn TreeExample
  10. Spawns a Boxel, boxelmenu.html

  11. /noclip
  12. Avoid colliding with colliders like a Ghost

🌐 Multiplayer
  1. Presence
  2. Remote sessions detection code/multiplayer/multiplayer.js, multiplayer.html, index.html

  3. Broadcasting
  4. Low-latency updates on position, rotation and animation. code/multiplayer/multiplayer.js

  5. Authentication
  6. index.html, code/auth/Kusers.js, webscript.js, webstyle.css

  7. Chat
  8. code/UI/chat.js, singleplayer.html, multiplayer.html, style.css

Play Online Plan

- Kolorlando online with Supabase

- Online features
- anonymous players can join the world
- players can see other players in the world

- create a Supabase project
- design the database tables
- add player login or guest profiles
- connect the game to Supabase
- save and load game data
- add multiplayer or shared scores if needed
- test everything locally
- deploy the game online
- test the live version


0 - Most basic version:
Supabase Realtime Presence
- required custom tables: `0`
- anonymous login can use Supabase Auth anonymous users
- live player presence can use Supabase Realtime Presence
- Supabase still stores auth users internally, but that is not a table we create

Issues: SRP is laggy for low latency changes

1 - Supabase Broadcast
***A 

- Broadcast + Presence plan
- Step 1
- keep Supabase anonymous auth as the player identity layer
- keep one shared room channel for the same world
- in Supabase, create the project and copy the project URL and anon key
- in Supabase Auth, enable anonymous sign-ins

- Step 2
- keep Presence only for lightweight state
- use Presence for join, leave, session id, player id, and maybe display name or color
- stop using Presence for frequent position updates
- anonymous auth gives a stable guest user id
- it does not guarantee one different player identity per browser tab

- Step 3
- add Broadcast for real-time gameplay messages
- use Broadcast for position, rotation, moving state, emotes, attacks, and temporary actions
- treat Broadcast as transient live traffic, not saved data

- Step 4
- on connect, subscribe to the room channel
- sign in anonymously first
- after subscription, publish Presence once so the player appears in the online list
- then start listening for Broadcast packets from other players

- Step 5
- send local transform updates through Broadcast on a throttle
- start around `10` sends per second
- only send when the player changed enough in position, rotation, or movement state
- keep a separate generated session id for each tab or page session
- use auth user id as player identity and session id as live instance identity

- Step 6
- keep remote players client-side
- when a Broadcast packet arrives, update that remote player's target transform
- smooth movement locally with interpolation so motion still looks fluid between packets

- Step 7
- use Presence sync to manage the roster
- create remote avatars when a new session appears
- remove remote avatars when a session disappears
- use Broadcast only to drive motion and temporary actions for sessions that are already present

- Step 8
- handle late join and fallback behavior
- when a player first appears through Presence, place them at a safe default until their first Broadcast transform arrives
- if Broadcast packets stop for a short time, keep the avatar visible but idle
- if Presence removes the session, delete the avatar

- Step 9
- keep database tables at `0` for this version
- add a `players` table only if you want persistent profile data
- add a `world_state` table only if world edits must survive after everyone leaves

- Step 10
- test in this order
- one tab: confirm connect, roster count, and no errors
- two tabs: confirm both players appear and movement is smoother than Presence-only
- three to five tabs: confirm traffic stays stable and players clean up correctly on leave
- remote network throttling: confirm interpolation still looks acceptable

- Step 11
- success criteria
- Presence updates the online roster correctly
- Broadcast drives movement with lower visible lag
- no custom tables are required for the first playable online version

Keeping one session for logged-in user
add userId to Presence
detect duplicate authenticated users
choose winner by timestamp
disconnect older tab
later, if needed, back it with a DB active_session

***

--------

- Custom tables for persistent data
- `players` for saved profile, color, last position, settings, or progress
- `world_state` if world changes must persist after everyone leaves
- `messages` for chat
    
⚙️ Settings
  1. dark / light theme
  2. code/UI/menu.js, code/UI/menuPanelMarkup.js, style.css

  3. fullscreen
  4. code/UI/menu.js, code/UI/menuPanelMarkup.js, singleplayer.html, multiplayer.html

  5. shadows
  6. code/UI/menuPanelMarkup.js, script.js

  7. Background music
  8. code/UI/menuPanelMarkup.js, singleplayer.html, multiplayer.html

    UI only for now.

    Performance plan

    
    Voxel generation -> chunk -> voxel face culling and greedy meshing
    
    2. Prioridad crítica: reemplazar claves string "x,y,z" por datos compactos
    El guardado usa buildVoxelEditKey(cellX, cellY, cellZ) y almacena todo en voxelEdits con claves tipo string. Eso mete sobrecoste de objetos, strings y hashing.
    Pasa el runtime a typed arrays o índices numéricos por chunk.
    Deja las strings solo para exportación, debug o compatibilidad.
    Impacto: muy alto en RAM.
    
    3. Prioridad crítica: separar el mundo en chunks
    El sistema actual de voxelEdits es global por mundo, no chunkificado.
    Divide el mapa en chunks de 16³ o 32³.
    Carga, genera y guarda solo chunks cercanos al jugador.
    Descarga chunks lejanos de RAM.
    Impacto: muy alto en RAM y escalabilidad.
    
    4. Prioridad muy alta: regenerar solo el chunk tocado
    Si cambias un vóxel, no debes reconstruir más geometría de la necesaria.
    Cada edición debería marcar como “dirty” solo ese chunk y quizá chunks vecinos si toca borde.
    Impacto: muy alto en CPU y fluidez.
    
    5. Prioridad muy alta: face culling de vóxeles ocultos
    Si todavía estás creando caras internas entre bloques pegados, estás quemando RAM GPU y draw cost para nada.
    Renderiza solo las caras expuestas.
    Impacto: brutal si el mundo tiene masa sólida.
    
    6. Prioridad muy alta: greedy meshing
    Después del culling, une caras contiguas del mismo material en quads grandes.
    Es de las mejores mejoras en voxel engines.
    Impacto: brutal en vértices, buffers y GPU.
    
    7. Prioridad alta: revisar el renderer extra de preview
    script.js importa mucho sistema y además ya te vi con una estructura bastante cargada; si mantienes una segunda escena/renderer para preview del personaje, eso suma memoria GPU y lógica paralela.
    Mejor:
    pausar el preview cuando no esté visible
    bajar resolución del canvas preview
    reutilizar recursos si puedes
    Impacto: alto si el menú está vivo mucho tiempo.
    
    8. Prioridad alta: reducir la cantidad de recursos residentes
    script.js centraliza muchísimas importaciones: audio, minimapa, menú, inventario, chat, entidades, vehículos, loaders, multijugador, mapas... todo eso junto puede dejar demasiadas cosas vivas a la vez.
    Carga módulos pesados bajo demanda.
    No inicialices sistemas que no se usan en la pantalla actual.
    Impacto: alto en RAM inicial y tiempo de arranque.
    
    9. Prioridad alta: reutilizar materiales y geometrías
    En voxel games, crear materiales o geometrías repetidas te destroza memoria y GC.
    Usa atlas de texturas y un conjunto pequeño de materiales compartidos.
    Libera con dispose() lo que ya no uses.
    Impacto: alto en GPU RAM y fugas.
    
    10. Prioridad media-alta: separar datos por tipo
    No mezcles en la misma estructura:
    vóxeles
    entidades
    jugador
    iluminación
    metadata
    Ahora el save ya separa player y voxelEdits, lo cual va bien como base.
    Llévalo más lejos dentro del runtime.
    Impacto: medio-alto en orden y mantenimiento.
    
    11. Prioridad media: lazy loading de mapas y assets
    En script.js importas varios mapas (simpleMap, cityMap, voxelandiaMap) desde el arranque.
    Carga solo el mapa seleccionado.
    Lo mismo para modelos GLTF y sistemas visuales opcionales.
    Impacto: medio en memoria inicial.
    
    12. Prioridad media: instrumentación real
    Mide:
    chunks activos
    vóxeles editados
    vértices por chunk
    tiempo de rebuild
    tamaño serializado del save
    Sin eso, vas un poco a ciegas.
    Impacto: medio, pero te dice dónde está el puto cuello real 😈
    
    Orden recomendado de ejecución
    1) debounce del guardado
    2) chunking
    3) typed arrays / índices numéricos
    4) rebuild solo de chunk afectado
    5) face culling
    6) greedy meshing
    7) recorte de sistemas/renderers extra
    8) lazy loading y limpieza de recursos
                

🕸️ Web

Landing page, account entry, world access and page navigation.

🔗 Links

Extras

What do you expect to achieve with a game like Kolorlando?

I want to create a voxel metaversial experience.

A compatibility layer for voxel creation, editing and share.

People can mod and create around this game and take it to different scopes.

For example people could design their own Guns, armor, spaceship...

TODO

SquareFaceCreator load pre's workflow

Menu > Boxel > isometric grid icon image maker la imagen está alargada a lo alto. Corregir

Unificar bien ICONOS (hotbar,encyclopedia,inventory,equipment)

Userprofile preview

World menu (create) online

Blockbench implementation

entity Model, animations

In-game spatial dialogue system (entity>talker)

In-game item content preview like minetest reading a book