Skip to content

Repository files navigation

pmodels

A faster way to find player models.

Website:
https://wootguy.github.io/pmodels/

Model repos:
https://github.com/wootdata?tab=repositories

Model viewer, thumbnail generator, JSON exporter:
https://github.com/wootguy/modelguy

API to download models

If you want to download models from this database in your own project, follow steps below. It's complicated because the data is split up into many repos.

  1. Download one of these files to get all available model names:
    https://github.com/wootguy/pmodels/blob/master/database/hl/model_names.txt (Half-Life)
    https://github.com/wootguy/pmodels/blob/master/database/sc/model_names.txt (Sven Co-op)
  2. Plug a model name into the function below to get its data repository url.

    pmodels/modeldb.js

    Lines 881 to 896 in 7aec5c8

    function get_repo_url(model_name) {
    var repoId = hash_code(model_name) % data_repo_count;
    return data_repo_domain + g_game_id + "models_data_" + repoId + "/";
    }
    function hash_code(str) {
    var hash = 0;
    for (var i = 0; i < str.length; i++) {
    var char = str.charCodeAt(i);
    hash = ((hash<<5)-hash)+char;
    hash = hash % 15485863; // prevent hash ever increasing beyond 31 bits
    }
    return hash;
    }
    data_repo_domain is https://wootdata.github.io/ for my instance of the database.
    g_game_id can either be hl for Half-Life or sc for Sven co-op.
  3. Add the file path to the url in step 2 get what you want. For example, if you're downloading the betagordon model:
    models/player/betagordon/betagordon.mdl = The model file
    models/player/betagordon/betagordon.bmp = The preview image
    models/player/betagordon/betagordon.json = Metadata for the model. This tells you if there are external models (*T.mdl, *01.mdl), animation sounds, or a readme file. I'm pretty sure I've removed or merged all models that use external models so this is an optional step.

Example code for downloading everything linked to a model:

function download_model() {

About

GoldSrc player model database

Topics

Resources

Stars

16 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages