synchro du labo (0bf0da65) : app.blade.php, README.md

This commit is contained in:
cloudion 2026-11-03 22:39:55 +00:00
parent 101df2dacf
commit 57368af65f
2 changed files with 121 additions and 2 deletions

View File

@ -1,3 +1,21 @@
# ploxion-monde-os # 🌍 Monde-OS
PLOXION · L'OS EST UN JEU (rs-4, José : « le xerboxion entier est un jeu vidéo, la fusion d'un OS et de Minecraft ; jOSEngine fait tourner le nexus = jeu décentralisé »). Monde 3D navigable où chaque ploxion est un BÂTIMENT, regroupés en QUARTIERS par catégorie (architecture) ; on marche (WASD + souris + VR), s'approcher d'un bâtiment + clic = ENTRER dans le ploxion. Streamé par CHUNKS (GTA-scale). Monté sur jOSEngine. · fournit: 3d, monde, os, jeu, navigation, nexus L'OS EST UN JEU (rs-4, RS-7 : « le xerboxion entier est un jeu vidéo, la fusion d'un OS et de Minecraft ; jOSEngine fait tourner le nexus = jeu décentralisé »). Monde 3D navigable où chaque ploxion est un BÂTIMENT, regroupés en QUARTIERS par catégorie (architecture) ; on marche (WASD + souris + VR), s'approcher d'un bâtiment + clic = ENTRER dans le ploxion. Streamé par CHUNKS (GTA-scale). Monté sur jOSEngine.
| | |
| --- | --- |
| id | `monde-os` |
| fournit | `3d` `monde` `os` `jeu` `navigation` `nexus` |
| bions qu'il nomme | `jOSApps` `jOSEngine` `jOSPorts` `jOSTsoin` |
| fichiers | `app.blade.php` |
| dans le labo | `resources/views/ploxions/monde-os/` (dépôt `my_website2`) |
## Contribuer
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=monde-os — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
- **Dans VS Code** : `xb prendre monde-os` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
© 2026 chill-tekk · ne pas nuire

101
app.blade.php Normal file
View File

