How we designed the 3D avatars for AI:MMO

Since 2014 Code for Life has had a significant impact on the teaching of Computer Science worldwide. However, with over 150,000 users spread across 100 different countries, we still thought we could do more, and therefore decided to further increase our reach by designing a second game for 11-18 year olds. Our new game, AI:MMO, focuses on the continued development of students’ coding skills, while also introducing some of the fundamental concepts underpinning artificial intelligence, all in the format of a multiplayer online game.

Once we had decided upon our goals, we had to put a lot of thought into the game play and design. Our small, dedicated team had done a marvellous job with Rapid Router, but the overall game play was far more simplistic than our vision for AI:MMO...

Nowadays, 3D characters are a mainstream element in the vast majority of video games, with varying degrees of detail and stylisation. After extensive user research, we learned that teenagers prefer games designed in 3D, particularly when those games involve personal avatars. Code For Life´s new game, AI:MMO, makes use of 3D models as the players’ avatars, so we thought we would put together this blog as an overview of how we went about this character creation process:

1. Planning the Character 
The avatar creation pipeline began with the concept for the model. Given AI:MMO’s nature, the most important things to consider were:

  • Polygon count

  • Non-specificity

Indeed, AI:MMO is web-based, multiplayer game intended to be played in schools that may have limited technological resources. These are important constraints when it comes to character modelling, as several characters will have to be real-time rendered on the screen at each moment, and the game has to be as responsive as possible. Polygon count, i.e. the number of faces that a model has, greatly influences this aspect. The lower the polygon count, the faster each frame renders, in general. As avatar resolution is not a priority, the decision was made to keep polycount as low as possible for simple animation.

On the other hand, we established only one model would be used for the avatars of all players, which would only be distinguishable by their texture. This made it easy to keep polygon count low, as the character’s features did not have to be player-specific or even distinguishable for the game’s first version. Furthermore, a lower polygon count meant a lower download size for the game itself - this was an important factor, since AI:MMO is primarily meant to be played in classrooms.

AI:MMO’s character model was, therefore, planned to be low-poly and as simplified as possible, preserving a human-like shape.

2. Modelling the Character 
Blender was the software used in all stages from modelling to animation, since it is an open-source package that includes all necessary features. There is no “right” technique for this stage of the process, only a few common mistakes to avoid. Blender provides plenty of tools for vertex, edge, face and object manipulation, which are ideal for creating characters without much mesh detail. It also provides 3D sculpting tools which can be used for characters that require more detail.

The model for the avatars in AI:MMO was created bearing in mind the places where the mesh would have to bend to be animated for the simple motions required (walking, running, idle cycles). These areas needed a bigger face density to help them deform properly when the mesh is bound to the skeleton that will make it move (through the process of rigging and skinning).

The main things to consider when modelling a character are:

  • Topology - this is the way the faces are distributed throughout the mesh. In a game character where rendering time is an important factor, it is generally a good idea to split the mesh in triangles to save on interpolation calculations.

  • Scale - it is good practice to check the object’s scale. You can do so by comparing it to a primitive object of size 1 unit. Modelling assets already in the correct scale will prevent having to resize in the game engine.

  • T-Pose - modelling characters in a relatively neutral pose and minimising mesh bend, will be helpful for the later step of rigging.

  • Pivot Point - it is also a good idea to keep the pivot point of the object in mind, as this controls the way transformations are applied.

  • Mesh refining - it is advisable to make sure there are no weld vertices, hidden faces or holes.

3. Texturing 
While it can be done at any time in the process after modelling, texturing was the third step in our process. There are a few different ways to texture a 3D model, and the one used here was UV unwrapping and mapping with Blender’s UV editing tools.

Put simply, UV mapping is the process of mapping a 2D image onto a 3D model’s surface, where U and V are the 2D axes of said image.

For this, the 3D model has to be “UV unwrapped”, i.e. the faces of the mesh need to be projected onto a 2D plane as a UV map. Blender does this automatically, but when handling characters it is a good idea to manually define the face edges that will work as “seams” for the mesh to split.

Once unwrapped, the UV map is displayed on Blender’s editor and can be directly painted on, as well as the 3D model itself. By assigning a textured material to the model, changes in the texture file will be reflected on it.

4. Rigging
Rigging is the step that should follow modelling (or texturing if the process is sequential), once you have made sure topology is fixed and the mesh is clean. It is the creation of the skeleton that the mesh will be bound to in order to be animated. In AI:MMO, this was also done in Blender with an armature and parented bones that control the way the mesh moves and deforms.

For the simpler model, fewer bones were used, as there was no need for fingers, a complex spine or a facial rig, but depending on the end goal, a rig can have up to 100 joints/bones.

5. Skinning
Skinning is the action of binding the mesh, i.e. binding the “skin” to the rig so that it can be controlled and animated. In Blender, this is done by “weight painting”, the process by which, for each bone, you assign vertices with a certain weight depending on the influence it has on them. It can be done automatically or manually, or a bit of both. A few common recommendations while rigging:

  • Test the skeleton with a simple animation without the mesh bind to ensure it works as desired.

  • Start skinning by applying automatic weights (whichever are provided by the 3D package used).

  • Go in and tweak weight manually, testing the deformation as you go along.

6. Animating and Exporting 
Blender has its own animation layout, with a timeline, dope sheet, graph editor and all the tools required to carry out most game animations. For AI:MMO, a simple run animation was created with the basic rig and exported to Unity, alongside the model in .FBX format.

3D character creation is a crucial and complex part of the game development and animation pipeline. We have focused on a very simple example, as required by the AI:MMO game, but the steps are common to most cases and serve as a base for further research on the matter. We hope you have found this useful!

If you have any personal experience of using Blender for character creation and animation, we’d love to hear from you. You can get in touch on twitter: @codeforlifeuk or facebook: @CodeForLifeUK.

Alternatively if you’re interested in getting involved with the Code for Life initiative check out our job openings or take a look at our volunteering opportunities by visiting the AI:MMO GitHub page and our translations page.

Written by Maria Fernando, Game Artist at Code for Life

george smith