Skip to main content
An OG is a player’s OpenGame character, a big head with two tall eyes on a small body. og.player.avatar gives your game two recipes, and readAvatar from @opengamehq/sdk/avatar names the parts in them. This spec describes each part, so you can draw an OG in any engine and any art style and the player still recognizes it. The numbers and colors below come from the code OpenGame draws OGs with.

What makes it an OG

Keep these the same in every style:
  1. A big head on a small body. The head is the broadest part and about 40% of the figure’s height. Do not shrink it toward human proportions.
  2. The head’s outline and color. A player recognizes the color first, at any distance. Use the hex values in the head palette.
  3. A face made of eyes. Leave out the nose, and ears too unless the outline has them. Leave out the mouth, except where facial hair reaches the mouth line: there the mouth is a gap in the hair, as described under facial hair. Draw the eyes in the eye color from the head palette, which is dark on a pale head and white on a dark one.
  4. One color for the head and the skin. The neck, the mittens and any uncovered limb are the head’s color. An OG has no separate skin tone.
  5. Mittens. A thumb and one rounded form for the fingers.
  6. The outfit as chosen. Each garment in its color, and the accessories in the places listed below.
  7. The rest pose. Upright and facing you, the upper limbs angled slightly out, the eyes glancing down and to your left.
These can change with your art style:
  • The rendering. Pixel art, flat, toon, voxel, low poly or physically based. OpenGame uses dithered pixel art for heads in 2D and smooth lit surfaces in 3D.
  • Shading. Use the five tones below or your engine’s lighting.
  • Detail. Pockets, seams, laces and creases are optional. Simplify a garment as far as you like and keep the outline and the color.
  • Proportions, a little. Stay within about 10% of the tables, and scale the full figure by one factor.
  • Patterned and metallic colors. A texture, a shader or the plain hex value.
  • Motion. Blinks, glances, squash and stretch, and your animation. Keep the rest pose as described.

Units and axes

Lengths are in H, the height of the default head. The feet are at 0, +Y is up and the OG faces +Z. When the OG faces you, the OG’s right side is on your left. The flat drawings of the head (its outline, markings, eyes, accessories and facial hair) and the anchors that place them are in portrait units instead, with x to the right and y down, as in the portrait image. The bare portrait’s square runs from -1.00 to 1.00 across and -1.00 to 1.00 down. A look wearing a head accessory is drawn in a larger square at the same scale, -1.20 to 1.20 across and -1.40 to 1.00 down, with the floor at the same height and room above for a hat. The default round head is 1.68 portrait units tall, so one portrait unit is 0.60 H.

Proportions

These are for the default OG, the classic body with regular legs. The torso is a rounded column, narrow at the collar and the hem and broadest at the chest, with an oval cross-section as deep as the torso depth. The radius at each height, from the hem up: The limbs are capsules, an upper and a lower part for each, hung from the shoulder and hip joints. The head rests on a short neck, with the lowest point of the head just inside the collar.

Bodies

body sets the torso and the limb thickness. The figure height is with regular legs.

Legs

legs sets the distance from hip to ankle, with the classic body. Figure height, from the feet to the top of the default head, for each body and leg length:

The head

The look recipe is shape.eyes.color, then an optional accessory, female for the second face set, facial hair, a hair color, a facial hair color and a hairstyle worn over the shape. readAvatar returns these as fields of head.

Shape

The shape is the head’s outline, and each one is pictured in the first table. Width and height are in H. Hairstyles are the outlines a photo of a person can become, and circle is a shaved head; a hairstyle’s hair is a marking inside its outline. A player who picks a hairstyle for any other shape has head.hair set to that hairstyle and head.shape left as their shape: draw the shape, join the hairstyle’s hair (its outline where its own marking is) onto it, and paint the hairstyle’s marking over both. On the plain circle the hairstyle is the shape itself and head.hair is null. “Markings” names the marking tone of a shape that has markings, which sets their color as described under “Edges and markings”. The second table places each outline and its eyes. Each outline stands on the default head’s spot: “Middle, right” and “Bottom, up” are its offsets in H from the default head’s middle line and lowest point. “Eyes up” places the middle of the eye pair, as a share of the outline’s height up from its bottom, and “Eyes, right” is the distance right of the neck in H. “Eye scale” multiplies the eye sizes below. The outlines themselves, the markings inside them, every eye style, every head accessory and every facial hair style are in examples/avatar-threejs/og-spec.js in the @opengamehq/sdk package, as cell masks generated from the same code as these tables. OUTLINES holds each head on a 64 by 64 grid over the bare portrait’s square, EYES each eye style around the face anchor, ACCESSORIES each accessory in head units, FACIAL_HAIR each style in face units, and ANCHORS and FACES the points each shape places them by. The comments in that file give the encoding, and og-model.js beside it shows how to read them. For a shape your game does not have, draw the default outline with the player’s color and eyes. In 3D the head is the outline inflated. At a point inside the outline d from the edge, in units where the default head’s radius is 0.84, the head is 2 × √(0.62 × d) thick: soft at the edge and nearly flat across the face.