@ -0,0 +1,101 @@
{{-- PL0XION monde-os 🌍 — L'OS EST UN JEU (rs-4, RS-7 : « le xerboxion entier est un jeu vidéo, la
fusion d'un OS et de Minecraft »). Tous les ploxions deviennent des BÂTIMENTS dans un monde 3D
qu'on traverse à pied (WASD + souris + VR), streamés par CHUNKS (jOSEngine.chunks) ; s'approcher
d'un bâtiment + clic = ENTRER dans le ploxion. Le desktop devient un monde à explorer. Réutilise
jOSEngine (moteur complet : rendu/input/caméra/chunks/VR). --}}
<style>
.mos{display:flex;flex-direction:column;height:100%;background:#05070e;color:#dfe7ff;font-family:var(--xr-font-ui,ui-sans-serif,system-ui);overflow:hidden}
.mos__stage{flex:1;min-height:0;position:relative}
.mos__stage canvas{width:100%;height:100%;display:block;cursor:crosshair}
.mos__near{position:absolute;left:50%;bottom:16%;transform:translateX(-50%);background:rgba(6,10,18,.82);border:1px solid rgba(95,224,192,.4);border-radius:10px;padding:7px 14px;font:800 .82rem ui-sans-serif;color:#5fe0c0;display:none;pointer-events:none}
.mos__cross{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:rgba(255,255,255,.5);pointer-events:none}
.mos__over{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;background:rgba(0,0,0,.72);cursor:pointer;text-align:center;padding:18px;z-index:3}
.mos__over h3{color:#5fe0c0;font:900 1.4rem ui-sans-serif;margin:0} .mos__over p{color:#9aa;font-size:.78rem;max-width:360px}
.mos__over .go{background:#5fe0c0;color:#04120e;border:0;border-radius:9px;padding:9px 18px;font:800 .85rem ui-sans-serif;cursor:pointer}
</style>
<script>
(function () {
'use strict';
function mount(container) {
container.innerHTML = '<div class="mos"><div class="mos__stage"><canvas></canvas>'
+ '<div class="mos__cross">+</div><div class="mos__near" data-near></div>'
+ '<div class="mos__over" data-over><h3>🌍 LE MONDE-OS</h3><p>Le xerboxion en monde 3D : chaque ploxion est un bâtiment. Marche (WASD + souris), approche-toi d\'un bâtiment et clique pour ENTRER. VR dispo.</p><button class="go">▶ explorer</button></div></div></div>';
var cv = container.querySelector('canvas'), near = container.querySelector('[data-near]'), over = container.querySelector('[data-over]');
if (!window.jOSEngine) { over.querySelector('p').textContent = 'jOSEngine absent.'; return { unmount: function () { container.innerHTML = ''; } }; }
var PL = (window.__PLOXIONS__ || []).slice(0, 400);
// QUARTIERS par catégorie (architecture, pas une grille plate) — vision RS-7
function catOf(p) { var s = (p.id + ' ' + (p.provides || []).join(' '));
if (/cam|photo|video|appel|media/.test(s)) return 'media'; if (/social|chat|amis|message|fil/.test(s)) return 'social';
if (/tsoin|machine|record|rejeu|montage|wormion/.test(s)) return 'tsoins'; if (/glyph|kion|koin|3d|carte|map|fractale|forme|geo/.test(s)) return 'formes';
if (/son|audio|music|radio|beat|jeu|doom/.test(s)) return 'jeu'; if (/science|paper|recherche|wiki|savoir|math|civil/.test(s)) return 'savoir';
if (/plugion|repo|api|web|browser|forge|flow/.test(s)) return 'web'; return 'outil'; }
var CATCOL = { media: 0x8a3b4b, social: 0x3b6a8a, tsoins: 0x6a3b8a, formes: 0x3b8a6a, jeu: 0x8a5a3b, savoir: 0x8a7a3b, web: 0x3b8a8a, outil: 0x2a3a5a };
var CATS = ['media', 'social', 'tsoins', 'formes', 'jeu', 'savoir', 'web', 'outil'];
// regroupe par catégorie, chaque quartier = un bloc de grille, séparés par des avenues
var GAP = 7, POS = [], ox = 0;
CATS.forEach(function (cat) { var list = PL.filter(function (p) { return catOf(p) === cat; }); if (!list.length) return;
var cols = Math.max(3, Math.ceil(Math.sqrt(list.length)));
list.forEach(function (p, i) { POS.push({ id: p.id, name: p.name || p.id, icon: p.icon || '◇', cat: cat, col: CATCOL[cat], x: ox + (i % cols) * GAP + 4, z: Math.floor(i / cols) * GAP + 4 }); });
ox += cols * GAP + GAP * 2; // avenue entre quartiers
});
var player = { x: 4, z: -4, ang: Math.PI / 2 }, playing = false, dead = false, target = null, chunksSys = null;
var eng = jOSEngine.create(cv, { ground: false, grid: false, fog: true, dist: 12, onReady: build });
function build(e) { var T = e.THREE;
// sol infini (grand plan) + brouillard donne la profondeur
var floor = new T.Mesh(new T.PlaneGeometry(2000, 2000), new T.MeshStandardMaterial({ color: 0x0b1220, roughness: 1 })); floor.rotation.x = -Math.PI / 2; floor.position.y = 0; e.add(floor);
e.world.scene.add(new T.GridHelper(2000, 400, 0x14233c, 0x0e1a2c));
// CHUNKS : ne construit que les bâtiments proches du joueur (GTA-scale : 400 ploxions ok)
chunksSys = e.chunks({ size: GAP * 3, radius: 3, generate: function (cx, cz, s) { var grp = new T.Group(); var x0 = cx * s, z0 = cz * s;
POS.forEach(function (b) { if (b.x >= x0 && b.x < x0 + s && b.z >= z0 && b.z < z0 + s) {
var h = 2 + (b.name.length % 5) + (b.id.charCodeAt(0) % 3); var m = new T.Mesh(new T.BoxGeometry(3, h, 3), new T.MeshStandardMaterial({ color: b.col, metalness: .25, roughness: .55, emissive: b.col, emissiveIntensity: .06 })); m.position.set(b.x, h / 2, b.z); m.castShadow = m.receiveShadow = true; grp.add(m);
b._h = h;
var tex = e.canvasTexture(function (g, sz) { g.fillStyle = 'rgba(6,12,22,.85)'; g.fillRect(0, 0, sz, sz); g.font = (sz * 0.5) + 'px serif'; g.textAlign = 'center'; g.textBaseline = 'middle'; g.fillText(b.icon, sz / 2, sz * 0.42); g.fillStyle = '#8fd8ff'; g.font = 'bold ' + (sz * 0.12) + 'px ui-sans-serif'; g.fillText((b.name || '').slice(0, 12), sz / 2, sz * 0.82); }, 128);
var sp = new T.Sprite(new T.SpriteMaterial({ map: tex, transparent: true })); sp.scale.set(2.4, 2.4, 1); sp.position.set(b.x, h + 1.6, b.z); grp.add(sp);
} }); return grp.children.length ? grp : null; } });
chunksSys.update(player.x, player.z); // 1er chargement autour du spawn
}
// caméra FPS = position joueur
eng.fps(function () { return { x: player.x, y: player.z, dx: Math.cos(player.ang), dy: Math.sin(player.ang), eye: 1.6 }; });
// on crée le système chunks une fois prêt (via onReady on n'a pas l'instance retour → on le fait ici)
eng.onUpdate(function (dt, e) {
if (!playing) return; var k = e.input.keys;
player.ang += ((k.arrowright ? 1 : 0) - (k.arrowleft ? 1 : 0)) * 1.8 * dt + e.input.mdx * 0.003;
var f = (k.w || k.arrowup ? 1 : 0) - (k.s || k.arrowdown ? 1 : 0), sp = (k.shift ? 16 : 8) * dt;
var stf = (k.d ? 1 : 0) - (k.a ? 1 : 0);
player.x += Math.cos(player.ang) * sp * f + Math.cos(player.ang + Math.PI / 2) * sp * stf;
player.z += Math.sin(player.ang) * sp * f + Math.sin(player.ang + Math.PI / 2) * sp * stf;
if (chunksSys) chunksSys.update(player.x, player.z);
// ploxion visé : le + proche devant (< 4u)
target = null; var bestd = 16;
POS.forEach(function (b) { var dx = b.x - player.x, dz = b.z - player.z, d = dx * dx + dz * dz; if (d > bestd) return;
var fx = Math.cos(player.ang), fz = Math.sin(player.ang); var dot = (dx * fx + dz * fz) / (Math.sqrt(d) || 1); if (dot > 0.6) { bestd = d; target = b; } });
if (target) { near.style.display = 'block'; near.textContent = '▶ ' + target.icon + ' ' + target.name + ' — clique pour entrer'; } else near.style.display = 'none';
// MULTIJOUEUR : le nexus rend le monde PARTAGÉ (les autres joueurs marchent dedans)
netT2 += dt; if (net && netT2 > 2) { netT2 = 0; net.send({ x: player.x, z: player.z, av: myAvatar() }); net.poll(function (list) { renderPeers(e, list || []); }); }
e.hud('🌍 monde-os · ' + POS.length + ' ploxions · 👥 ' + peerMeshes.length + ' · WASD + souris');
});
var net = null, netT2 = 0, peerMeshes = [];
setTimeout(function () { try { net = eng.net('monde-os'); } catch (e) {} }, 500);
function myAvatar() { try { return JSON.parse(localStorage.getItem('avatar:nexus') || 'null'); } catch (e) { return null; } }
function renderPeers(e, list) { var T = e.THREE; peerMeshes.forEach(function (m) { e.world.scene.remove(m); }); peerMeshes = [];
list.forEach(function (o) { if (o.x == null) return; var av = o.av || {}; var col = av.body ? parseInt(av.body.slice(1), 16) : 0xff6a9a;
var geo = av.shape === 'box' ? new T.BoxGeometry(0.6, 1, 0.4) : av.shape === 'sphere' ? new T.SphereGeometry(0.5, 12, 12) : new T.CapsuleGeometry(0.3, 0.6, 4, 8);
var m = new T.Mesh(geo, new T.MeshStandardMaterial({ color: col, emissive: col, emissiveIntensity: .3 })); m.position.set(o.x, 1, o.z); e.add(m); peerMeshes.push(m); }); }
cv.addEventListener('click', function () { if (!playing) return; if (!eng.input.locked) eng.input.lock();
if (target) { try { window.jOS && jOS.openPloxion && jOS.openPloxion(target.id); } catch (e) {} try { window.jOSPorts && jOSPorts.emit('monde-os', 'enter', { id: target.id }); } catch (e) {} } });
// VR
setTimeout(function () { try { eng.xr.button(cv.parentNode, 'immersive-vr'); } catch (e) {} }, 400);
over.addEventListener('click', function () { playing = true; over.style.display = 'none'; eng.input.lock();
try { (window.__tsoinMark || (window.jOSTsoin && window.jOSTsoin.mark))('monde-os', 'l os est un jeu'); } catch (e) {} });
return { unmount: function () { dead = true; try { eng.dispose(); } catch (e) {} container.innerHTML = ''; } };
}
window.jOSApps = window.jOSApps || {};
window.jOSApps['monde-os'] = { manifest: { id: 'monde-os', name: 'Monde-OS', icon: '🌍' }, mount: mount };
})();
</script>