Socially Distant OS
  • Docs
  • API
Search Results for

    Show / Hide Table of Contents
    • Accessibility
      • In-Game TTS
    • Development and Modding: Getting started
      • Building from source
      • Contribution guidelines
      • Project structure
      • Code style guide
    • Game scripting (sdsh)
      • The Basics
    • Game Framework
      • Event Bus
      • Playing Audio
    • Story Scripting
      • Career Mode Narrative Objects
      • Narrative Identifiers
      • News Articles
    • User Interface
      • UI Overview
      • Signals
      • List Adapters
      • Optimizing UI for Performance
      • Advanced UI features
        • Visual Styles

    News Articles

    News Articles are a storytelling feature of Socially Distant. Any in-game website, such as a blog, or an actual news source in the game world, can display News Articles.

    Writing a News Article

    News Articles are simply Markdown files with YAML frontmatter that the game looks at when building story assets. The Markdown body is converted to in-game markup that gets displayed in the Web Browser, and the frontmatter is used as asset metadata. If you've worked with static site generators in the past, you already know what you're doing.

    YAML frontmatter for News Articles

    When writing a News Article, include the following frontmatter at the top of the .md file.

    title: Major Outage Strikes Fairview District, Leaving Financial Institutions In Ruin
    author: 'npc:ritchie_frodomar'
    topic: Cybersec
    host: newciphertoday.com
    flags:
      - old
    

    *YAML frontmatter values

    Variable Type **Description
    title string The article's headline/title
    author narrative_id The NPC that wrote the article
    topic string? An optional category in which the article is posted.
    host string The domain name of an in-game website to which this article belongs
    flags ArticleFlags[] A list of named article flags that control how this game handles spawning the article.

    Valid article flags

    Flag Description
    old The article was written before the player's playthrough started. It should be spawned immediately when creating the world, or loading an existing one.
    scripted Do not automatically spawn the article. It is spawned by a script.
    hidden Do not show the article in the "In Case You Missed It" section of web://start.page/.

    How to link to things

    Socially Distant will not render http or https links in news articles. Instead, use the web:// scheme instead. The game's shell understands these links as links to in-game websites.

    For example, link to Flock like this: [Flock](web://flock.social/)

    Relative links

    Relative links, like [these](/path/to/page), will work. The path is relative to the hostname of the current page in Web BRowser.

    Embedding Images

    You can embed images by including them as textures in the game files. Then, note the path needed to load them in-game. Then, instead of including a URL, include the asset path to the texture to show within the normal Markdown image syntax. You should also include descriptive text, as the in-game screen reader will read it.

    To embed a Socially Distant logo into an article:

    ![Socially Distant logo](/Core/Textures/SociallyDistantFull)
    

    Images can't be embedded inline in a pragraph, due to limitations with the in-game markup renderer. They will be rendered as raw text. Images can also not be used as the link text of a link, due to other limitations with the game's Markdown renderer.

    If a texture fails to load, the image's descriptive text will be rendered as a paragraph. A warning will be logged to the console containing the offending asset path.

    Terrifying Feature: Embedded Scripts

    You can embed sdsh scripts to dynamically generate text to show in the article. These embedded scripts are evaluated when spawning the article, and can therefore be used to include content from the save file.

    To embed a script, just write a standard Markdown code block with sdsh as the language syntax. The game will replace the code block with the output of the script, before rendering the Markdown.

    Yes. That is cursed. We know. And don't care.

    Where to put News Articles

    It does not matter where in the game files you place a news article, as long as it is part of the Content directory in the game build, or it is part of a mod's content directory. The ContentManager will automatically locate them. However, by convention, articles belong in an Articles/<hostname> directory.

    If adding articles to the base game, either place the Markdown files in the Career Mode Assets repository on GitLab, or place them within the Content directory in the SociallyDistant project.

    If adding a news article inside your mod, place them in the Content directory of your mod project.

    In this article
    Back to top Generated by DocFX