beyond-all-reason / beyond-all-reason/RecoilEngine

Default buildpic: unhardcode format list

Open
#1,144 2 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue refactor
Dominant language
C++
Stars
683
Forks
293
Avg merge
3d 2h
Merged PRs (30d)
40

Description

Default buildpic (if an explicit `buildPicName` entry is not present in the unit def) is hardcoded to try w whitelist of `dds`, `png`, `pcx` and `bmp` in that order:
https://github.com/beyond-all-reason/spring/blob/eed475e808c656a7f8ae8dde3a3974d50cc6d137/rts/Rendering/Units/UnitDrawerData.cpp#L483-L486

As far as I can tell this one isn't for any specific reason:
* `pcx` was there in the first commit as the only supported format. Probably what TA engine used.
* f4be9b4e73c25af02a18cfdb1841d5dac1f51085 added `bmp` in 2005.
* d8af65e3f3eb78aaaeb8c672e791bbb529e3fc2b added `dds` and `png` in 2007.

Perhaps the whitelist still has other reasons to exist. For example our list of supported 3D model formats is a whitelist and not the full list that Assimp supports. If this is the case, document the rationale and consider adding some well known formats like `tga` or `jpg`.

Otherwise, it would be ideal if it just tried whatever is present, i.e. iterate over all `unitpics/unitname.*` and pick the first one that loads.

Contributor guide

Open the contributing guide

Research direction

Start at rts/Rendering/Units/UnitDrawerData.cpp around lines 483-486, where the default buildpic format whitelist is defined. Check the existing image-loading behavior and whether the whitelist has a documented rationale; compare it with the mentioned unitpics/unitname.* files and supported formats. Done means either documenting the restriction and extending it, or selecting an appropriate fallback behavior for available formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.