Tuesday, February 11, 2014

Android Programming, 3D Images and OpenGL ES

As disused in my previous article "Unity Game Engine's Mesh Renderer, Mesh Filter, Shaders and Materials Overview" a 3D scene is defined by a collection of vertices that include attributes such as position, normals, texture values, etc. For a device to display a 3D animation scene, the scene is transformed into a 2D image through the rendering process (aka the rendering pipeline or graphics pipeline).

This articles discusses the Open Graphics Library specification for Embedded Systems (OpenGL ES) used to define shaders and other elements to render 3D scenes. It also discusses the OpenGL Shading Language specification. And it provides an overview of a simple Android application that uses the OpenGL ES to render animated graphics on Android devices.

OpenGL ES and the OpenGL® Shading Language

For a 3D scene to display there are a series of steps executed through the rendering pipeline. These steps ensure 1) only the objects within the camera's view display, 2) reflections are properly added, and 3) images behind other images are shown/hidden based on the camera's view. The output is then merged and the final image displayed. The last stage of the rendering pipeline finalizes what pixels will display based on the pixels closest to the camera and other variables mentioned. The 3D scene below, from the Stealth game, shows a game scene that has not yet gone through the rendering pipeline.



When we run the game (so that the vertices are transformed into a 2D image), notice we only see the game objects closest to the camera.  And, based on the camera's view objects behind some of the partitions are hidden. As the player moves the view shifts and more processing occurs to render the images that are now within the camera's view.


Developers who specialize in 3D and animation can program some of the stages associated with the rendering pipeline by creating programs called shaders.  Shaders execute inside the graphics processing unit (GPU) and define how the data is processed to, ultimately, display the final image. The ability to create shaders means developers can now create custom effects that were not possible when the rendering pipeline only included pre-programmed stages.

The OpenGL ES is a cross-platform API used to create and compile shaders and execute other related operations including the ability to define buffers that the shaders write to.

OpenGL Shading Language


In addition to the OpenGL ES specification the OpenGL Shading Language specification is necessary to understand the different data types that can be used including vectors, matrices, opaque types, samplers (which are handlers to textures), cube maps, depth textures for shadows, etc. It also defines the statements and structures, variables (including constants) and more. The OpenGL Shading Language support progamming the following shaders: vertex shader, tessellation control shader, tessellation evaluation shader, geometry shader, fragment shader (sometimes called the pixel shader), and compute shader.

Vertex and Fragment Shaders


Each shader type is directly linked to a processor. For example, Vertex shaders run on the vertex processor. The vertex shader is used to read the coordinates of the vertices, transform them to 2D screen coordinates as well as process other attributes of each vertex such as color, normals, etc.

The fragment shaders (also referred to as pixel shader) receives pixel data, calculates the final color of the pixel and passes it to the next stage so the final output can be produced. The pixel shader can change the depth of the pixel to define what pixels should or should not be drawn. By default, the depth defines the distance between the originating triangle and the camera. But, the developer can manipulate the distance by specifying a value that will be used when the final image is created.

(You can read a more general overview of Shaders by reading my previous article Unity Game Engine's Mesh Renderer, Mesh Filter, Shaders and Materials Overview.)

Android and the OpenGL ES


Android includes support for 2D and 3D graphics using the OpenGL ES API. Android supports several versions of OpenGL ES as follows:
  • OpenGL ES 1.0 and 1.1 is supported by Android 1.0.
  • OpenGL ES 2.0 is supported by Android 2.2 (API level 8).
  • OpenGL ES 3.0 is supported by Android 4.3 (API level 18).
Note that when you use a higher version of OpenGL ES with android; all lower versions are supported. For example, if your app uses OpenGL ES 2.0; it also supports OpenGL ES 1.0

Before you start developing your 3D app or game you will want to download and install the Android Developer Tools (ADT) Bundle and access the Android SDK Manager to download the applicable Android SDK platform, etc. For more information, please see my previous article titled:  Programming Mobile Apps for Android With Eclipse.

Note:  When you create an emulator, as outlined in my previous article, make sure you check the option to enable the GPU on the host. As mentioned, OpenGL ES apps require access to a GPU.


Displaying Graphics on Android with OpenGL ES

 

Android Manifest


When you create an Android app that supports OpenGL ES, you must add a declaration to the AndroidManifest.xml file. The uses-feature statement to be added includes the glEsVersion attribute, which provides a way for developers to define the OpenGL ES version required to run the application. For example, if OpenGL ES version 1.0 is required; the glEsVersion attribute is set as 0x00010000. If an application requires OpenGL ES 2.0 and OpenGL ES 3.0; the value of the attribute is set to 0x00030000. It is then understood that the application supports not only OpenGL ES 3.0; but also all lower versions. Here is what the uses-feature statement looks like (in this example the application requires OpenGL ES 2.0):  <uses-feature android:glEsVersion="0x00020000" android:required="true" />

The uses-feature statement takes two other values besides glEsVersion as follows: android:name and android:required. Android:name defines a valid value from the hardware or software list at the bottom of the Uses-Feature API Page. The android:required value defines whether the feature is "required" to run the app. True means the feature is required; false means use the feature if it is available on the device.

The classes that make up the android application project is defined by the graphics and their behavior. Take a look at the simple Hello OpenGL ES projects, which can be downloaded from http://developer.android.com/training/graphics/opengl/environment.html.

Note: Once you download the project, you can use the Import option, available from the File menu in Eclipse. You can then use the "Existing Android Code Into Workspace" option to import the project and then run it as an Android Application. Remember you cannot run the project without an emulator that has GPU support and the android version that corresponds to the required OpenGL ES version, as discussed in Android and the OpenGL ES section above. 



The download includes two android application projects. One requires OpenGL ES version 1.0 the other requires version 2.0. When you run the application it displays a triangle and a square. You can click and rotate the triangle because it was programmed to respond to user interaction.

 Hello OpenGL ES Android Application Project Classes


The Hello OpenGL ES project's core classes are as follows:
  • MyGLSurfaceView
  • MyGLRenderer
  • OpenGLES20Activity
  • Square
  • Triangle

MyGLRenderer implements the GLSurfaceView.Renderer class, which is used to render a frame. In the Hello OpenGL ES project the GLSurfaceView.Render uses GLES20 constants to draw the background color of the frame. It uses the Matrix class to set the camera position as well as calculate and store 4 x 4 column-vectors for rendering. (Below is an example of the 4 x 4 column-vector matrices from the OpenGL ES Android reference:)

  m[offset +  0] m[offset +  4] m[offset +  8] m[offset + 12]
  m
[offset +  1] m[offset +  5] m[offset +  9] m[offset + 13]
  m
[offset +  2] m[offset +  6] m[offset + 10] m[offset + 14]
  m
[offset +  3] m[offset +  7] m[offset + 11] m[offset + 15]


The Hello OpenGL ES project introduces quite a few interesting programming concepts. For example, the MyGLSurfaceView class implements the GLSurfaceView class, which creates a view container (which manages a surface so OpenGL can render to that surface) used to render OpenGL ES graphics as well as capture touch events so users can interact with the graphics. Th android activity class creates an instance of the GLSurfaceView to serve as the Content View for the activity.

In the project the MyGLSurfaceView calls the MyGLRenderer class so the graphics can be rendered using the GLSurfaceView.Renderer class. Both the Triangle and the Square class use the GLES20.glCreateProgram() command to create an empty OpenGL ES program. And the GLES20.glAttachShader command is used to add the vertex and fragment shaders to the program.  The GLES20.glLinkProgram command (or public method) is then used to create the OpenGL program executables. The vertex shader executable runs on the vertex processor and the fragment shader executable runs on the fragment processor.

Since the user can interact with the triangle, the triangle coordinates are captured and used to write the position of the triangle. The MyGLRender class is implemented in a way that ensures, once the triangle is rendered, it is only rendered again when the data changes.

Summary


Overall the Hello OpenGL ES project has a very simple design that executes the key elements of an animated graphics android application. This program can help developers more easily understand how to program graphics using the OpenGL ES API as well as create shaders and assign buffers. For more information you can refer to the following list of resources:


Friday, January 24, 2014

Game Cheat Engine Overview (Part 1)

Yes, it's true. There is a software program that can be used to cheat when you play a game. My guess is that die-hard gamers would never use such a tool. But for people, like me, who love software and like to explore you will likely find this little tool a bit interesting.

A cheat engine is a software app that lets you change values assigned to a variable in a game. (Note that a variable is a named storage location in the computer's memory. The storage location holds the value that might be a number, a text string or some other data type. The variable provides the developer a way not only to store; but also to retrieve and manipulate values. For example, a game might give a new player 3 lives. And each time the player get's shot "x" number of times (where x can be any number), the player looses a life. In this example the number of lives is stored in a variable. And, as an incident occurs that results in the value changing (i.e., the player looses a life) the value is updated.

The Cheat Engine provides a way for users to locate the value in memory and change it. For example, if a player wants to change the number of lives from 3 to 10--the Cheat Engine could be used to accomplish this task. The following paragraphs provide additional information on various ways Cheat Engines might locate a variable's value and change it.

Downloading the Game Engine


I downloaded Cheat Engine 6.3 from www.downloads.com. But it can also be downloaded from http://www.cheatengine.org/.

Download Engine Page

Note:  If you are not familiar with www.downloads.com; it's probably not the best place to download the Engine. This is because downloads.com adds a lot of unwanted software to downloads. If you are familiar with downloads.com you probably have already figured out how to duck and dodge your way to an executable that includes only the product you want to install.

Installing the Cheat Engine


The Cheat Engine is pretty straight forward to install. However just be aware that when you come to the "Improve Your Internet Protection" screen you can select "Custom Installation" (even though it "appears" to be disabled) if you do not want to install the AVG tool bar or the Outfox.tv application.

Custom Installation Image

Once you select Custom Installation, from "Improve Your Internet Protection" screen, you can deselect the AVG options if desired, as shown below.

Custom Installation Image With AVG Options Deselected

When you click "Next" install wizard recommends the Express installation.You can click Custom Installation if you want to deselect the "Install Outfox.TV" option.

Express (Recommended) Option Selected Image

You can then continue to use the Setup wizard until the Cheat Engine is installed. Once it is installed an Information window displays. When you click Next a dialog pops up and asks "Do you want to try out the tutorial?" If you click yes, the Tutorial application launches. Note that the Tutorial application is a separate app from the Cheat Engine app. Both apps are shown in the following picture.


When you click the Next button on the Cheat Engine Tutorial app you are presented with the first objective in the tutorial. You must click the "Hit me" button on the lower left bottom portion of Cheat Engine Tutorial app. Doing this changes the "Health" variable's value.


 Changing a Known Value


In this example, you know the value of the variable. For example, if you start a game with 250 rounds of ammunition; you know the value--but you don't know the address of the value (i.e., where in memory the value is located). As shown in the following picture I clicked the "Hit me" button until the Health value changed from 100 to 73. The Next button, on the Tutorial app, will remain disabled until I locate the Health variable and change its' value back to 100. To begin I have to use the Cheat Engine app to open the Tutorial executable file (i.e., Tutorial-i386.exe). To open the .exe file I use the "Select a process to open" button, outlined using a red box in the picture below.


When the Process List window opens I can select the Tutorial executable (highlighted in the picture below) and click the Open button.


The Cheat Engine opens the executable file and populates the Engine with the Start and Stop scan ranges and other values. There are three values that are primarily used for the Scan as follows:  "Value", "Scan Type" and "Value Type". The "Value" field holds the value of the variable. The Scan Type indicates the type of scan that will be used to locate the value. And the Value Type, which is the same as a data type.



Note: If you are not familiar with Data Types (referred to as "Value Type" in the Cheat Engine) Microsoft has an older reference for C# that provides a brief and basic example of data types. This might help clarify how one data type differs from another: http://msdn.microsoft.com/en-us/library/cs7y5x0x%28v=vs.90%29.aspx

In the Value field, shown in the above picture, I entered 73, which is the current "Health" value based on the number of times I clicked the "Hit me" button. Since I am searching for the exact value "73" I leave the Scan Type value set to "Exact Value". Also the "Value Type" is set to 4 Bytes, which is feasible to search for the numeric value 73.


When I click the First Scan button a list of values display in the left side of the window. This means more than one variable's value is currently set to 73. So I need to isolate the variable specific to the "Health" value.


To do this I will need to click the "Hit me" button. Clicking the button changed the Health value to 71. I enter 71 in the value field and then click Next Scan. The Cheat Engine rescans the variables already presented and searches for the variable whose value is now 71. As shown in the following picture, only one variable has a value of 71. So I know this is the Health variable.


I can either double-click the address value; OR, right click it. If I right-click the value a popup window displays. I can then select "Add selected addresses to the addresslist", as shown below.


Whether I double-click the address value or use the popup window, the address is moved to the bottom portion of the window, as shown below.


Right-click the value in the bottom window. The popup menu displays. Select Change record -> Value, as shown below.


The Change Value window displays. I can now change the Health Value from 71 to 1000 and click OK to close the Change Value window


The Next button is now enabled, which signifies that I have performed the step properly and can move on to the next step.


The following objectives show how to locate a variable whose address changes, how to use pointers and more. If there is enough interest in this topic I will post the information for the remaining steps associated with the Cheat Engine tutorial.

Wednesday, January 1, 2014

Unity Game Engine's Mesh Renderer, Mesh Filter, Shaders and Materials Overview

Unity Game Engine provides a way for game developers to apply shaders, textures and colors to a polygon mesh. From the user avatar to the get-a-way car or even the abandoned science lab with broken furniture, rabid dogs and glass vials--the mesh filter and mesh renderer turn polygon meshes into recognizable objects. This article provides an overview and examples related to Unity's mesh filter and mesh renderer. All of the examples included in this article are taken from the Unity Stealth Project, which can be downloaded at https://www.assetstore.unity3d.com/#/content/7677.

Meshes


A mesh is a collection of triangles used to create an impersonation of an object in a 3D world. The following picture shows a partial mesh.


Meshes are used to define a 3D world because they render more quickly than images.



Each triangle, used to makeup the mesh has three corner points referred to as vertices. In programming, the mesh class (the interface to an object's mesh geometry) uses not only vertex arrays; but also triangle arrays.  The vertices of the triangles that make up the mesh are stored as integers in a single vertex array. The vertices are assigned to the mesh. The developer can then build the triangle indices--3 indices in the vertex array for each triangle. The triangles are then assigned to the mesh and the vertex normals can automatically be calculated using RecalculateNormals().


While the triangles give the mesh shape; the vertex normal values assist in providing lighting from the appropriate angles. This lighting is required so the mesh can be seen. For more information about normal vectors see http://docs.unity3d.com/Documentation/Manual/ComputingNormalPerpendicularVector.html.

In Unity, if an object is textured its wireframe can be seen (while using the Scene View) by selecting the Wireframe option, as shown in the picture below. Alternatively, you can select Textured Wireframe to see the materials associated with the mesh and the mesh as an overlay.



For more information on meshes see the Unity Script Reference Documentation at http://docs.unity3d.com/Documentation/ScriptReference/Mesh.html and the Unity Mesh documentation at http://docs.unity3d.com/Documentation/Manual/AnatomyofaMesh.html.

Selecting a Mesh Filter


You can drag a mesh onto the Scene View in Unity to specify the mesh you want to render. (For more information on the Scene View you can read my previous article titled Unity Engine - Building Games for Facebook, PlayStation, XBox 360, etc. (Overview). If you want to change a mesh, you can do so by selecting the Mesh Filter option on the Inspector window, which appears after you select a mesh or gameobject.


The above approach works well if you have a gameobject associated with materials; but want to change the selected mesh. To view the currently selected mesh, from the Inspector, select the gameobject using the Scene View. When the Inspector displays click the Select Mesh button (shown below). The Select Mesh window (shown in the picture above) displays. You can then view the currently selected mesh: or select a different mesh from the list of available meshes.


If you have imported a mesh from an application and want to apply shaders and textures you will need to use Unity's mesh renderer, which is discussed below.

Note: Although Unity does not include modeling tools; you can import meshes and materials from other tools (such as Autodesk SoftImage) into Unity. But keep in mind that the Unity Asset store does include Editor Extensions/Modeling plugins that provide a way to extend the Unity Engine to perform some 3D modeling tasks.

Mesh Renderer


Within Unity a mesh is rendered by applying a shader, which is a program that executes inside the graphics processing unit (GPU). The shader defines how data (associated with a graphic) is processed. For example, the shader defines how the graphic is rendered such as whether or not to cast shadows, lighting, color, etc. The following picture shows the properties associated with Unity's Bumped Specular Shader, which executes the commonly used vertex shader and fragment shader.


The shader also determines the render queue to which an object belongs. This is done so objects are drawn in the proper sequence. Unity ships with four pre-defined render queues as follows:
  • Background queue, which renders its objects first.
  • Geometry queue, which renders opaque geometry objects before the Alpha Test, Transparent and Overlay objects are rendered.
  • Alpha Test queue, which renders alpha-tested objects after the opaque geometry objects have been rendered.
  • Transparent queue, which renders objects such as glass and all other alpha-blended objects after the opaque geometry and alpha-tested objects are rendered.
  • Overlay queue, which renders lens flares and any other overlay effects after the Transparent objects are rendered.

The Stealth Project includes the prop_battlebus mesh, which uses 16 materials to apply shaders, textures and color to achieve the look shown below.


To display a gameobject the mesh filter passes the mesh to the mesh renderer, which applies the shaders, textures and color values.

To add shaders and textures you must first add a material element that will enable you to select the a material that includes the desired shader and texture files. The Stealth Project Battle Bus uses the following 16 materials, which can be applied by adding a material element for each material.
  1. prop_battlebus_body_mat
  2. prop_battleBus_wheels_mat
  3. prop_battleBus_lights_mat
  4. prop_battleBus_tv_mat
  5. prop_battleBus_sacks_mat
  6. prop_battleBus_canister_mat
  7. prop_battleBus_carpet_mat
  8. prop_battleBus_barbedWire_mat
  9. prop_battleBus_crates_mat
  10. prop_battleBus_appendages_mat
  11. prop_battleBus_tubes_mat
  12. prop_battleBus_baggageFrame_mat
  13. prop_battleBus_whiteMetal_mat
  14. prop_battleBus_blackMetal_mat
  15. prop_battleBus_boxes_mat
  16. prop_battleBus_canvas_mat

The following picture shows the prop_battlebus mesh displayed in the Scene View. Notice there is only 1 default material element (Element 0) added to a mesh. Also, the Mesh Filter is the prop_battleBus.


Click the Materials Size option to change the Size value from the default 1 to 16. Press enter to execute the change. Unity adds 16 materials so a material can be associated with each element until all materials have been added to the Battle Bus.


We can use the Select Material button to select the desired material for Element 0. I selected the prop_battlebus_body_mat material for Element 0, as shown in the following picture.



Once the material is associated with the prop_battleBus I can view the properties associated with the material, as shown in the following picture.


The shader associated with a material drives the properties available to the material. For example, the prop_battlebus_body_mat uses the Reflective Bumped Specular shader (as shown in the following picture). The Reflective Bumped Specular shader is a member of the Reflective Shader Family and includes reflective properties used to simulate metal objects.


You can learn more about shaders and related properties by viewing Unity's Built-in Shader Guide at http://docs.unity3d.com/Documentation/Components/Built-inShaderGuide.html.

If you click the Select button associated with the Base (RGB) Gloss (A) property I can see or change the 2D Texture .tif image associated with the prop_battlebus_body_mat material. You can also click the Select button associated with the Normalmap to see the normal map image used by normal map shaders to make low-polygon models appear to be more detailed.



To add the remaining materials you click the Select Material button associated with the remaining elements (1 through 15) and select the applicable material from the list presented earlier in this article. Once you have added all of the materials the Battle Bus will look like the picture shown below.


If you are new to Unity and/or 3D game development it helps to look at existing games to see how they are guilt and coded to get a better handle on the assets and capabilities your game can have. Unity's Asset Store provides a number of example projects that can be downloaded and used to learn more about Unity and 3D/2D games.

Happy New Year Everyone!

Thursday, December 19, 2013

Hire Microsoft for $5.00 Per Month: Office 365 & SharePoint

As a Sr. Systems Analyst, a big part of my job has been to recommend business tools to national and international enterprises as well as government organizations. This article provides technology recommendations to help entrepreneurs, home businesses and small businesses gain a competitive edge to perform like a big business.

There are three key areas that big businesses care about: saving moving (through efficiency), delivering quality customer service, and adopting business tools that bring the best value. Over the past couple of years big organizations like Home Depot, ABM Industries, Lockheed Martin, Turner Broadcasting, Dell, Northrop Grumman, SAIC, Sun Trust Banks, Ernst & Young, Sogeti USA, Hewlett Packard, General Dynamics, Federal Aviation Agency, the Department of Defense, and many others have paid well over $1,000,000.00 to implement Microsoft Office SharePoint Server Online, which is part of Office 365. And, there is a product package available for entrepreneurs, home businesses and small businesses. The cheapest package is $5.00-a-month. The most expensive package is $15.00-a-month.

And, one of the most interesting aspects is this price includes access to Microsoft's support and system administration team. Yes, you read right! If you run into a problem, you contact Microsoft and one of their support persons will help you troubleshoot the issue. The following paragraphs provide additional information about Microsoft's Office 365, which includes access to Microsoft Office SharePoint Server and other office applications hosted in the Cloud.

Intranets & Extranets


Probably the most valued capability is the ability to easily create websites that meet a specific business objective. For example, entrepreneurs or small businesses that want to effectively manage customer problems can easily build a website customers can log into to submit a complaint. The organization can assign statuses to the complaint so the customer can monitor the organization's progress towards resolving the stated problem. As the solution is implemented the status is changed to keep the customer informed through notifications.



Or, entrepreneurs or small businesses may want to keep customers informed. Whenever a website is created SharePoint, which is a content management system, automatically creates a mobile version of the site. And, with two clicks content is syndicated and made available as an RSS feed to which users can subscribe.



Create a virtual meeting room website to host virtual meetings. Add Microsoft Office Lync Online to gain instant messaging (IM), the ability to make phone calls through your computer (with the appropriate hardware). And, moderate or join audio, video and web meetings with people you invite. You can give an online presentation by sharing your desktop.

Or, if working with a customer to finalize a proposal give the upload the document to the meeting room so the customer can access the document and make changes. SharePoint can notify you when the customer has completed his or her revisions.



Speaking of sharing documents users can upload, organize and manage Microsoft Office documents using SharePoint's shared documents feature. Access those documents from any location using your laptop or hand-held device such as a mobile phone or tablet.


Manage your calendar and messages.


You can also manage photographs by uploading them to SharePoint online, which means they can be accessed from anywhere.

You can learn more about Office 365; or even test drive it by visiting: http://office.microsoft.com/en-us/business/office-365-small-business-small-business-software-FX103887194.aspx

Monday, December 2, 2013

Create a YouTube Video That Is Accessible From ANY Device

One of the most frustrating things, to me, is to navigate to YouTube from my phone, select a video only to get the message "the owner has not made this video available to mobile users". That might not be the exact message; but it's something like that. This post provides instructions on one method that can be used to make a YouTube video available to any device.

The tools I cover in this article is Adobe Premiere and Adobe Media Encoder.  In the near future I will also create a post like this for Final Cut Pro. But for this post I will discuss how to make a YouTube video available for any device using Premiere.

My first step was to use Premiere to create a new project--ensuring the HDV option was selected, as shown below.


Next I imported my audio, still photographs and videos. I created a master sequence and nested sequences to develop my video. I used nested sequences (shown as green video clips below) for two reasons: 1. It would be easier to manage and  work with clips overall because my project would, in a sense, include multiple smaller sequences used to create one main sequence. This approach would make it less cumbersome to make changes. For example, if I wanted to shorten or change the transition duration for a nested clip--I would be able to simply go to the sequence that includes the video and make the change. Adobe Premiere would then make the necessary adjustments so I would not have to slide clips closer together or push them further away to avoid black gaps or other problems.  The change would then automatically show up in my master sequence.


2. I looked at the video clips I had to create the video. I noticed some clips were shaky. Using nested sequences would enable me to apply the Warped Stabilizer (highlighted using a red box in the picture below) to these clips so they would play more smoothly.


Once everything was in place and the video played the way I wanted it to I was ready to export it. I selected File -> Export -> Media to select the options that would enable me to convert my Premiere project to an MPEG-4 file that all devices could access.


After I selected File -> Export -> Media, the Export Settings page, shown below, displayed.The selections made on this page drive the size and quality of the video as well as the format. The option that drives whether or not all devices can access the video is the Format option. If you locate the Format option below you will see H.264 beside it.


H.264 is one of several video compression standards. It is commonly referred to as MPEG-4 Part 10 OR MPEG-4 Advanced Video Coding (AVC). Both H.264 and AVC are MPEG-4 codecs that produce MPEG-4 files that contain video and audio clips. If you want your video to playback on not only computers and laptops; but also handheld devices you will want to select H.264 as the Format option, as highlighted by a red box in the following picture.



Adobe Media Encoder is the component within Adobe Premier that provides access to the formats used to convert the project to the H.264 or other format. However, you don't have to use Adobe Premiere to convert a video to the H.264 format. As previously mentioned, Adobe Media Encoder is available as a standalone application. It also comes included not only with Adobe Premiere Pro but also After Effects, Flash Professional, Soundbooth, and Encore.

Note that you can access a free trial of Adobe Premiere by visiting: https://creative.adobe.com/products/premiere. And you can try Adobe Media Encoder free by visiting http://www.adobe.com/products/mediaencoder.html.

So far I have tested the video using my Android and it played nicely. If you have an iPhone, Blackberry, tablet or other device pull it out and check out the video at https://www.youtube.com/watch?v=WkS1O-K3AFA, click the like button if you like it or leave a comment--all feedback is appreciated.


Wednesday, November 20, 2013

Unity Engine - Building Games for Facebook, Playstation, XBox 360, etc. (Overview)

I know I'm not the only one intrigued by gaming, which is one reason I like to write about building games. So far I have written articles that include information on building games for Android and Kindle Fire. This article provides an overview to the basics of Unity 4.

Unity is a game engine that provides the ability to build games that can run on a variety of platforms including XBox, PlayStation, Windows Phone, Android , Blackberry, Webplayer, PC/Unix/Mac standalone and more, as shown in the following picture.


I think it's exciting to be able to build a game once and distribute it to multiple platforms because that means developers can distribute a game more widely, which equals a much larger audience and, ultimately, more money.

Unity Development Environment



Unity's core user interface includes the Project, Assets, Inspector, Hierarchy, Scene and Game windows. The following paragraphs discuss these windows in greater detail.

Project


In Unity you create a project to build a game. When a new project is created, you select a package to import. When you import a package the assets associated with the package are automatically included as part of the project when Unity opens. Sharing assets, such as audio files, 3D buildings, player avatars (humanoids) and other files decrease development time since some GameObjects are already completed. Developers then place and use the GameObjects the way they want to within their game.  For example, if you create a new project and import the Stealth package; all of the assets associated with the Stealth project will import into your new project including the 3D buildings, a 3D bus, humanoids, and more . Developers can then create a new game using one or more of the existing Stealth game assets; or even modify some of the assets before using them. Developer can then create new assets and incorporate them into the game.




Assets


In Unity, assets are files included in a project. Assets are available from the Project Browser. Unity has an Assets window that provides a way to view the assets within a folder displayed by the Project Browser window.


Note that assets may or may not be physically added to a scene. Although GameObjects are usually added to a scene. For example, audio files are assets and scripts are assets. Scripts reference GameObjects but you would not drop a script onto a game scene and expect to see the script do something.

Assets can be shared across multiple games because they are included in the game from a file that resides on your computer. Developers can buy assets, sell assets or even download free assets. Assets are available from the Asset Store at https://www.assetstore.unity3d.com/. And, developers can learn more about selling Unity assets by navigating to http://unity3d.com/asset-store/sell-assets.

GameObjects, Components & the Inspector Window


The Inspector Window provides a way to manipulate GameObjects by providing access to the GameObject's components. Notice the scene window below shows a GameObject selected  (a red arrow points to the GameObject). Notice the Inspector window, which is highlighted with a red box, shown in the picture below.


The Inspector window shows the components and related properties that can be manipulated to achieve a desired result. The Inspector window includes a Transform component used to indicate the position of the GameObject. The Transform component of the GameObject can also be used to scale or rotate the GameObject, as can be seen by viewing the Transform properties shown in the above picture. The following picture shows script components associated with the GameObject. Also notice a sound clip (named weapon_sciFiGun_fire) is part of the Done Enemy Shooting component and is used to bring shooting to life in the game.



In the example below, the script components were written using C#. However, developers can also use JavaScript to program games in Unity. To learn more about GameObjects read the documentation titled "GameObject" at http://docs.unity3d.com/Documentation/Manual/GameObjects.html.

Hierarchy


The Hierarchy window includes a list of gameobjects used to create a scene. For example, let's say you downloaded the Stealth game for Unity (https://www.assetstore.unity3d.com/#/content/7677). If you add the completed Stealth scene (called DoneStealth as shown in the following picture) to the Scene View, the Hierarchy shows all of the GameObjects used to complete the scene. It also shows parent/child relationships (as applicable) between objects. You can then click on each GameObject to view its related components in the Inspector window.


In addition, the Hierarchy window also includes a Create option. Developers use the Create menu to create GameObjects that display in a Scene. For example, a camera is added to a scene by selecting Create -> Camera.The camera is the GameObject through which players view the world built by the developer. One or more camera's are added to a scene so that players may view the entire world that makes up a scene.

In addition to Cameras additional GameObjects can be added such as spotlights, area lights, terrain, trees, or even cubes (that may be manipulated to serve as the ground a player walks on). The following picture shows the Create menu on the Hierarchy window.


Scenes


When a player plays a game, the game environment is delivered as a Scene. In Unity the Scene tab provides access to the Scene View. Through the Scene View developers can build what the user will see and the GameObjects with which the user will interact.

The toolbar (shown above) provides the tools developers use to manipulate and navigate to GameObjects. The hand tool enables developers to move around in the scene. The Translate tool (second from the left) provides a way to select GameObjects and drag them or enter values to place the object in a specific location. Developers can rotate GameObjects using the Rotate tool (third from the left); and, they can resize GameObject using the Scale tool (fourth from the left).

If you have downloaded the Stealth game for Unity you can see the Scene View in action by creating a new project (File -> New Project from within Unity) that includes the Stealth assets you downloaded.


To view the GameObjects and even the scripts used to build the game, navigate to the Done folder and locate the DoneScenes folder. Drag and drop the completed Stealth scene onto the Unity Scene view, as shown in the following picture. You can then play the game to see how it works.



Game 


You can then use the Game View to run and test games in Unity. To begin you must click on the Game tab, as shown by a red circle below. You then click the Play button, as highlighted by the red arrow in the following picture, to run the game.


When the game is running it behaves as it would behave if it were built and distributed to a platform. As a developer, you can use the Game View to perform all of the actions you have programmed the game to perform. You can learn more about the Game View by reading the article located at http://docs.unity3d.com/Documentation/Manual/GameView40.html.


Using Unity to Build Facebook Games


Developers can download the Facebook SDK to use Unity to create games for Facebook. For more information about the Facebook SDK for Unity view the Unity - Facebook Developers article at https://developers.facebook.com/docs/unity/

To learn more about the Unity game engine visit http://unity3d.com/unity.