Eyes

The default eyes, classic, are two tall ovals with a smaller light inside each, leaning to the right. Measured on the default head at rest: Each eye leans 15 degrees, top toward the right. The inner light covers about 33% of a classic eye. A style uses only the head’s two eye colors, apart from googly, which is white plastic with a black bead whatever the head. female adds short lashes on the outer side of each eye and changes no other part. Do not read it as gender, pronouns or a voice. For a style your game does not have, draw classic.

Head accessories

An accessory rests on top of the head or hangs beside it, under the eyes, which are drawn over it. A color named from the head palette uses that entry’s hex and finish, in the inks for the background. Skip an accessory your game does not have. An accessory is placed in head units around its shape’s anchor, from the “Anchors” table below. Across, u is the distance right of the anchor’s x; down, v is the distance below its seat; both are counted in the anchor’s scale, so a point is at x = Hat x + u × Scale and y = Seat + v × Scale in portrait units. On the round head, each accessory spans the u and v ranges in the table, so a negative “v from” is how far it rises above the seat. Each accessory is a list of parts, each in the main color, the trim color or the head’s eye color. Where two parts overlap, the one listed first wins, and the drawings in ACCESSORIES already show the winner. A part that goes behind the head shows only where the head is not, such as the band of a pair of headphones or the back of a space helmet; “Behind” marks an accessory with one, and each drawing comes in two versions, one for cells over the head and one for cells off it. A flat part is one tone with no shading and no edge. Every other part is shaded in five tones like a head of its color, with an edge band of its own. “Refit” marks an accessory whose parts follow the shape’s width, ear line or side as well as its scale, such as a brim sized to the head or ear pieces on the ear line. The drawings are the round head’s. On another shape, OpenGame resizes those parts to fit, so the round head’s drawing placed by the anchor and scale is close but not exact; compare it with that shape’s portrait.

Facial hair and hair color

Facial hair covers the lower face, under the eyes. It takes the facial hair color, then the hair color, then the color the hairstyle was made in. The hair color applies to the hair of a hairstyle outline. Each style is drawn in face units: across, 1 is the jaw’s edge on the mouth line; down, 0 is the eye line and 1 the chin, so one beard fits a round face, a long one and a cat. The mouth line is 0.64 of the way from the eyes to the chin. Where a style covers the mouth line, the mouth shows through as a gap in the hair: a grin 0.60 of the jaw’s half width across and 0.13 of the eye-to-chin height deep, flat along its top and round below. A moustache on its own sits just above the mouth line with a thin smile in the hair’s color under it. Draw no other mouth. On a shape, a point (u, t) is at x = Face x + u × Jaw and y = Eye line + t × (Chin − Eye line) in portrait units, from the “Anchors” table, with Chin − Eye line taken as at least 0.20. FACIAL_HAIR holds each style drawn on the round head in these units. “Fills the jaw” marks a style that adds to the head’s outline below the jaw, joined smoothly to it, so the beard shows past the chin; the drawing marks that added outline separately from the hair. “Mix” marks a soft style, whose tones are only that share of the way from the head’s tones to the facial hair color, so the skin shows through. “Facial hair” is the base tone of facial hair in that color. Hair in a chosen color is shaded like a head of that hex, with the five tones under “Shading”. Facial hair in a chosen color starts from the hex mixed 24% toward white, the base in the table, and its five tones are that base mixed 22% and 8% toward #08080C, the base itself, and the base mixed 14% and 30% toward white.

Anchors

Each shape places accessories and facial hair by these points, in portrait units. “Hat x” is the middle line an accessory is centered on, “Top” the top of the skull on that line, and “Seat” where an accessory’s lower edge goes, a little into the head. “Width” is half the head’s width near the top, “Ear line” the height side pieces hang at, and “Side” half the head’s width on the ear line. “Scale” is the head unit accessories are drawn in. “Face x”, “Eye line”, “Chin” and “Jaw” place facial hair: the face’s middle line, the eye line, the chin on the middle line, and half the jaw’s width on the mouth line.

Draw order

A 2D portrait is drawn cell by cell, and each cell takes the first of these that applies:
  1. The eyes, where the cell is inside the head. An eye is always on top.
  2. A part of the head accessory, the first in its list that covers the cell, leaving out parts that go behind the head where the head is.
  3. Empty, where the cell is outside the head.
  4. The edge band, in the head’s edge color.
  5. Facial hair.
  6. Markings, including a hairstyle’s hair.
  7. The head’s own five tones.
