The Faces module
The faces module is used for creating face images for comms screens.
Faces are based off of a set of image textures with a grid of cell images.
The set of images is defined in allFaceFiles.txt. This file defines a key name for the texture and an image in the data\graphics folder. Cells are 512x512 and the total images must be a valid DirectX12 pixel size.
This set of images can be extended with new textures added to allFacesFiles.txt
Face generation functions
The faces module has a set of functions to generate random faces for the base set of face image textures provided by Artemis Cosmos.
=== "python"
self.face_desc = random_skaraan()
There are also function to make it easier to create specific faces by passing indexes to define indexes that represent cells containing know art images for things like hair, eyes, mouth etc.
It may take some experimentation to find the values for your character, but this is a simplified way to create repeatable characters.
Other ways to create consistent faces is to use one of the predefined class:
~sbs_utils.faces.Characters
or hand code a face string.
self.face_desc = skaraan(0, 1,2,1,3)
Character Faces
The class class:
~sbs_utils.faces.Characters
has a list of predefined face strings.
These are a good examples for creating a face string by hand.
The faces string syntax
Face string is a set of layers that reference a cell in a texture separated by a semi-colon. The first layer is the lowest layer.
the texture tag specified in allFaceFiles.txt a Tint to add to the layer. e.g. changing skin tone the cell's col the cell's row
optional to offset the layer in x optional to offset the layer in y
API: faces module
Characters
A set of predefined faces
arvonian(face_i, eye_i, mouth_i, crown_i, collar_i)
Create an arvonian face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
face_i
|
int
|
The index of the face 0 |
required |
eye_id
|
int
|
The index of the eyes 0-4 |
required |
mouth_id
|
int
|
The index of the mouth 0-4 |
required |
crown_id
|
int or None
|
The index of the crown 0-4 or None |
required |
collar_id
|
int or None
|
The index of the collar 0-4 or None |
required |
Returns:
Type | Description |
---|---|
str
|
A Face string |
clear_face(ship_id)
Removes a face string for a specified ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ship_id
|
agent
|
The id of the ship/object |
required |
get_face(ship_id)
returns a face string for a specified ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ship_id
|
agent
|
The id of the ship/object |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
A Face string |
kralien(face_i, eye_i, mouth_i, scalp_i, extra_i)
Create an kralien face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
face_i
|
int
|
The index of the face 0 |
required |
eye_id
|
int
|
The index of the eyes 0-4 |
required |
mouth_id
|
int
|
The index of the mouth 0-4 |
required |
scalp_id
|
int or None
|
The index of the scalp 0-4 or None |
required |
extra_id
|
int or None
|
The index of the extra 0-4 or None |
required |
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_arvonian()
Create a random arvonian face
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_face(race)
Returns a random face for the specified race
Parameters:
Name | Type | Description | Default |
---|---|---|---|
race
|
str
|
The Race Terran, Torgoth etc. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
The Face String |
random_kralien()
Create a random kralien face
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_skaraan()
Create a random skaraan face
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_terran(face=None, civilian=None)
Create a random terran face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
face
|
int or None
|
The index of the hair 0=male,1=female,2=fluid male, 3=fluid female or None= random |
None
|
civilian
|
boolean or None
|
The force this to be a civilian=True, For non-civilian=False or None= random |
None
|
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_terran_female(civilian=None)
Create a random terran female face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
civilian
|
boolean or None
|
The force this to be a civilian=True, For non-civilian=False or None= random |
None
|
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_terran_fluid(civilian=None)
Create a random fluid terran face i.e. may have male or female features
Parameters:
Name | Type | Description | Default |
---|---|---|---|
civilian
|
boolean or None
|
The force this to be a civilian=True, For non-civilian=False or None= random |
None
|
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_terran_male(civilian=None)
Create a random terran male face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
civilian
|
boolean or None
|
The force this to be a civilian=True, For non-civilian=False or None= random |
None
|
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_torgoth()
Create a random torgoth face
Returns:
Type | Description |
---|---|
str
|
A Face string |
random_ximni()
Create a random ximni face
Returns:
Type | Description |
---|---|
str
|
A Face string |
set_face(ship_id, face)
sets a face string for a specified ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ship_id
|
agent
|
The id of the ship/object |
required |
face
|
str
|
A Face string |
required |
skaraan(face_i, eye_i, mouth_i, horn_i, hat_i)
Create a skaraan face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
face_i
|
int
|
The index of the face 0 |
required |
eye_id
|
int
|
The index of the eyes 0-4 |
required |
mouth_id
|
int
|
The index of the mouth 0-4 |
required |
horn_id
|
int or None
|
The index of the horn 0-4 or None |
required |
hat_id
|
int or None
|
The index of the hat 0-4 or None |
required |
Returns:
Type | Description |
---|---|
str
|
A Face string |
terran(face_i, eye_i, mouth_i, hair_i, longhair_i, facial_i, extra_i, uniform_i, skintone, hairtone)
Create an terran face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
face_i
|
int or None
|
The index of the face 0=male, 1=female, 2=fluid_male, 3=fluid_female |
required |
eye_i
|
int or None
|
The index of the eyes 0-9 |
required |
mouth_i
|
int
|
The index of the mouth 0-9 |
required |
hair_i
|
int or None
|
The index of the hair 0-9 or None |
required |
longhair_i
|
int or None
|
The index of the hair 0-7 or None |
required |
facial_i
|
int or None
|
The index of the hair 0-11 or None |
required |
extra_i
|
int or None
|
The index of the extra 0-5 or None |
required |
uniform_i
|
int or None
|
The index of the uniform 0 or None. None = civilian |
required |
skintone_i
|
int, str or None
|
The index of the skintone 0-??, string = color string or None. |
required |
hairtone_i
|
int, str or None
|
The index of the skintone 0-??, string = color string or None. |
required |
Returns:
Type | Description |
---|---|
str
|
A Face string |
torgoth(face_i, eye_i, mouth_i, hair_i, extra_i, hat_i)
Create a torgoth face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
face_i
|
int
|
The index of the face 0 |
required |
eye_id
|
int
|
The index of the eyes 0-4 |
required |
mouth_id
|
int
|
The index of the mouth 0-4 |
required |
hair_id
|
int or None
|
The index of the hair 0-4 or None |
required |
extra_id
|
int or None
|
The index of the extra 0-4 or None |
required |
hat_id
|
int or None
|
The index of the hat 0 or None |
required |
Returns:
Type | Description |
---|---|
str
|
A Face string |
ximni(face_i, eye_i, mouth_i, horns_i, mask_i, collar_i)
Create an ximni face
Parameters:
Name | Type | Description | Default |
---|---|---|---|
face_i
|
int
|
The index of the face 0 |
required |
eye_id
|
int
|
The index of the eyes 0-4 |
required |
mouth_id
|
int
|
The index of the mouth 0-4 |
required |
horns_id
|
int or None
|
The index of the horns 0-4 or None |
required |
mask_id
|
int or None
|
The index of the mask 0-4 or None |
required |
collar_id
|
int or None
|
The index of the collar 0 or None |
required |
Returns:
Type | Description |
---|---|
str
|
A Face string |