DZone
Web Dev Zone
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
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Web Dev Zone > HTML5 Canvas + WebSockets = Multiplayer Space Shooter In Browser

HTML5 Canvas + WebSockets = Multiplayer Space Shooter In Browser

John Esposito user avatar by
John Esposito
·
Dec. 26, 11 · Web Dev Zone · Interview
Like (0)
Save
Tweet
9.00K 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.

Popular on DZone

  • Exhaustive JUNIT5 Testing with Combinations, Permutations, and Products
  • JIT Compilation of SQL in NoSQL
  • The Power of Enum: Make Your Code More Readable and Efficient [Video]
  • When Writing Code Isn't Enough: Citizen Development and the Developer Experience

Comments

Web Dev Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo