Archive for the ‘network’ Category

Monday, November 22nd, 2010

WebSockets and many other great features are now available across the iOS devices that are updated to iOS 4.2.

You can test your devices for WebSocket support and I just tested iPad and iPhone/iPods on iOS 4.2 and it is a go.

The update also adds some other excellent Safari browser features including:

  • As mentioned, WebSocket support
  • Accelerometer support
  • Improved SVG and Canvas rendering
  • Better Ajax

The new Safari on iOS 4.2 makes the iOS platform the current best html5 mobile solution for interactive apps and games in the browser. This should add some fun in terms of interactive web, games and better web experiences for iOS users.

We hope they add in WebGL support soon, there was mention of WebGLRenderingContext but not supported in browser yet.

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.

Tuesday, March 24th, 2009

AngryAnt brings us a nice library for pathing and behavior trees in Unity3D with excellent editor integration. Path library I reviewed and is an extremely deep and complete library with autocomplete node collections from colliders, ability to connect different networks and detection from mesh as well as GUI tools using Unity3D editor scripts. The release is solid with documentation, video samples and is very easy to integrate. If you have a need for AI, bots, scripted animations or other madness in your game be sure to check out the pathing library and or the behave library from AngryAnt to implement or research.

Path Features

Specs:

  • Available for unity indie as well as pro licensees
  • Can run in webplayers as well as stand-alone
  • Requires no additional installations

Features:

  • Easy to use editor interface
  • Navmeshes
  • Waypoint networks
  • Cached pathes
  • Distributed processing using coroutines
  • Tag-filtered pathfinding
  • Hierarchal “grid network” pathfinding
  • Auto-recalculate on runtime network changes

Tutorials

I recommend you study the “Editor demo” unity project available on the Path download page. This project will be used in the tutorials below and contains an example Path setup.

Tutorial 1 – The basics

Runtime reference

The Path project comes with a small, but effective runtime API. The following links list the classes herein and their methods / properties.

Path unity package

Path package
The Path package contains all you need to start using the Path editor and run-time components in your project.

Demo unity project

Demo project
The Demo project is a complete unity 2.5 project with Path already added, a sample Path collection set up and example scripts requesting path calculations and following them.

Behave Features

Specs:

  • Available for unity indie as well as pro licensees
  • Can run in webplayers as well as stand-alone
  • Requires no additional installations at runtime

Features:

  • Implements behaviour trees
  • Re-use common behaviour by reference
  • Drag and drop editor interface inside the unity editor
  • Simple connection to character actions via C# interface
  • Designed trees are built to .net assembly code for maximum performance
  • Runtime debugging features
  • Powerful stand-alone editor – including web version

Behave unity package

Behave package
The Behave package contains all you need to start using the Behave editor, compiler and run-time in your project.

Behave 0.3b hotfix

Behave 0.3b hotfix
This hotfix solves a few critical issues with Behave 0.3b and unity 2.5. It’s still quite buggy and I’m working on a more extensive rewrite. Stay tuned.

Demo unity project

Demo project
The Demo project is a complete unity 2.1 project with Behave already added, a sample behaviour tree designed and compiled plus an example script showing how compiled behaviour trees are integrated with unity MonoBehaviour scripts.

Behave builder application

Behave builder
Behave builder is a stand-alone application offering the behaviour tree editors (excluding the compiler) outside the unity editor. It is currently OS X only. This application is also available in an online version – check it out in the “Preview” section of this page.

Example library

CitySimulation.behave
CitySimulation.behave is the library used in the demo project – saved as a Behave builder file. You can use this file directly in the online and offline version of Behave builder or import it to a unity project via the Behave “Assets” menu.
Friday, December 12th, 2008

Adobe stratus sounds pretty interesting for flash client to client communication much like peer to peer networks for small numbers of people.

Want to build a video chat application, multi-player games or voice-over-ip applications for the Flash Player or AIR without worrying about setting up a server infrastructure? Stratus (which we showcased at MAX) is your new best friend.

Stratus is a beta hosted rendezvous service that helps establish communication between Flash Player or AIR clients. Once two clients are connected to Stratus, they can send data directly client to client. The APIs in Flash Player 10 and Adobe AIR 1.5 allow for point-to-point communication between a small number of subscribers. Publishers have to send data to all subscribing clients, so the number of subscribers is limited to the available bandwidth on the publisher end.

This must be one of the first Real-Time Media Flow Protocol (RTMFP) protocol usage programs from Adobe?  Basically this protocol is adding better UDP or broadcast support which allows for larger sets of users and is common in large scale real-time games.  Here it seems to be more of a peer to peer usage rather than authoratative approach (maybe flash media server will have large user set support with this) which limits to about 15 users or the lowest latency in the group with anything close to real-time syncing. Stratus seems like more of a matchmaking middle man to help with nat punchthrough and then it relies on peer to peer.  But more fun in store checking it out.

P2P like this can’t really be used for games due to cheating unless one client is the independent server but this works great for small file sharing apps, whiteboards, chats, watching videos at the same time, etc.