Archive for December, 2009

Wednesday, December 9th, 2009

Google is pushing Web Sockets into Chrome based on the Web Socket standards being developed at all major engineering standards groups.  Web Socket is an interesting direction but it is great to couple that with O3G or WebGL for some multiplayer 3d game development with just a browser.

Starting in the Google Chrome developer channel release 4.0.249.0, Web Sockets are available and enabled by default. Web Sockets are “TCP for the Web,” a next-generation bidirectional communication technology for web applications being standardized in part of Web Applications 1.0. We’ve implemented this feature as described in our design docs for WebKit and Chromium.

Sample Code

if ("WebSocket" in window) {
  var ws = new WebSocket("ws://example.com/service");
  ws.onopen = function() {
    // Web Socket is connected. You can send data by send() method.
    ws.send("message to send"); ....
  };
  ws.onmessage = function (evt) { var received_msg = evt.data; ... };
  ws.onclose = function() { // websocket is closed. };
} else {
  // the browser doesn't support WebSocket.
}

Socket Advantage

Flash has long been the answer for sockets for web applications and once sockets were added to Flash it instantly became a better interactive and gaming platform for multi-user applications and multiplayer games. They started with XmlSocket then recently added Socket for raw binary data in as3.  Silverlight and Java also have this feature but having this in script is pretty significant because many applications could really use a browser supported bi-directional communication link.

What is Missing

The biggie missing from Flash, Silverlight, etc and Web Sockets is UDP and preferably RUDP or Reliable UDP which allows UDP datagrams to be sent back and forth either verified delivery or broadcast. Unity does support UDP.  The best socket layers are reliable UDP based because mixing TCP and UDP can lead to queuing and not all messages are critical so having just UDP isn’t enough, having TCP is too much.  Reliable UDP is the way to go but so far no web layers are doing it well except Unity on that one (you still have to make your own RUDP implementation – libraries like Raknet or enet in C/C++ give you this but you can’t use that in Unity client only on the server). (Edit: Flash does have RTMFP which is based on UDP and uses FMS for nat for p2p but it is still not a true low level UDP socket just yet as it supports more features. A low-level UDP socket would also be nice in flash.)

Web Communication Evolving

I am a big Flash fan and have been developing it since 1999 among other platforms, I have recently watched other technologies nearly match the features and some go beyond it.  The interesting thing about Web Sockets is that it does go after a core feature of flash; Canvas and WebGL or O3D also do. Flash still has the webcam, mic, sound mixers/tranform, and for now sockets which put it at an advantage in gaming and interactive. Flash used to  be the sole greatest video player but Silverlight is doing a pretty good job of that as well so that is still an advantage but others are entering including possibly browser support in html5. I still think it is the best video but they would need to keep innovating.

Another interesting point about this is XMLHttpRequest objects.  Originally “AJAX” was created by Microsoft for IE, pushing new features and innovating back when IE was a good browser and ahead in IE4. Mozilla and others adopted this feature (as well as editable text areas for html) because they were great features for web applications to evolve to.  now Google is pushing with Chrome and Web Sockets is the next step that should be in web browsers even if it is only TCP based for now.  This will add great capabilities and will probably be preferred over AJAX/XMLHttpRequest for really interactive and real-time tools/games should it take hold.  Ian Hickson is running the table on the standards with this effort and it is a good one to get behind.

Wednesday, December 2nd, 2009

If the question is if Unity can do interactives as smooth and stylish as Flash I think you may soon find out.  Carlos Ulloa of Papervision 3D fame has kicked it up a notch in Unity 3D with this interactive very reminiscent of the Ford Focus demo that helped bring in Papervision 3D for flash in style. Gotta say though a mini is much better than a Ford Focus.

Flash is still the leader in web interactives and even marketing interactive 3d, Unity largely replaced Director and tools like it and high-end hardware rendered required interactives and games. This interactive by HelloEnjoy has loads of polygons, unity physics system, lighting, environment mapping, showroom cameras, reflection, skid decals, highly detailed mesh and more.  Just take a peek inside the vehicle and at the rims for the detail that is impossible with the 2000 poly limit of Flash 3D software rendered engines.

Web interactives this heavy aren’t doable in a non hardware rendered player like Flash.  Unity is looking to pretty much own this level of quality in a browser.  I don’t think I have seen another interactive looking this good with Unity 3D.

Unity still is lacking many features that Flash has in support of making interactives for the web such as webcam support, mic support, better video support, better gui system, html support (although flash barely) and a larger install base but Unity could easily take the high-end advertising market in addition to owning highly immersive games that need hardware rendering which it is already doing for web gaming.  It is 2010 soon, most computers have a decent video card.  Put them to use!

Wednesday, December 2nd, 2009

If you are looking to get into Unity 3d coding/creating a book is a good place to start to get the full overview. Recently, the first Unity book has been released by Will Goldstone via Packt Publishing.

The book is written in a simple yet rapid pace but starts out from beginner level 3d introductions and really explores all areas needed to give someone the handrails to start tinkering on their own in the dark of their labs with Unity. The book explores an introduction to 3d (the biggest hurdle for most in moving to unity although it also does 2d), terrrains (terrains aren’t supported in iphone yet keep this in mind if those are your aims), moving players and cameras, collision detection with colliders and rays, working with prefabs, creating HUDs, creating menu screens and working with the the GUI system in Unity (which can be strange for people coming from flash with event based user interfaces), loading/instantiating objects in the 3d world, particle systems, physics and lots of examples and minigames showing off these areas.

The book is alot like Unity itself in that it gets up and running quickly, gives the tools to do some damage and then opens the door to developing with Unity. After you develop longer in a platform you learn how to dig deeper into all these areas including scripting to do lots of what the Unity Editor can do for you but there is so much to take in that a good starting point to catch onto is needed.  Unity Game Development Essentials, the first Unity book, fills that role easily.

I have been using Unity as a hobbyist then at work at a game company starting in 2007 since it started to invade and take over from Director in 2007 ish then infiltrating the Papervision 3D and flash 3D developers, even with that experience this book still did a great job of exploring the tools and is approachable for almost anyone with some basic scripting skills and a desire to make some creative stuff.

Even if you have been doing Unity for a while a book is always good to see techniques and support authors and community members that give back to help others learn. Pick it up! (Amazon) (Packt Publishing)

If you aren’t ready to make the leap to Unity just yet there is also a great book from Paul Tondeur called Papervision Essentials for 3D in Flash, he has also done some projects in Unity to Flash communication.