Kevin Cubbin
950 posts

Kevin Cubbin
@sentorpete
If it’s not fun, I don’t want to do it


I’ve watched this move a million times I still don’t know what he did. Except that it worked






Al Green has been CENSURED. He should've been EXPELLED.


Day 10: Finally figured out how to decouple the FPS from the game's speed At slow FPS like on iPhone or M1 MacBooks the game would play very slowly because it'd use the requestAnimationFrame() for updating its physics That's now decoupled with this Claude-generated code It's very different coding a game than a website/app because you're essentially doing a constant loop of updating everything for every frame Every frame you re-calculate where the game's plane, physics, clouds are, or if anything is doing a collision (like your missile hitting a plane or you hitting the ground) Very different to code for and very interesting to learn about it Anyway here was the fix to decouple it from FPS: // function animate() { requestAnimationFrame(animate); const currentTime = performance .now(); const rawDeltaTime = (currentTime - lastFrameTime) / 1000; lastFrameTime = currentTime; // Limit maximum delta time to prevent huge jumps const maxDeltaTime = 0.25; // Maximum 250ms between frames const clampedDeltaTime = Math.min(rawDeltaTime, maxDeltaTime); timeAccumulator += clampedDeltaTime; const fixedTimeStep = 1/60; // Run fixed timestep updates while (timeAccumulator >= fixedTimeStep) { deltaTime = fixedTimeStep; // update physics here }
















