attribution: in-game ODbL credit via AGigLineHUD

Completes "Geographic attribution display" for 0.1.0. The demo is built from
OpenStreetMap data (ODbL 1.0) and needs attribution wherever the derived work
is shown, so the credit now lives in the running game, not just the documents.

- AGigLineHUD (C++): plain AHUD::DrawText in the bottom-left draws
  "(c) OpenStreetMap contributors" and "Data (c) OpenStreetMap contributors,
  ODbL 1.0 - openstreetmap.org/copyright", with a shadow pass so it stays
  legible over bright pavement and sky. No UMG widget asset is involved, so a
  cook cannot drop the attribution through a missing widget reference.
- AGigLineGameModeBase: HUDClass = AGigLineHUD, so the credit is on by default
  in both the DemoMap and the ReviewMap.
- AGigLineShotActor: screenshots are requested with the UI shown, so the credit
  appears in every capture under Screenshots/ - the obligation is provable from
  the images rather than only described.

Docs:
- THIRD_PARTY_NOTICES records that the attribution is displayed in-game and
  where the code lives.
- Screenshots/README documents the overlay.
- TODO marks the item done and narrows the remaining ODbL question to the
  shipped-derivative-database posture.

Squash of branch gameplay-attribution-0.1.0 (PR #4).
This commit is contained in:
zwitschi committed 2026-11-07 18:47:31 +01:00
1 parent c3a92d008b
commit 80ef80b490
23 files changed
+115 -34

No files matched your search

@@ -1,8 +1,11 @@
#include "GigLineGameModeBase.h"
#include "GigLineCharacter.h"
#include "GigLineHUD.h"
AGigLineGameModeBase::AGigLineGameModeBase()
{
DefaultPawnClass = AGigLineCharacter::StaticClass();
// ODbL attribution must be visible in the running demo, not only in docs.
HUDClass = AGigLineHUD::StaticClass();
}
@@ -0,0 +1,29 @@
#include "GigLineHUD.h"
#include "Engine/Canvas.h"
#include "Engine/Engine.h"
void AGigLineHUD::DrawHUD()
{
Super::DrawHUD();
if (!Canvas || AttributionLine.IsEmpty())
{
return;
}
// Bottom-left, above any letterbox: the standard place for map/data credits.
const float LineHeight = Canvas->ClipY > 0 ? 22.0f * TextScale : 22.0f * TextScale;
const float X = MarginPx;
const float Y = Canvas->ClipY - MarginPx - LineHeight * 2.1f;
const FLinearColor Shadow(0.0f, 0.0f, 0.0f, 0.55f);
const FLinearColor Ink(1.0f, 1.0f, 1.0f, 0.92f);
// Shadow pass for legibility over bright pavement and sky.
DrawText(AttributionLine, Shadow, X + 1.0f, Y + 1.0f, nullptr, TextScale);
DrawText(LicenceLine, Shadow, X + 1.0f, Y + LineHeight + 1.0f, nullptr, TextScale * 0.82f);
DrawText(AttributionLine, Ink, X, Y, nullptr, TextScale);
DrawText(LicenceLine, Ink, X, Y + LineHeight, nullptr, TextScale * 0.82f);
}
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "GigLineHUD.generated.h"
/**
* Always-on geographic attribution for the shipped demo.
*
* The demo is built from OpenStreetMap data, which is ODbL 1.0 licensed and
* requires attribution wherever a derived database or produced work is shown.
* This HUD draws the required credit in the bottom-left corner of the screen so
* it is present in the game, not only in the repository documents.
*
* Plain AHUD::DrawText is used deliberately: no UMG widget asset is needed, so
* the attribution cannot be accidentally dropped from a cook by a missing
* widget reference.
*/
UCLASS()
class GIGLINE_API AGigLineHUD : public AHUD
{
GENERATED_BODY()
public:
virtual void DrawHUD() override;
/** Main credit line. Must match the ODbL attribution requirement. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attribution")
FString AttributionLine = TEXT("\u00A9 OpenStreetMap contributors");
/** Licence line, including where the licence can be read. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attribution")
FString LicenceLine = TEXT("Data \u00A9 OpenStreetMap contributors, ODbL 1.0 \u2014 openstreetmap.org/copyright");
/** Screen-space margin in pixels. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attribution")
float MarginPx = 18.0f;
/** Text scale relative to the default canvas font. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Attribution")
float TextScale = 1.45f;
};
@@ -34,7 +34,7 @@ void AGigLineShotActor::Tick(float DeltaSeconds)
: FString::FromInt(CurrentShot);
const FString FileName = FString::Printf(TEXT("review-%s"), *Name);
// Resolution is the game window's; the runner passes -ResX/-ResY.
FScreenshotRequest::RequestScreenshot(FileName, false, false);
FScreenshotRequest::RequestScreenshot(FileName, /*bInShowUI=*/true, false);
bWaitingForScreenshot = true;
}
return;