Archive for the ‘PROGRAMMING’ Category
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.
Tags: chrome, gaming, google, html5, INTERACTIVE, real-time, sockets, standard, tcp, web
Posted in AJAX, APPLICATIONS, PROGRAMMING, TECHNOLOGY, network | View Comments
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!
Tags: 3d, carlos, DESIGN, helloenjoy, interactives, style, ulloa, unity, unity3d
Posted in 3D ENGINES, 3d, PERFORMANCE, PROGRAMMING, TECHNOLOGY, unity3d | View Comments
Wednesday, October 28th, 2009
Unity 3D Indie is now free for all developers and just called Unity now. The Unity 3D Pro license is still $1500 and worth every penny. But this news is great for indies and moreso the pro users that want the Unity Web Player to have more penetration and installs in the market.
Companies like EA, Cartoon Network and Lego are using Unity 3D and just about every game developer I know including myself has been excited about the possibility of an engine that allows creation of hardware rendered web based games and desktop games, which are multi-platform and paths into the mobile market (iPhone/Touch) and console like Wii and XBOX in development (for additional licenses).
When Unity 3D released support for Windows as a development environment in addition to Mac it literally blew up as predicted this year. Also, Unity 2.6 is out which is big because it finally supports third party source control such as Subversion and Perforce. Many of the barriers that were keeping it from integration into gaming pipelines are gone: the price, the single platform and the source code integration issues. Unity 3D has addressed all those issues.
What are you waiting for? Get your Unity3D on!
Tags: unity, unity 3d, unity3d
Posted in .NET, 3D ENGINES, 3d, C#, PROGRAMMING, TECHNOLOGY | View Comments
Saturday, August 8th, 2009
So many cool and useful technologies are unveiled at SIGGRAPH every year, this year at SIGGRAPH 2009 was no different. Khronos Group, behind the new guidance of OpenGL, OpenGL ES, OpenCL, OpenVG, COLLADA etc, came another big announcement about hardware rendering within the browser. WebGL is now an official standard being developed at Khronos Group to bring javascript control of OpenGL to browsers… Wow!
Ok so this was officially announced at the GDC in March but limited information, but now it has been slated for an official public standard in early 2010. Shortly after the announcement at the GDC we saw Google o3D appear doing exactly that, controlling OpenGL through Javascript in the browser but it was still largely software/harward hybrid rendered. Google, Mozilla, Opera are part of the companies supporting WebGL which is great for browser support, also NVIDIA, AMD and Ericsson are in on it.
Khronos Details WebGL Initiative to Bring Hardware-Accelerated 3D Graphics to the Internet
JavaScript Binding to OpenGL ES 2.0 for Rich 3D Web Graphics without Browser Plugins;
Wide industry Support from Major Browser Vendors including Google, Mozilla and Opera; Specification will be Available Royalty-free to all Developers
4th August, 2009 – New Orleans, SIGGRAPH 2009 – The Khronos™ Group, today announced more details on its new WebGL™ working group for enabling hardware-accelerated 3D graphics in Web pages without the need for browser plug-ins. First announced at the Game Developers Conference in March of 2009, the WebGL working group includes many industry leaders such as AMD, Ericsson, Google, Mozilla, NVIDIA and Opera. The WebGL working group is defining a JavaScript binding to OpenGL® ES 2.0 to enable rich 3D graphics within a browser on any platform supporting the OpenGL or OpenGL ES graphics standards. The working group is developing the specification to provide content portability across diverse browsers and platforms, including the capability of portable, secure shader programs. WebGL will be a royalty-free standard developed under the proven Khronos development process, with the target of a first public release in first half of 2010. Khronos warmly welcomes any interested company to become a member and participate in the development of the WebGL specification.
Google released O3D this year and there are great strides in 3d within the browser from game engine wrapper technologies such as instant action technology, gaim theory engine (now owned by id Software and runs Quake Live, hardware rendered Unity 3D (and Torque 3D coming soon), and Flash software rendered 3d engines Papervision 3D, Away 3D, Sandy (Sandy also released a haXe version that exports a javascript version) and others. But it looks like the movement is to bring OpenGL to the web as a standard under the name WebGL, this would be great! There would still be lots of times where plugins are better now and in the near future but the path is a good one. Having a software/hardware rendering hybrid like Google O3D for broad video card support (some of the painful older intel cards), or using a plugin like Unity3D, Torque 3D or wrapper technology for bigger engines is a good idea for the time being. But the future is grand in this area.
I think that Google O3D and OpenGL ES success on iPhone games probably combined to get this in motion. OpenGL and very basic video cards are now standard in most machines out there. Unity3D actually published hardware statistics on casual gamers (web-based games) ever so kindly and shows that even though there are some older Intel cards out there, for the most part machines nowadays have a video card capable of supporting at least low-poly 3d and hardware supported 2d rendering in real-time for games, user interfaces and more.
This is exciting news, it appears the movement of the web gaming market is getting much more capable and is accelerating the innovation of hardware accelerating the web.
Tags: 3d, browser, group, JAVASCRIPT, khronos, OPENGL, opengles, RENDERING, standard, webgl
Posted in 3D ENGINES, 3d, AWAY3D, CODE, COMPANIES, CONFERENCE, EFFECTS, ENGINE, GAMEDEV, GAMES, HAXE, JAVASCRIPT, LIBRARIES, NEWS, OPEN SOURCE, OPENGL, PROGRAMMING, RENDERING, STANDARDS, TECHNOLOGY, TORQUE 3D, Uncategorized, unity3d | View Comments
Thursday, July 16th, 2009
Haxe Sandy is a version of Sandy that can export to an experimental Javascript 3D engine taking advantage of the <canvas> element. There are some great demos that run smoothly in canvas capable browsers and very smooth in Chrome.

Demos of Haxe Sandy:
Sandy was actually the first open source 3d engine in flash, maybe this will be a trend building in haXe for export to flash and javascript? It certainly looks like a great start and would make a very nice platform for 3d on the web allowing Sandy or other flash libraries to run in Flash and Javascript by writing in an abstraction platform like haXe. Other libraries like Motor2, Physaxe, haxe3D, PureMVC and more have haXe versions. Still very experimental but a possible need when Flash and canvas are both in the market in the future. Right now it is still all Flash.
[ via Matthew Casperson at devmaster.net ]
Tags: 3d, canvas, ENGINE, HAXE, html5, hx, JAVASCRIPT, motor2, port, puremvc, SANDY, web
Posted in 3D ENGINES, 3d, ACTIONSCRIPT, ACTIONSCRIPT3, ARCHITECT, AS3, GAMEDEV, GAMES, HAXE, JAVASCRIPT, OPEN SOURCE, PROGRAMMING, RENDERING, SANDY, STANDARDS, TECHNOLOGY | Comments Off
Friday, July 10th, 2009
Silverlight 3 has been released a day early.
Microsoft has released Silverlight 3 to the web a day earlier than expected. You can go ahead and grab Silverlight 3 RTW build 3.0.40624.0 (4.69MB) from Microsoft.com/Silverlight. Version 3 supports Windows Internet Explorer 6/7/8, Firefox 2/3, and Safari 3/4. In addition, the Silverlight 3 SDK (9.5MB) and the Silverlight 3 Tools (32.2MB) have been posted on the Microsoft Download Center. (arstechnica)
As Silverlight versions go it is quite impressive and pretty much a complete solution now including desktop save support and full set of tools for RIA development (early versions were only Javascript or had limited controls libraries).
Granted there are lots of years of gain that Flash has on Silverlight but the path that Silverlight it following leads right to Flash. Hopefully this will lead to more innovation on both sides (they might need it with Google Wave pushing html5 <canvas>).
One very nice element of Silverlight since it has been released at verison 1.0 is the HD video support. It has gotten better with each release. This release has smooth streaming support that is pretty impressive for web video.
Interestingly they chose the open source Blender Foundation project Bug Buck Bunny to demonstrate the smooth streaming feature. Ryan Rea has a bit of analysis on how well the video plays across a quad core and memory compared to flash hd video.

More on the Silverlight 3 new features here and here.
Roy Schestowitz plays the flip side and calls this a ’silver-lie’ released and has lots to say about the Silverlight 3 release and even using Big Buck Bunny to demo it. He states a true fact that up til now lots of companies have abandoned Silverlight in favor of Flash (mlb, nyt etc). It is still used at Netflix but that has an XBOX deal to play Netflixon xbox360.
Flash didn’t really get good until version 4. Typically software is a real version at version 3, that is when most software has the goals and ambitions of 1.0 fully complete and integrated. We shall see how things play out but I still think Silverlight has a long way to go in winning over developers, myself included, but competition is never a bad thing when you are wanting to see innovation.
Tags: FLASH, MARKET, release, SILVERLIGHT, VIDEO
Posted in .NET, APPLICATIONS, ARCHITECT, DEVELOPMENT, EXPRESSION, INTERACTIVE, MARKET, MICROSOFT, PROGRAMMING, SILVERLIGHT, TECHNOLOGY, VIDEO, blender | Comments Off
Sunday, June 21st, 2009
This is a very cool project called V8-GL. It is an OpenGL engine with 80% of the API converted to run on the V8 Javascript engine, the same engine that runs Google Chrome.

This is exciting as more productive languages like Javascript get speed boosts from engines like V8 and are capable of manipulating more complex systems like OpenGL. Google is also pursing this in the browser with O3D with javascript manipulation of hardware rendering. Also, a Google funded project called Unladen Swallow is converting Python to the LLVM virtual machine, so that it can have increasing speeds to compete with gcc speeds.
Making things easier to produce and control with more simplified and minimal languages like Javascript, Python and Actionscript etc that control more complex systems, that typically you would need to invest more time in such as a platform on C++ is the goal. V8-GL has this goal in mind.
V8-GL from the author states:
V8-GL intends to provide a high-level JavaScript API for creating 2D/3D hardware accelerated desktop graphics.
In other words, you can hack some JavaScript code that opens a desktop window and renders some 3D hardware accelerated graphics. Bindings are made using the V8 JavaScript engine.
Tags: 3d, DESKTOP, ENGINE, JAVASCRIPT, OPENGL, v8
Posted in 3D ENGINES, 3d, APPLICATIONS, ARCHITECT, DESKTOP, ENGINE, GAMEDEV, GAMES, JAVASCRIPT, MARKET, OPEN SOURCE, OPENGL, PERFORMANCE, PROGRAMMING, RENDERING, STANDARDS, TECHNOLOGY, Uncategorized | View Comments
Friday, June 19th, 2009
haXe is an interesting programming language that allows abstracting the source from platform target. It outputs for targets such as Actionscript and Javascript from haxe language source. But, haXe can also output to native code to run on Windows, Mac OSX, and Linux.
Well because of this it is possible to run haXe on the iPhone. The gamehaXe site has found a way to get haXe to compile to iPhone via hxcpp which creates a C++ output from haXe code very similar to Actionscript 3.
I am a bit late to the party but this is great news. It uses the NME library which will allows code to mostly be written to the Flash 9 API and create the C++ for XCode to compile and run on the iPhone and Touch. This creates a path to port Flash games to iPhone/Touch.

This project is one to watch and participate in. Native compilation to the iPhone from haXe is a more simplified code to write in while providing lower level performance which is needed on mobile devices, as processors, cache and ram are much lower than desktop and below what is capable of running the Flash AVM2 currently.
If you have more interest in haXe there are some other great demos on as3/haXe at the game haXe site. Also, Tony at touchmypixel.com has posted some very useful information to help you get started with hxcpp.
The hxcpp project is a newer output target along with a java one but this could be interesting if actionscript like code and many libraries like Physaxe or AS3 libraries could be ported to haXe to output to the iPhone.
Tags: AS3, cpp, FLASH, HAXE, hxcpp, iPhone, MOBILE, neash, neko, physaxe
Posted in ACTIONSCRIPT, ACTIONSCRIPT3, ARCHITECT, AS3, HAXE, LIBRARIES, PHYSICS, PROGRAMMING, iPhone | View Comments
Friday, May 22nd, 2009
Flash 10 will be ready for mainstream hopefully by the end of this year, or early ‘10 when the penetration numbers will be up in or around the 90% range via zeh fernando based on previous trajectories.
With that, Flash 10 has many great new things such as the Vector structure that allows a collection of a certain type, which results in a faster collection because of the known type. So anywhere where Arrays are used, that is a possible candidate for a performance increase within some code because you are asking the virtual machine to do less work on each loop (not having to dynamically find out the type).
ByteArray (Thibault Imbert) has demonstrated that for the JPEG encoding in corelib it is up to 2.5 times faster using Vectors than Arrays. Your mileage may vary heavily but it is almost a guaranteed speed boost due to less work. This obviously has great possibilities for speeding up code that uses lots of arrays.
Due to the performance boost the Vector does have some constraints in the typical give and take of coder flexibility with compiler and virtual machine overhead. Vectors are more explicit and strongly typed which is why they are fast, but this is also limiting.
In addition to the data type restriction, the Vector class has other restrictions that distinguish it from the Array class:
- A Vector is a dense array. Unlike an Array, which may have values in indices 0 and 7 even if there are no values in positions 1 through 6, a Vector must have a value (or
null) in each index.
- A Vector can optionally be fixed-length, meaning the number of elements it contains can’t change.
- Access to a Vector’s elements is bounds-checked. You can never read a value from an index greater than the final element (
length - 1). You can never set a value with an index more than one beyond the current final index (in other words, you can only set a value at an existing index or at index [length]).
[ Vector docs ]
ByteArray not only used Vectors heavily but did other optimizations that are always good to do, even though optimization is evil when you are working with precious client side resources ensuring an optimized base starting point can be a good thing.
So what did I do ?
- I used bitwise operators as much as possible.
- I replaced all Arrays with fixed length Vectors.
- I used pre-incrementation rather than post-incrementation (thanks Joa for this one
).
- I casted to int all my Vector indices access.
- Other minor stuff you always do to optimize your code
Other sources as well for even more optimization or shall I say efficient AS3:
Tags: ACTIONSCRIPT, ACTIONSCRIPT3, array, AS3, efficient, FLASH, optmization, VECTOR
Posted in ACTIONSCRIPT, ACTIONSCRIPT3, APPLICATIONS, ARCHITECT, AS3, CODE, DEVELOPMENT, FLASH, FLEX, PERFORMANCE, PROGRAMMING, TECHNOLOGY, VECTOR | View Comments
Thursday, April 30th, 2009
Unity 3D iPhone was updated recently to 1.0.2 and it has been greatly improved in performance and a much more solid 1.0 toolkit. According to Unity 3D information by up to 50% which means much more room for assets to munch memory for us yay!
I updated to iPhone SDK 3 beta 4 and iPhone OS 3 beta 4 and the latest Unity iPhone and things were much better in perception of speed at least in early testing. Not sure if it was more from one or the other but the games I am testing/building so far are quicker and the OS feels faster overall.
Get the latest Unity 3d iPhone dev kit (only for Mac OSX obviously since it uses XCode to compile per Apple licensing requirements)
This build fixes many issues and makes some great optimizations for speed as listed here:
New Features and Improvements
- Reduced memory footprint for uncompressed audio by 50%
- “Memory usage for textures reduced by 50%. Texture memory is now freed once it has been submitted to OpenGLES on the device. The “Enable Get/SetPixels” flag in the Texture Import Settings lets you disable this feature on a per texture basis in order to access the texture data from a script using GetPixel etc.
- Improved iPhone script call optimization
- Removed unused parts of Mono runtime
- Reduced memory overhead while reading data from disk and slightly improved load times.
- Support for several predefined splash-screens (portrait/landscape) for Indie version. Just rename one of the splash-screens in the output directory to Default.png
- Exported audio session activation/deactivation functions to AppController.mm
- Added Scripting Reference code examples for iPhone specific APIs
Bug Fixes
- Fixed audio to play correctly after phone call / text message / alarm interruption occurs
- Fixed compressed audio occasionally refusing to play
- Fixed AudioSource.PlayOneShot to work correctly with compressed audio
- Fixed audio to respect Mute switch and background iPod music
- Fixed Pause function and time property for compressed audio clips
- Fixed OpenAL memory leak
- Fixed PhysX memory leaks
- Fixed Audio and Animation assets leaking while loading new scene
- Fixed a crash related to playing compressed audio in a sequence
- Fixed memory leak while updating Mesh geometry data
- Fixed several small memory leaks in rendering module
- Fixed asynchronous .NET sockets
- Fixed .NET threads
- Fixed cross thread boundary calling to the delegates
- Fixed UnityEngine.TextEditor stripping
- Fixed GUI slider stripping
- Fixed GUI scroll view stripping
- Fixed IndexOutOfRange exception checking
- Fixed Boo.Lang.dll stripping
- Fixed occasional crashes of AOT cross compiler
Tags: iPhone, OPENGL, opengl es, unity, unity3d
Posted in 3D ENGINES, 3d, C#, GAMEDEV, GAMES, OPENGL, PROGRAMMING, RENDERING, TECHNOLOGY, iPhone, tracking, unity3d | View Comments