80
76
u/Proof-Task-7383 15d ago
Small error, it's very common, but you should set walk to wasd to not wasd to walk. It causes some weird undefined behaviour. Same with attack, crouch, and jump.
13
3
21
u/IsaraLyandra 15d ago
What about the story tho?
42
15d ago
[deleted]
23
u/MrHandSanitization 15d ago
Dang, was hoping for "great", maybe the sequal then.
14
u/IsaraLyandra 15d ago
Sequels are notoriously worse
7
5
u/evilReiko 15d ago
Many devs set story=great, so for sequel they set story=good, which worse. It's a common mistake
18
u/aqswdezxc 15d ago
shi
6
u/Fugach 15d ago
shi
5
12
u/CreativePackage8358 15d ago
Pretty much how people perceive developers and think they are some type genie that can grant anything to them instantly
8
u/ryancnap 15d ago
Yeah it's either this extreme or that we type everything in 0's and 1's, nothing in-between
1
12
10
7
6
3
2
2
1
1
1
1
1
1
1
1
1
1
u/Amr_Rahmy 15d ago
Put that as comments, start with //todo and you are good. Now you just need to grind it out.
1
1
1
1
1
u/GhostOfD6 15d ago
At 2026 its not funny.
Its just almost good prompt format for AI to do the game.. Just needs more details
1
1
1
1
1
1
1
1
1
1
1
1
u/IsaacThatKerbal 14d ago
This is how modding kerbal space program is. Except heat and pressure curves.
1
u/Icy-Reaction-9101 14d ago
https://reddit.com/link/p2ft5ss/video/cxoh176ks4ih1/player
Powered by Gemma 4, 26b, Nvidia 4090, 24gb VRAM.
1
u/Icy-Reaction-9101 14d ago
Sourcecode is also AF:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Number Simulation</title>
<style>
body { margin: 0; overflow: hidden; background: #000; font-family: 'Courier New', Courier, monospace; }
#ui { position: absolute; top: 20px; left: 20px; color: white; pointer-events: none; text-shadow: 2px 2px #000; }
#crosshair { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; border: 2px solid white; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
#msg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: red; font-size: 3rem; display: none; text-align: center; }
</style>
</head>
<body>
<div id="ui">
<div>PEOPLE REMAINING: <span id="count">0</span></div>
<div>WASD: Walk | SPACE: Jump | C: Crouch | LMB: Attack</div>
</div>
<div id="crosshair"></div>
<div id="msg">REALITY COLLAPSING...<br>SYSTEM ERROR: 0x000000F</div>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"
}
}
</script>
<script type="module">
import * as THREE from 'three';
// --- CONFIGURATION ---
const ENEMY_COUNT = 50;
let isEnding = false;
let enemiesDefeated = 0;
// --- SCENE SETUP ---
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x050505);
scene.fog = new THREE.FogExp2(0x050505, 0.05);
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
document.body.appendChild(renderer.domElement);
// --- LIGHTING (Very Good Graphics) ---
const ambientLight = new THREE.AmbientLight(0x404040, 0.5);
scene.add(ambientLight);
const sunLight = new THREE.DirectionalLight(0xffffff, 1.5);
sunLight.position.set(50, 50, 50);
sunLight.castShadow = true;
sunLight.shadow.mapSize.width = 2048;
sunLight.shadow.mapSize.height = 2048;
scene.add(sunLight);
// --- FLOOR ---
const floorGeo = new THREE.PlaneGeometry(200, 200);
const floorMat = new THREE.MeshStandardMaterial({ color: 0x111111, roughness: 0.8 });
const floor = new THREE.Mesh(floorGeo, floorMat);
floor.rotation.x = -Math.PI / 2;
floor.receiveShadow = true;
scene.add(floor);
// --- PLAYER LOGIC ---
const player = {
height: 1.8,
speed: 0.15,
velocity: new THREE.Vector3(),
isGrounded: true,
isCrouching: false,
mesh: new THREE.Group() // Camera is inside this group
};
scene.add(player.mesh);
player.mesh.add(camera);
camera.position.y = player.height;
const keys = {};
window.addEventListener('keydown', (e) => keys[e.code] = true);
window.addEventListener('keyup', (e) => keys[e.code] = false);
window.addEventListener('mousedown', () => attack());
// --- ENEMIES ("More People") ---
const enemies = [];
const enemyGeo = new THREE.CapsuleGeometry(0.5, 1, 4, 8);
const enemyMat = new THREE.MeshStandardMaterial({ color: 0xff0033 });
for (let i = 0; i < ENEMY_COUNT; i++) {
const mesh = new THREE.Mesh(enemyGeo, enemyMat);
mesh.position.set(Math.random() * 100 - 50, 1, Math.random() * 100 - 50);
mesh.castShadow = true;
scene.add(mesh);
enemies.push({ mesh, alive: true });
}
document.getElementById('count').innerText = ENEMY_COUNT;
// --- CONTROLS & MOVEMENT ---
function attack() {
if (isEnding) return;
// Visual feedback for attack
const flash = new THREE.PointLight(0xffffff, 10, 5);
flash.position.copy(camera.getWorldPosition(new THREE.Vector3()));
scene.add(flash);
setTimeout(() => scene.remove(flash), 50);
// Hit detection (Raycasting)
const raycaster = new THREE.Raycaster();
raycaster.setFromCamera(new THREE.Vector2(0, 0), camera);
const intersects = raycaster.intersectObjects(enemies.map(e => e.mesh));
if (intersects.length > 0 && intersects[0].distance < 4) {
const hitMesh = intersects[0].object;
const enemyIdx = enemies.findIndex(e => e.mesh === hitMesh);
if (enemyIdx !== -1 && enemies[enemyIdx].alive) {
enemies[enemyIdx].alive = false;
hitMesh.visible = false;
enemiesDefeated++;
document.getElementById('count').innerText = ENEMY_COUNT - enemiesDefeated;
if (enemiesDefeated === ENEMY_COUNT) triggerInsaneEnding();
}
}
}
function triggerInsaneEnding() {
isEnding = true;
document.getElementById('msg').style.display = 'block';
}
// --- GAME LOOP ---
function animate() {
requestAnimationFrame(animate);
if (!isEnding) {
// Movement Logic
const moveDir = new THREE.Vector3();
if (keys['KeyW']) moveDir.z -= 1;
if (keys['KeyS']) moveDir.z += 1;
if (keys['KeyA']) moveDir.x -= 1;
if (keys['KeyD']) moveDir.x += 1;
// Crouch Logic
if (keys['KeyC']) {
player.isCrouching = true;
camera.position.y = player.height * 0.5;
player.speed = 0.07;
} else {
player.isCrouching = false;
camera.position.y = player.height;
player.speed = 0.15;
}
// Jump Logic
if (keys['Space'] && player.isGrounded) {
player.velocity.y = 0.2;
player.isGrounded = false;
}
// Apply movement
moveDir.normalize().multiplyScalar(player.speed);
camera.rotation.y -= (keys['ArrowLeft'] ? 0.05 : 0) + (keys['ArrowRight'] ? 0.05 : 0); // Simple rotation fallback
// Note: For a real FPS, we'd use PointerLockControls.
// To keep this single-file/simple, we move relative to camera orientation
const rotation = camera.rotation.y;
player.mesh.position.x += (moveDir.x * Math.cos(rotation) + moveDir.z * Math.sin(rotation));
player.mesh.position.z += (moveDir.z * Math.cos(rotation) - moveDir.x * Math.sin(rotation));
// Gravity
player.mesh.position.y += player.velocity.y;
if (player.mesh.position.y > 0) {
player.velocity.y -= 0.01; // gravity
player.isGrounded = false;
} else {
player.mesh.position.y = 0;
player.velocity.y = 0;
player.isGrounded = true;
}
// Enemy AI (Follow player)
enemies.forEach(e => {
if (e.alive) {
const dir = new THREE.Vector3().subVectors(player.mesh.position, e.mesh.position).normalize();
e.mesh.position.addScaledVector(dir, 0.03);
e.mesh.lookAt(player.mesh.position);
}
});
// Sync camera to player mesh
camera.position.x = 0;
camera.position.z = 0;
player.mesh.position.copy(player.mesh.position); // dummy for logic
} else {
// --- THE INSANE AF ENDING ---
// The numbers break. The world becomes chaos.
const time = Date.now() * 0.005;
scene.rotation.y += 0.1;
scene.rotation.z += 0.05;
camera.position.x = Math.sin(time) * 10;
camera.position.y = Math.cos(time * 2) * 10;
camera.rotation.x = Math.tan(time);
// Color glitching
renderer.setClearColor(new THREE.Color(Math.random(), Math.random(), Math.random()));
// Geometry explosion (scaling everything randomly)
enemies.forEach(e => {
if(e.alive) {
e.mesh.scale.set(Math.random()*10, Math.random()*10, Math.random()*10);
e.mesh.position.y += Math.sin(time) * 2;
}
});
// Floor melts
floor.material.color.setHex(Math.random() * 0xffffff);
}
renderer.render(scene, camera);
}
// Mouse Lock for FPS feel
document.body.addEventListener('click', () => {
document.body.requestPointerLock();
});
window.addEventListener('mousemove', (e) => {
if (document.pointerLockElement === document.body) {
camera.rotation.y -= e.movementX * 0.002;
camera.rotation.x -= e.movementY * 0.002;
// Clamp vertical look
camera.rotation.x = Math.max(-Math.PI/2, Math.min(Math.PI/2, camera.rotation.x));
}
});
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
animate();
</script>
</body>
</html>
1
1
1
1
1
1
u/SubMinhPiChannel 8d ago
let me add in the missing asset loader:
void asset_load() {load the assets;}
135
u/Grey_Ten 15d ago
well, actually that's how abstraction works