Part 1 can be found here.
Looking under the hood
In our game studio, we actively use Python scripts. We tried to make the entire exporter using them. Naturally, Python is not suitable to work with large sets of binary data, such as vertex buffers, index buffers etc. The data model and serializers of such buffers were implemented using C++ in the form of a library (.pyd), which in a way “wrote into” the data model under Python. The entire business-logic was made in Python.
The exporter framework was planned to be used not only during “manual” export from Maya, but for any tasks where its functions could be re-used, such as the automatic verification of content. When it comes to any developer tool, we need to have it interfaces (API) for Python, a command line and UI tools.
The architecture of the exporter framework is modular and layered. There are physical and logical layers and also a domain layer. Each layer contains separate modules: data model, business-logic, serializers and converters, capable of converting the data model of one layer to data model of another layer. Physical and logical layers practically form an analogue of ORM-architecture.
Domain layer architecture is designed to easily handle the data models by business logic. It is completely isolated and has no ties to the way it will be serialized to physical storage.
Full exporter architecture:
The layered architecture introduces some specific elements to the export process. We actually deserialize two (or more) models from various sources (Maya and Bigworld engine). After that, we perform a merge of these models into a new one. New model is then serialized into the Bigworld engine format.
Flexibility of the content creation process
The architecture we made allows us easily enough to create complex processes of content production. For example, pripary ship model technically consists of three separate Maya scenes, each of which is developed at the same time by different departments:
- first scene is the visual model and collision model
- second scene is the ballistic model
- third scene contains effect ports
In addition to that, engine redactors add their own data into the working model in engine format (fourth scene). The exporter easily solves the uneasy task of unifying all four scenes into one resulting ship model.
Content verification system allows us to look for errors in the content either in each layer (source) separately, or in the resulting content. By now, the number of verifiers reaches several dozen. Automatic content verification is implemented in the build creation, which allows us to exclude human element and to guarantee the integrity and technical purity of the content as much as possible.
This is how verification of ship model in Maya looks:
An important part of the content verification process is the budgets check, for example a polygon count. On the picture below, the information about the number of polygons for each LoD on a visual model is displayed.
The need for such a check is illustrated by a story from the development of another Wargaming project, where there was a space on the map, covered by undestructable houses. Whenever the camera turned towards this spot, the FPS dropped terribly. After exporing the issue, it was found out that inside one of the houses, there was a model of a bathtub and inside, there was a little plastic duck. All that would be considered a small joke by the artists, were it not for the fact that the duck model had around one million polygons.
In reality, it is very difficult to comply to budget limitations. Many models are exceptions to the rule. Setting the value of the budget to a range also does not solve the issue, as over time, the polygon count of the models simply begins to reach the upper value of the range set. In our case, we plan to change the specific budgets of those models, which do not fit the standard budget of the given model type.
During each stage of the export, you have to do pre-/post-processing. For example, before the conversion of the logical data model in the Maya layer into the data model of the AA guns domain, you have to do preliminary gun skeleton rotation by 45 degrees and the removal of the skeleton. Our architecture allowed us to smoothly implement various processes during each stage of the export.
Example of a model before and after pre-processing
To be continued…