Wednesday, September 25, 2013

Christian verses Flying Spaghetti Monster - HTML 5 Games, WebSockets, and AI

Visit the High Level Logic (HLL) Website
— Home of XPL (eXtensible Process Language)

It's like XML, but you can store source code in it.

By Roger F. Gay

Three demo games with WebSockets presented; the first is an HLL original. Use WebSockets for multiplayer games, AI from a server, or just because you can (replacing http in some cases).

HLL and HLL WebSockets are ripe for game development. I have so far done a simple proof of concept controlling a Construct 2 sprite via WebSocket, and this article presents a from-scratch HTML 5 PC game with WebSockets. To run it, your browser needs to support HTML 5 and WebSockets. An up-to-date version of Chrome seems to give best results even if your graphics driver might be a bit old. I've also run the demo on up-to-date versions of Firefox and Safari.

My goal in this round of activity is to bring HLL technology to game developers, many of whom are not programmers or spend enough time designing and building games that they just don't need a lot of programming overhead in their process. The objective with this game was simply to build a game from scratch, my first time. I learned a great deal in the process and have a much stronger vision of how to achieve the goal.

The game: A man tentatively named "Christian" is your character. He's a simple stick figure humanoid that can walk in one direction (right arrow key), raise and lower one of his arms (up and down arrow keys), and fire commands (enter key). Well aimed commands are a defense against being taunted by the Flying Spaghetti Monster.

Click on screen-shot to play the game.


The Flying Spaghetti Monster (FSM) is not of this world. His "mind" actually resides on the WebSocket server. I decided to use an autonomous AI (no matter how cheap) instead of building a multi-human game demo because there's no guarantee that another human will be trying the demo when you are. The autonomous FSM will be there at any time anyone looks at the demo.

FSM shows up when his distant remote self decides to visit you. (Actually a simple random timer, set between 0-8 seconds.) He also decides beforehand (on the server) which taunting behavior he will use and how long the taunt will last. And because he's also acting as a substitute human player, news is sent back to the server to let him know he's been hit and he withdraws in acknowledgement.

It's a quick demo game to be sure, but includes some basic essentials; the infamous (or at least a) game loop (with good clean CPU use characteristics), independent motion and control of characters, background movement, etc. I'm interested in simulating humanoids, so I created a very simple walking stick figure as the first tiny step toward that end. I'm not an artist, so feel free to laugh at the man as long and as hard as you want.

The point is that FSM is an external player that moves in and interacts without the old familiar need to click for an update. This is the great tactical advantage of WebSockets. In addition, WebSockets transmit data much more efficiently than normal HTTP. (So much so, that you'll help the Internet work better and reduce energy use by switching to WebSockets.)

The second game I'll mention here was presented as a demo with WebSockets by Mozilla at least a year and a half ago; created by Little Workshop website development company. You will be able to play alone if there doesn't happen to be anyone else trying the demo when you are.

Finally, have a look at Nomo Racer from Hungary. It was developed using MIT open source WebGL tools. (You'll need a modern browser that supports WebGL as well as WebSockets. If you've been ok so far, they give it a try.) "The aim in creating this game," according to the Nomo Racer Facebook page, "was to see what the WebGL and WebSocket technologies are capable of, and find out whether these tools could provide real-life solutions."

The WebSocket connection seems to time out when you're not playing and I found steering difficult using the arrow keys. But it's an impressive experiment / demo nonetheless. I also found a YouTube video showing two cars racing (multiplayer capability), with a driver who could steer better than I could. :)

There are actually a number of other game demos using WebSockets out there. Perhaps I will highlight them in this blog at a later date. But as you can see, there are a number of people demonstrating a range of games using WebSockets.


  1. Hello.

    Really appreciable work.Thanks for providing the steps for coding a PSD to HTML5 template. come back with anoter post.

  2. This comment has been removed by a blog administrator.

  3. This article is about a game demo represented by WebSockets. It's an informative and interesting blog. The writer gives advice about HTML. Now it's time to avail shutters in birmingham for more information

  4. I'm a daily visitor on your site. I got such a amazing knowledge from your site and blogs. I read you this blog I really enjoyed this. This is very informative content. I will share this with my friends. Now it's time to avail Limo service West Palm Beach for more information.

  5. Roger F. Gay is a great writer. I read this blog and realize that is a nice blog for us who love games. Hope you share more updates. Now it's time to avail jupiter florida airport for more information.

  6. Thank you for sharing this informative blog. If you need help with an assignment help, your search ends here. Our dedicated team of professionals is available around the clock to support you in your academic endeavors. They are always ready to assist with any assignment-related queries. Feel free to reach out to us.

  7. In the intriguing realm of HTML 5 Games, WebSockets, and AI, the title ‘Christian verses Flying Spaghetti Monster’ stands out as a unique intersection of technology and modern mythology. It’s akin to the precision and dedication of professional law dissertation writers UK, who expertly navigate through complex legal theories to craft compelling dissertations. Both fields require a deep understanding of their respective subjects and the ability to present information in a clear and engaging manner.

  8. The article "Christian versus Flying Spaghetti Monster - HTML 5 Games, WebSockets, and AI" delves into an intriguing intersection of faith, satire, and technology. It explores how modern tools like HTML 5, WebSockets, and AI can be used to create engaging and thought-provoking games. This blend of religious themes and advanced technology offers a unique perspective on digital storytelling, highlighting the potential for interactive media to challenge and entertain audiences in innovative ways.