Skip to content

Load data from files #440

@scionaltera

Description

@scionaltera

There are several types of data that are loaded into the game with classes such as CommandLoader. These classes were a simple way to set up a default state but they're not very flexible. If you wanted to customize your MUD in a persistent way (eg. removing the diagonal movement commands) you'd have to make a code change and from that point on you would always be fighting against git trying to overwrite your changes when you merge from upstream.

A better way to do this would be to make the loader classes load from a file, where the file is not managed by git.

There are currently four loader classes:

  • CommandLoader
  • WorldLoader
  • ProfessionLoader
  • SpeciesLoader

For this issue we'll ignore WorldLoader because that's covered by #406 already.

For each of the three remaining three loaders make the following changes:

  1. Define an appropriate file format. It should be human readable/editable. JSON might work but I don't like that it doesn't have comments. A custom format would be OK, or something like YAML or XML maybe?
  2. Create a default file in src/main/resources/ to load some minimal defaults from if no other source is available.
  3. If data exists in the database already, don't load anything from files (same as current behavior).
  4. If a custom file exists under ./data/{filename}, load that.
  5. If no custom file exists, load the default file from ./agonyforge-mud-demo/src/main/resources.
  6. Add the custom files to .gitignore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions