DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

How does AI transform chaos engineering from an experiment into a critical capability? Learn how to effectively operationalize the chaos.

Data quality isn't just a technical issue: It impacts an organization's compliance, operational efficiency, and customer satisfaction.

Are you a front-end or full-stack developer frustrated by front-end distractions? Learn to move forward with tooling and clear boundaries.

Developer Experience: Demand to support engineering teams has risen, and there is a shift from traditional DevOps to workflow improvements.

Related

  • Real-Time Communication Protocols: A Developer's Guide With JavaScript
  • Mastering Accessibility in Web Development: A Developer’s Guide
  • Designing Embedded Web Device Dashboards
  • Building a Real-Time Audio Transcription System With OpenAI’s Realtime API

Trending

  • Resilience Pattern: Circuit Breaker
  • RAG vs. CAG: A Deep Dive into Context-Aware AI Generation Techniques
  • Integrating Apache Spark With Drools: A Loan Approval Demo
  • From Java 8 to Java 21: How the Evolution Changed My Developer Workflow
  1. DZone
  2. Coding
  3. Languages
  4. HTML5 Canvas + WebSockets = Multiplayer Space Shooter In Browser

HTML5 Canvas + WebSockets = Multiplayer Space Shooter In Browser

By 
John Esposito user avatar
John Esposito
·
Dec. 26, 11 · Interview
Likes (0)
Comment
Save
Tweet
Share
9.9K Views

Join the DZone community and get the full member experience.

Join For Free

Recently I ran across Rawkets, a slick site taking two emerging web technologies -- HTML5 Canvas and WebSockets -- and combining them in the most obvious way possible: a multiplayer space shooter.

Why Canvas? No plugins -- graphical Yes; and why WebSockets? Low latency -- multiplayer Yes.

Sadly, every time I join the game, nobody else is there. If I wanted single-player HTML5 gaming, I could check out another project by Rawkets' creator, Rob Hawkes:  straight-up Asteroids, using the HTML5 game engine Impact.

But WebSockets won't help Asteroids, because Asteroids runs totally on just one client. 

Rawkets, on the other hand, has multiple clients running Canvas, with their own JavaScript, connecting via WebSockets, all taking through Node.js on the server, producing something like this:


I can't tell whether the game is any fun, because I've never seen anyone else in there. (Also, it doesn't seem to work in Chrome). But as a tech demo it's a cool idea, and conceptually straightforward enough to inspire. (If you're impressed, Rob also links from the game site to to his HTML5 Canvas book -- though apparently the book assumes virtually no knowledge of Canvas or JavaScript, and doesn't progress all that far.)

Check it out, and maybe shoot someone else's ship down -- fairly fairly, of course, because WebSockets will keep multiplex channels persistently open...

HTML WebSocket Space (architecture)

Opinions expressed by DZone contributors are their own.

Related

  • Real-Time Communication Protocols: A Developer's Guide With JavaScript
  • Mastering Accessibility in Web Development: A Developer’s Guide
  • Designing Embedded Web Device Dashboards
  • Building a Real-Time Audio Transcription System With OpenAI’s Realtime API

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: