Tutorial: Custom Engine Integration


One of the first considerations when designing MOG was the ability for each team to easily integrate MOG control and functionality into any off-the-shelf or proprietary game engine. To do this, we spent a fair amount of time abstracting the core functionality within MOG to an external DLL.

To walk you through the process of integrating MOG features into your game or custom game application, I will describe the procedures we went through here at MOGware to integrate MOG into Epic's latest Unreal engine 'Unreal 3'.

The Goal

Exporting Assets - Enable users to save assets from within UnrealEd back out to MOG.

Importing Assets - Enable users to import assets into UnrealEd directly from their MOG inboxes.

Rebuild Packages - Enable the rebuild of any package in Unreal from scratch.

Tracking Modified Assets - Enable the tracking of modified objects in the editor.

The Plan

To accomplish our goals, we needed to add a small amount of code to the editor to make it 'MOG aware'.

The hub of MOG's functionality is located in a portable MOG.dll. By copying this to our executable's folder and adding it to our solution, we now have access to all MOG functions that we will need. The first thing we needed to do was dynamically load and initialize the MOG.DLL as an editor MOG component. Upon initialization, the MOG.DLL will establish an open TCP socket with the MOG Server where command requests are sent and received.

Accomplishing our Goals

Exporting Assets
Exporting data directly into the MOG inbox is a relatively simple procedure. Using a well defined API, you can specify what file should be imported, along with any custom object properties you want associated with that asset.

Importing Assets
Importing asset directly in the editor from MOG is performed through the MOG packaging API. Although MOG supports a variety of packaging schemes, we chose to communicate with UnrealEd through a MOG packaging task file which contains a list of customizable packaging commands and their associated files.

TaskFile

Unreal simply parses this package task file upon receipt of a package merge request from a MOG client. To handle all the importation of the various asset types, we simply used the already existing Unreal Commandlet's.



Rebuild Package
To handle our Rebuild package command we needed to implement a delete package commandlet within the Unreal Editor because we wanted to start with a new empty package file. With that in place, MOG can create a package task file with all the assets contained within a package and rely on the editor to essentially rebuild the package from scratch.

Tracking Modified Assets
To accomplish this we sub-classed the generic browser within the editor and created a new MOG Browser. This new browser would monitor the asset dirty flag within UnrealEd and change the outline and text color of the asset to red if it had not yet been exported to MOG.

The GUI

To make this a more seamless interface for the user, we made a few additions to the editor to give users an easy conduit to their MOG Client.

Login Menu
The login menu offers users a location to check for MOG connectivity, active project, and logged in user.

Context menu items for exporting selected data to MOG
The content-sensitive context menus allow users to export a selected asset to their MOG inbox.

MOG Generic Browser
The MOG generic browser is an asset browser that shows users a quick glance of all assets that have been modified by the user throughout the Editor environment that need to be exported to MOG. The browser also features a quick toggle that switches the browser back and forth between the MOG browser and the default generic browser.

Default Browser


MOG Browser

Commit Changed Window
This window lists all the modified assets that have not yet been exported back to MOG. With this window, users can selectively export items from their authoring session with one easy click of a button.

Conclusion
With these changes in place, we are able to provide the ability to work on and share assets at an atomic level. This essentially breaks up large un-sharable conglomerate binaries into smaller trackable, versionable, and reportable assets.



For more information on API's or code questions contact MOGware's engine integration department.


© 2005-2007 Mogware, Inc. All Rights Reserved. Email Us