Assembling a Video Game Screenshots Corpus

  • Outline
  • Considerations
    • [[#Considerations#Ergodicity|Ergodicity]]
    • [[#Considerations#Screencasts|Screencasts]]
    • [[#Considerations#Image Quality|Image Quality]]
  • Corpus generation
  • Notes
    • [[#Notes#Extracting Colours|Extracting Colours]]
    • [[#Notes#Scrapping Images|Scrapping Images]]
    • [[#Notes#Generating image material from longplays|Generating image material from longplays]]
    • [[#Notes#Matching sparql query and image files in CSV|Matching sparql query and image files in CSV]]
  • See also

Outline

The image corpus is built following a strategy to include as much stills from a game as is necessary to adequately represent a games’ visuality (aesthetics and content). Next to formal and semiotic elements, the FAVR is considered. Since building a corpus of images retrieved from digital games can be a considerable effort regarding having to play entire games1, additional collecting strategies are considered.

The FAVR is clear in outline and scope and is mostly considered with the macro and material perspective, as well as the functionality of video game images. Formal and semiotic elements can vary in their scope and focus towards the micro level of a game. Decisions will have to be made with each game, slightly adjusting what is collected. If needed, I’ll expand the outlined parameters below. The approach follows loosely along compositional analysis, whereas the FAVR takes over the spatial components and semiotic elements over content.

The image corpus is analysed for the Observing the Coming of Age of Video Game Graphics paper.

Considerations

Ergodicity

The production of screenshots from a video game is a regress from ergodic media to static images. The gameness or dimension of gameplay is lost in this process and only traces of it are present in the final product. The loss of this aspect in the screenshots need to be considered when analysing the visual material.

Screencasts

Screencasts would solve the problem of the loss of ergodicity only partially, while introducing other problems. I exclude videos from my analysis as of now, since they introduce new technical considerations and research problematics, such as the analysis of progression in time, the storage of the collected media or how to properly code (label) videos. This aspect will stay problematic for now, as some objects only reveal themselves in animations, for example special effects that indicate a change of game state. That said screencasts, such as longplays, are quintessential for the generation of image materials in the form of stills.

Image Quality

Another consideration is the balance between quantity and quality, as in, complete visual representation of a game versus the quality of the collected images. Producing all the screenshots oneself will reduce the amount of treated games because of the needed effort. On the other hand, screenshots of play-throughs or scrapping produce lower quality images regarding their resolution, having compression artefacts or faulty color spaces. If scrapping can be automated, I will include the material either way and mark it as such.

Corpus generation

I consider a game to be feature complete when the following parameters are present:

  • FAVR: Visual modes, ocularizations, framing mechanisms, construction of tangible space
  • Formal Elements: Colours, textures, shapes, resolution, composition and layout, typography, etc.
  • Semiotic Elements: Characters, objects, levels, interactive elements, etc.2

Protocol

  1. Outline which games go into the image corpus, see Observing the Coming of Age of Video Game Graphics
  2. Collect metadata and create/update metadata corpus on Wikidata, including platforms and production details, such as game engines and programmed in
  3. Build corpus
    • Scrape screenshots of online platforms where possible
    • Scrape long- and letsplays where possible
    • Generate stills (screenshots) from video-material
    • Reduce screenshots by similarity3
  4. Expanding Option: Generate additional imagedata to expand on existing metadata
    • colors, colorpalette and resolution
    • visual complexity of an image (e.g. from order to noise, along the entropic gradient)
    • visual diversity within game (i.e. from mode to mode, level to level)

Notes

Extracting Colours

How to extract the dominant colours per image.

sample=PATH_TO_IMAGE
area=$(magick $sample -format "%[fx:w*h]" info:)
magick $sample -kmeans 8 -format "%c" histogram:info:  | sed 's/://g' | awk -v area=$area '{print 100*$1/area, "%|", $3, ","}' | sed 's/ *//g' | sort -nr -k1,1 -t ","

Via https://stackoverflow.com/questions/70397629/imagemagick-extract-dominant-colors-from-an-image-in-hex-and-percentages

Scrapping Images

I wrote a small shell script that executes httrack with the needed parameters. So far it works with MobyGames.

#!/bin/bash
 
# $1 is the url to be scraped
# $2 is the folder to be created
  
httrack -q -%i -w "$1" -O "$2" -n -%P -N0 -s2 -p7 -D -a -K0 -c10 -%k -A25000 -F "Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98)"  
'-*.webp' '-*.css' '-*.js' '-*.xml' '+*.png' '+*.gif' '+*.jpg' '+*.jpeg' -%s -%u

Generating image material from longplays

  • Download video
  • Use ffmpeg to generate screenshots from video; see How to Extract Images from a Video Using FFmpeg
  • Basically it’s as simple as running ffmpeg -i necronom_longplay.mp4 -vf fps=1/ 30 every_30_seconds/necronom-amiga-%04d.png. The fps parameter indicates 1 still every 30 seconds in this example. The %04d is a filenaming pattern and will produce four digits starting at 0000 and incrementing with every still.

…or as a bash script for bulk extraction of stills from videos.

#!/bin/bash
 
INPUT_DIR="videos/"
OUTPUT_DIR="every_30_seconds"
 
# create output dir
rm -rf $OUTPUT_DIR
mkdir -p $OUTPUT_DIR
 
# loop through all files in input dir
find $INPUT_DIR | while read FILE; do
 
        # prepare filename (might be an easier solution)
        FILENAME=${FILE/$INPUT_DIR/}
        FILENAME=${FILENAME%.*}
 
        # hand everything to ffmpeg
        ffmpeg -i "$FILE" -vf fps=1/30 "$OUTPUT_DIR/$FILENAME-%04d.png" -nostdin
 
done

Matching sparql query and image files in CSV

To generate a proper metadata sheet, I need to merge material from Wikidata and a list of the image stills. These have different name conventions, because of their different sourcing. I’m going to use a python script, that uses fuzzy comparison.

See also

Footnotes

  1. One needs to know the entire game to know if all relevant material has been collected. ↩

  2. Classifications of semiotic signs in video games is a difficult topic since at least the 90ies (Espen, 1997). I’ll follow a reflexive approach that documents choices and thoughts made towards the corpus. ↩

  3. For example with GitHub - shashankag14/similar-images-remover: A Python tool to identify and remove similar-looking images from a dataset. Utilizes image preprocessing and hashing techniques for efficient comparison. ↩