Standardize a method to gracefully handle missing files

Open
#461 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
22/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp, godot
Domain
game-dev

Research direction

This is an epic for project-wide missing-file handling, not a single change. The body only names fonts/import files as an example of a crash in the render loop. Survey existing file reads, then agree a pattern (check results, log, placeholders, disable features, or abort to a safe state). Done is a documented convention plus first uses in those paths; no specific files or tests are named.

Written by the indexing model from the issue text.

Description

data layer help wanted

This is more of an epic, and surely will be a recurring theme throughout the project...

Given how data-driven and customizable this game is intended to be, we can expect that files will sometimes be missing, even if they're part of our own distribution. For example I ran into an issue when switching branches where some fonts or at least their import files were missing, and this brought down half of the render loop. Whenever we read a file we should assume that it may fail, and try to deal with it. Depending on the file, this may include any combination of:

  • explicitly check the result before continuing
  • use the null conditional operator ?. to access it
  • LOG IT at a high level (this should eventually be shown in-game)
  • default to a placeholder/empty reference at the lowest level possible
  • disable the feature
  • if it's absolutely critical, abort back to the nearest safe state
Dominant language
C#
Stars
662
Forks
67
Avg merge
5d 10h
Merged PRs (30d)
24

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from C7-Game/OpenCiv3

All issues in C7-Game/OpenCiv3

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.