DAY 7 - BIG DAY! Live AI coding "Junkwars" #vibejam

Volo BuildsAbout 6 min readMar 30, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

  • Junk Wars: A live, multiplayer browser game developed and streamed by the speaker.
  • State Management: Handling and synchronizing game data across the server and multiple clients.
  • Cloudflare Durable Objects: A serverless platform used for hosting the game's backend.
  • Pointer Lock: A browser API that locks the mouse cursor to the game window for continuous control.
  • AI-Assisted Development: Using AI tools like Cursor and Gemini to generate code and troubleshoot issues.
  • Ammo Cap: Limiting the maximum amount of ammunition a player can carry.
  • Anti-Camping Mechanism: Implementing features to discourage players from staying in one spot for too long.
  • Scoreboard: A UI element displaying player scores.
  • Hitbox Meshes: Debugging tools to visualize the collision areas of game objects.

Game Launch and Initial Bugs

The speaker announces the live launch of his game, Junk Wars, accessible at junkwars.net. He acknowledges the presence of bugs and outlines his immediate priorities: fixing existing issues and implementing new features like a scoreboard.

  • Bug Fixes: The initial focus is on resolving a bug where items respawn excessively upon player death, causing lag. Refreshing the browser is a temporary workaround.
  • Cloudflare: The speaker mentions that the initial problem was not Cloudflare but his old server design.
  • Feature Roadmap: Planned features include mobile controls, an improved scoreboard, and better kill notifications.

Addressing Item Respawning Bug

The speaker dives into fixing the item respawning bug, which he initially thought was resolved.

  • Local vs. Live: The bug is not reproducible on his local development server, making it harder to diagnose.
  • Root Cause: The issue is identified as excessive item respawning on player death, leading to performance degradation.
  • Temporary Fix: Refreshing the browser clears the excess items.

Pointer Lock Issue

The speaker encounters a problem with pointer lock, where the mouse cursor remains locked to the game window even after the player dies, preventing them from clicking the respawn button.

  • Inconsistent Behavior: The issue is not consistently reproducible on the speaker's machine.
  • Code Examination: The speaker reviews the code responsible for requesting and releasing pointer lock.
  • Potential Solution: The speaker identifies a conditional statement that might be causing the issue.

Soundtrack Promotion

The speaker promotes the game's soundtrack, created using AI tools.

  • AI-Generated Music: The soundtrack is described as a mix of metal and drum and bass, similar to Pendulum.
  • Sunno Integration: The speaker used Sunno to edit and arrange the AI-generated tracks.
  • Optional Feature: The soundtrack will be added to the game as an optional toggle.

Scoreboard Implementation

The speaker implements a basic scoreboard using AI assistance.

  • AI Code Generation: The AI generates the code for score tracking and UI display in a single prompt.
  • Tab Key Binding: The scoreboard is toggled using the Tab key, a standard control in shooter games.
  • Initial State Loading: The speaker identifies an issue where new players do not initially see the scores of existing players.

Score Synchronization Issues

The speaker troubleshoots issues with score synchronization across clients.

  • Data Flow Analysis: The speaker confirms that score data is being transmitted to new clients but is not being displayed correctly.
  • Component State Management: The speaker suspects that the issue lies in how the UI component manages its state.
  • Potential Double Counting: The speaker considers the possibility of double-counting scores due to death and respawn events.

Deployment and Testing

The speaker deploys a new version of the game with the scoreboard and other fixes.

  • Deployment Pipeline: The speaker uses Wrangler for server-side deployments and GitHub Actions for client-side deployments.
  • Live Testing: The speaker encourages viewers to play the game and provide feedback on any issues.
  • Cloudflare Pages: The speaker monitors the deployment process through the Cloudflare Pages interface.

Addressing Player Feedback

The speaker responds to player feedback and implements new features.

  • Anti-Camping Mechanism: The speaker plans to add a feature to discourage players from camping in one spot.
  • Ammo Cap: The speaker decides to implement an ammo cap to limit the amount of ammunition players can carry.
  • Map Size: The speaker considers reducing the map size to encourage more player encounters.

Ammo Cap Implementation

The speaker implements an ammo cap, but encounters synchronization issues.

  • UI Capping: The UI is updated to reflect the ammo cap.
  • Server-Client Discrepancy: The speaker notices that the ammo cap is not consistently enforced across the server and client.
  • Potential Parallel Events: The speaker suspects that multiple events are being triggered simultaneously when a player picks up ammo.

Gemini 2.5 Experimentation

The speaker experiments with Gemini 2.5 to address the ammo cap synchronization issue.

  • Targeted Code Changes: Gemini 2.5 suggests a targeted code change to address the issue.
  • Direct Messaging: Gemini 2.5 proposes sending messages directly to specific clients instead of broadcasting to everyone.
  • Pickup Failed Event: Gemini 2.5 introduces a "pickup failed" event to handle cases where a player cannot pick up ammo.

Hitbox Mesh Visibility

The speaker addresses a report of visible hitbox meshes in the game.

  • Debugging Tool: The hitbox meshes are intended for debugging purposes only.
  • Local Storage Issue: The speaker speculates that a local storage issue might be causing the meshes to be visible.

Active Gameplay and Bug Reporting

The speaker engages in active gameplay with viewers, receiving valuable feedback and bug reports.

  • Scoreboard Issues: Viewers report issues with the scoreboard, such as players being listed multiple times.
  • Performance Monitoring: The speaker monitors the game's performance and addresses any lag issues.
  • Feature Requests: Viewers suggest new features, such as achievements and a kill log.

Durable Objects and Cost Analysis

The speaker analyzes the cost of using Cloudflare Durable Objects for game hosting.

  • Free Tier: The speaker notes that the game is currently operating within the free tier of Durable Objects.
  • Affordable Hosting: The speaker concludes that Durable Objects provide a very affordable solution for video game hosting.

Future Development Plans

The speaker outlines his plans for future development.

  • New Features: The speaker plans to add new features such as towers, power-ups, and sound effects.
  • Map Updates: The speaker plans to update the map and add more exciting elements.
  • Community Engagement: The speaker plans to schedule a larger game time event with the community.

Conclusion

The speaker successfully launched a live, multiplayer browser game and addressed several critical bugs with the help of AI tools and community feedback. The game is playable at junkwars.net, and the speaker plans to continue developing new features and engaging with the community. The speaker also fixed the pointer lock issue, the ammo issue, and the logo issue.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.