Middleware is an important but unappreciated part of any sort of computing-based application. Essentially, middleware is defined as a sort of "glue" that keeps two separate programs working in tandem as efficiently as possible. This explanation might seem a little vague, and that's because it is. Middleware is an extremely broad term in computing that can refer to many different types of programs. However, its utility cannot be denied. A good example of the usefulness of middleware is found in some capacity in just about any type of software. For example, a business owner who must purchase 5 widgets by the end of the month forgets to do so. Oftentimes, it is middleware within the software of either the operating system or the ordering program that will automatically order more widgets. One area that sees a great deal of middleware programs is physics-based programs, especially those important with the trends in gaming. This paper will explore a few of these middleware physics programs, three of the largest providers: Havok, Unity, and PhysX.
First, it is necessary to examine exactly what these physics-based middleware programs do. The answer is somewhat complicated, but it boils down to providing the "soul" of any video game or physics simulation. That is, a video game designer can create a virtual world, but without physics, it is just a series of models and landscapes. When the game designer implements the physics middleware, the landscape comes to life with dynamic effects that are, especially in this day and age, breathtaking. Oftentimes, this middleware is coded directly into the video game engine itself. For example, the Call of Duty games all run off of the same engine, and this engine contains the same middleware each time, which helps to explain why the layman might find these games to be very similar-looking. The importance of this middleware cannot be understated and affects tens of thousands of objects within a video game, such as particles, movement, and degradation of clothing, fluid physics, and many more applications (Green, 2007). This physics-based middleware is important because the technology is still relatively young, and has been growing tremendously in the last ten years when real-time video game physics hit their stride.
To start with, the Havok physics engine is one of the most well-known of all of the video game middleware. It hit its stride around 2002 and was subsequently implemented in all major video game consoles at the time: the Playstation 2, Xbox, and Gamecube. Because of this, it is extremely versatile. In addition, Havok is revered among game designers for its efficiency. It uses up substantially less memory and resources than most other physics middleware, even in 2002 (Telekinesys, 2002). Another feature that sets the Havok engine apart is its use of what is called Memory Optimized Partial Polytope Technology (MOPP). Essentially, this technology allows for much more of its physics to be rendered at one time, meaning that it is possible for video games, even older ones, to render large landscapes and have many simultaneous effects (Telekinesys, 2002). Havok also allows for the user to modify many aspects of its engine. This is known as "User-defined collision primitives." Essentially, this allows for a video game designer to modify the physics to add or remove certain types of collision. For example, a video game designer who wanted to include ghosts in his or her game can have the character models for the ghosts completely disregard the collision detection altogether, allowing them to travel through walls, but still be harmed by other physics items, such as guns (Telekinesys, 2002). Lastly, Havok middleware allows for the alteration of certain properties of objects. This allows for the Havok physics engine to be used for much more than video games. It can effectively be used for video game illusions and simulation purposes as well. By being able to modify values of an object, such as mass, elasticity, friction, and center of mass, it is possible to create large, sweeping models of things like galaxies, or to simply create a "what if" scenario involving things like zero-gravity environments (Telekinesys, 2002).
Another type of physics-based middleware is what is known as Unity. Unity, designed by Unity Technologies, is not quite as ambitious in scope as Havok is, but is supported on far more platforms, including, most importantly, flash-based devices such as iOS, Android, and Blackberry. While Unity does provide video game physics, its applications are not specific to simple physics. For example, one of Unity's many uses is the ability to actually render objects in real-time. This means that, as a standalone video game engine, Unity is very useful. If a video game designer wanted to create a video game world, physics and all, from the ground up, Unity would be able to do that, while Havok and other physics-specific middleware could not. Another aspect of the Unity physics engine is that it has applications beyond the realm of simple video games. The Unity middleware has been used for a simulation that trains the user on the operation of real-life robots which are used in such applications as law enforcement. This is known as the Search and Rescue Game Environment (SARGE) (Craighead, Burke, and Murphy, 2007). One of the big advantages that the developers of SARGE find useful in Unity is its use of documentation. Specifically, the Unity middleware comes with complete documentation and examples for its Application Programming Interface (API) (Craighead et al, 2007). This means less guesswork and trial-and-error on the part of the developers and leads to a more efficient design. Also, because Unity is a relatively new type of physics middleware, it has a very active developer community. This means that, unlike some of the other big-name physics engines, the developer community of Unity will actively assist its users in troubleshooting and other issues. They are also willing to add features to Unity at a developer's request, which has assisted the developers of SARGE immensely (Craighead et al, 2007). Unity as middleware is also much cheaper than the next best alternative, Havok, which can cost upwards of $100,000 per title. Unity uses a simple program that can be purchased and, from there, produce the game. Unity is much more a Swiss army knife of sorts than Havok or PhysX, which have more specific applications.
The final physics middleware to be examined is the PhysX engine, formerly known as NovodeX. This engine does not contain all of the bells and whistles seen on the Havok engine, such as support for AI and behavior, but instead focuses entirely on the physics themselves, making PhysX a very specialized middleware for physics and physics only. Because PhysX is so focused on the actual physics portion of the engine, it can be used, aside from the obvious application of video game physics, for more intensive physics simulations. For example, using the PhysX engine, it is possible to set up and execute extremely complex simulations of particle systems that involve things like volumetric fluid simulation and real-time expansion of gasses and the like (Harris, 2008). The most impressive aspect of PhysX, and what makes it such a great tool for those interested in running lifelike simulations, is that each particle (of which thousands or millions make up a fluid) each store their own mass, position, velocity, and age, meaning that each individual particle in PhysX has a mind of its own, so to speak (Harris, 2008). In order to keep this system from overloading a computer, it has the ability to let the user set a lifespan for each particle so that it will be deleted when that lifespan expires. Lastly, PhysX is important because it utilizes complex algorithms to determine things like motion. Meaning that the numbers behind PhysX's physics are as true to life as a physics-based middleware can get.
With each of these three middlewares currently in widespread use in the gaming market, it is difficult to find a clear winner between the three. Certainly, each has its own specific applications, advantages, and disadvantages, with some being more suited towards general application, while others, like PhysX, are devoted entirely to the emulation of real-world physics. It is easy to diagram each of these middleware programs into a graph to determine the potential applications of each. the most basic conclusions to draw here are that PhysX is more for physics simulation specifically, Unity is more for designing simpler games from the ground-up, and Havok is for designing multiple aspects of a game's features aside from just physics.
(Table omitted for preview. Available via download)
Craighead, J., Burke, J., & Murphy, R. (2007). Using the unity game engine to develop sarge: a case study. Computer, 4552, 366-372.
Green, S. (2007). GPU physics. SIGGRAPH 2007 GPGPU Course. Retrieved from: http://www. gpgpu, org/s2007/slides/15-GPGPU-physics.pdf.
Harris, M. (2008) CUDA Fluid Simulation in NVIDIA PhysX NVIDIA Developer Technology
Telekinesys Research (2002). Havok Game Dynamics SDK: A Product Overview of the most comprehensive, optimized, real-time physics solution for game development. 4-13.