The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Game::FaceGenerator::Core - support for the Face Generator application

DESCRIPTION

Face Generator is a web application which uses random images to create faces. This module provides the subroutines that Game::FaceGenerator needs.

ARTISTS

The contrib directory contains background images like empty.png (default human), elf.png (narrower), dwarf.png (rounder), demon.png (looking half left, with horns), dragon.png (looking left), and the artist directories.

Each artist directory must contain a README.md file. The first Markdown link of the form [name](URL) is used to name the artist and link to their presence on the web. The first Markdown emphasized text of the form *title* is used as the title for the collection. This can be useful if an artist has two different collections. Take Alex Schroeder, who started out as “alex”. Then a second collection is added, and called “alex2”. It’s still the same person, so the two README.md files both contain the link [Alex Schroeder](https://alexschroeder.ch/), and the first one contains the title *Blau* and the second one contains the title *Tablet*.

METHODS

all_artists

Return a hash referefence of all the artists and their types. This scans the entire contrib directory, so the result is cached.

all_components

Returns all the elements for an $artist, optionally with prefix c<$element>, followed by the $empty image (defaulting to empty.png), and possibly filtered by last modification time in $days. Each element is an array of $empty and the actual file name.

all_elements

The elements are drawn in a default order over one another: face eyes brows mouth chin ears nose extra horns bangs hair hat.

Thus, a mustache (as part of the chin) covers a mouth; hair covers the face; hat cover hair, and so on.

random_components

The random components of $type for $artist. If $debug is true, empty.png is added to the list of components.

render_components

Renders the components for $artist. The @components are probably the result of a call to random_components.

move

This is the subroutine called to edit the images.