A cell is painted when its middle is at least 0.42 of a cell inside a shape, and it is an edge cell when it is less than 1.30 of a cell inside, so the edge band is about one cell wide at any size. So the edge band runs round the whole outline, over hair, markings and facial hair that reach it, and an accessory covers the edge band but not an eye. OpenGame’s 3D heads have no edge band: the lit surface shows the outline.

Color

Head palette

“Eyes” is the eye color on that head and “Light” the smaller form inside each eye. “Edge” is the color of the head’s edge band and “Contrast marking” the base tone of a contrast marking on that head, both described under “Edges and markings”. A finish is a color that changes across the head, such as plaid, gold, neon or glass, and the hex is the closest flat color. mono, shown to players as “Auto”, is black on a light background and white on a dark one. On a dark background mono is a head of #EEEDE9 with eyes #1B1B1B, eye light #EEEDE9, edge #B9B7B2 and contrast marking #424244, shaded #A7A5A0, #CFCDC8, #EEEDE9, #F9F8F5, #FFFFFF from deep to glint. Every other color, its edge included, is the same on both backgrounds. ink is read as black; paper is read as white.

Shading

OpenGame shades a head in five tones made from the hex value, lit from the top left. Each mixes the swatch toward a near-black or white:

Edges and markings

In a 2D portrait the head has a band about one cell wide just inside its outline, drawn in the edge color from the head palette. The edge color does not change with the background apart from mono, so a dark head on a dark background keeps a dark edge: OpenGame draws no light outline around it. The edge is darker than the head’s base tone on every color except neonpink, neongreen and neonblue. For a plain color it is the swatch mixed 42% toward #08080C, except mono, black and white, whose edges are in the table. An accessory part’s edge follows the same rule for its own color, a hex value or a head palette entry. Markings are a head’s second color: a hairstyle’s hair, a panda’s patches. Each of a marking’s five tones is the head’s tone at the same step, in that background’s inks, mixed 80% toward the marking’s color, so a patch is lit and dithered like the head under it. The marking tone in the shapes table picks that color: On a hairstyle with a hair color chosen, the hair takes that hair color instead, as described under “Facial hair and hair color”. Facial hair takes the first of these that is set: the facial hair color, the hair color on a hairstyle, then the marking rule above. When a look has facial hair, a shape whose markings name no tone uses dark instead of contrast, for both its markings and its facial hair, and a shape with no markings uses dark for the facial hair. A soft style is then mixed from the head’s tones as its “Mix” says. An eye over a marking or facial hair keeps the head palette’s eye colors while the eye color has a contrast ratio of at least 2.5 against the marking’s base tone. Below that, the eye takes the head’s base tone and its light takes the marking’s light tone. Markings and facial hair have no edge of their own. Where they reach the outline, the head’s edge band runs over them.

Clothing colors

The outfit recipe gives a color to the shirt, the bottoms and the shoes, and one color shared by the accessories.

Colors that follow the head

readAvatar marks these with followsHead: true and gives the head’s hex. match is the head’s color unchanged. avatar is the head’s color darkened by garment: each channel c becomes c × f + 35 × (1 − f), with f from this table.

The body and clothes

The outfit recipe starts with a version, then the body, legs, shirt, bottoms, accessories, shoes and the four colors. The default head is circle.classic.white. The plain body is c3.classic.regular.none.shorts.none.classic.avatar.avatar.avatar.avatar, and a new player starts in c3.classic.regular.hoodie.jeans.backpack.jumpcourt.avatar.avatar.chalk.avatar.

Shirts

none leaves the torso uncovered, in the head’s color.

Bottoms

Body accessories

Each accessory has a slot on the body. A player wears at most four, one in each slot. These pairs use different slots and are not worn together: cape and pauldrons, harness and backpack, harness and rocketpack, floatie and cape, floatie and satchel, floatie and crossbody. These ignore the accessory color and keep the materials they are made of: oakwatch (Octagonal watch), nautiluswatch (Porthole watch), overseaswatch (Blue sport watch), datejustwatch (Fluted watch).

Shoes

Sneakers, sized in H, with the soles flat on the ground. Soles are #F8EFD0 whatever the shoe color, except oxford (#4A4B51) and loafer (#4A4B51).

Parts you do not have

OpenGame adds shapes, eyes, garments and colors over time. When your game is missing a part, draw your default for that part and keep the rest of the OG. When readAvatar returns outfit: null, draw the player’s head on your default body. A hex of null is a color newer than your SDK, so use your default color for that part.

Check your drawing

  • Compare it with the player’s portrait from portraitUrl. The head’s outline, color and eyes match. On a dark background, ask for the dark portrait and draw mono white.
  • In 2D, the edge band is the head palette’s edge color on both backgrounds. A light outline around a dark head is not part of an OG.
  • Shrink it to 32 pixels tall. You can still tell the head color and the eyes.
  • The head is broader than the torso and about 40% of the height.
  • The mittens and neck are the head’s color.
  • Try a pale head (white), a dark one (black) and a finish (gold). The eyes stay visible on all three.