Unity, Meet Server
Unity 3D & C#
Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development.
As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.
There is incredible momentum in the Unity3D product and its community. I recently posted “The Best C# Code Naming Conventions” and “Unity Best Practices“. Here we will explore communication between Unity and the external environment.
Why External Communication?
Unity projects are packaged, by default, into one self-contained file. This may be an executable for Mac, PC, or Linux, it may be embedded in a supported desktop web browser, or may be deployed to the app stores. While the capabilities of a self-contained project are impressive communicating with the ‘outside world’ still has many benefits.
- Persistence – Store state permanently for future use in the same app, on another device, or in another app altogether. Sky’s the limit!
- Collaborate – With the containing environment (such as the embedding page in a browser-based project).
- Multiplayer – Send data between instances of your game for turn-based (asynchronous) or real-time (synchronous) communication.
- 3rd Party APIs – Contact Facebook, Twitter, send email, etc…
Here is a cursory summary of what is possible and relevant references.
What is Possible?
General Data
Load JSON
Load XML
- WWW, WWWForm
- Parse: BiterScripting, System.Xml
Load Image
RPC Calls
Access Twitter
- Compare many packages in the Unity Asset Store
Access Facebook
- Compare many packages in the Unity Asset Store
Unity Web Player <-> Browser Communication
Multiplayer
The network view is the binding material of multiplayer games. With this you can define exactly what is to be synchronized over the network and how it should be done. Game objects can have NetworkView components which can be configured to watch other components for the object. For more information see the Network View manual page and the component reference page.
- Intro To Networking (Video)
- Unity Documentation: Network, NetworkView, MasterServer
- Photon Server
- AppWarp Server
- RedBedlam Server
- Tutorial: Unify MMO – Using SmartFoxServer
- Tutorial: Unity iPhone Multiplayer – While this applies to iPhone development, the networking part of it still applies
- Tutorial: Unity Networking Example – Using NetworkView
- Discussion: MMORPG – UnityAnswers forum about multiplayer
Asset Bundles
AssetBundles (a Unity Pro-only feature) are files which you can export from Unity to contain assets of your choice. These files use a proprietary compressed format and can be loaded on demand by your application. This allows you to stream in content, such as models, textures, audio clips, or even entire scenes separately from the scene in which they will be used. AssetBundles have been designed to simplify downloading content to your application. AssetBundles can contain any kind of asset type recognized by Unity, as determined by the filename extension. If you want to include files with custom binary data, they should have the extension “.bytes”. Unity will import these files as TextAssets.
- Unity Manual
- Caching
- DRM for your assets (imperfect)
What Do YOU Think?
Have a comment? Please post below. This is a hot topic and I’ll respond promptly over the next month.