♪ Nove pesme su objavljene: No (house) i Choline (tehno)

Nyxatar Heroes Saga - Advanced Usage Guide

Welcome, aspiring demigod or meticulous chronicler! This guide provides detailed information for users looking to customize their Nyxatar Heroes Saga experience beyond the basic setup. Here you'll find details on running multiple instances, operating the game as a persistent background process, diving deep into script customization, and understanding some of the development and testing insights.

Basic Command-Line Customizations

Beyond the fundamental run commands found on the main project page, you can control the terminal's scrolling log display at launch using these arguments:

These options can be combined with each other and with the --enable-game-saving flag.

Example Usage:

To run the game with saving enabled to the default file, displaying 30 log lines with a maximum width of 100 characters:

python3 nyxatar_heroes_saga.py --enable-game-saving --log-lines 30 --log-width 100

To run in RAM-only mode with 40 log lines and unlimited width (no truncation):

python3 nyxatar_heroes_saga.py --log-lines 40 --log-width 0

Managing Multiple Saved Sagas

While you can run many instances of Nyxatar Heroes Saga in RAM-only mode without issue, managing multiple sagas that save their progress requires careful attention to avoid data corruption.

The Importance of Unique Save Files

If you use the --enable-game-saving command-line flag without specifying a custom path, the game defaults to saving in nyxatar_heroes_saga_save.json (this filename is set by the DEFAULT_SAVE_FILENAME constant in the script) within the same directory as the script.

Crucially, running multiple instances simultaneously that all attempt to save to the same file path will lead to data from one instance overwriting another. This can corrupt your saga or cause you to lose progress.

Using Custom Save File Paths

To run multiple sagas concurrently with saving enabled for each, you must provide a unique custom save file path for each instance. This is done by providing a full or relative path to the --enable-game-saving flag.

Syntax:

python3 nyxatar_heroes_saga.py --enable-game-saving /path/to/your/custom_save_name.json

Example for Linux/macOS using absolute paths:

python3 nyxatar_heroes_saga.py --enable-game-saving /home/user/my_sagas/saga_alpha.json
python3 nyxatar_heroes_saga.py --enable-game-saving /home/user/my_sagas/saga_beta.json

Example for Windows using absolute paths:

python3 nyxatar_heroes_saga.py --enable-game-saving C:\Users\YourUser\Documents\MySagas\nhs_instance1_save.json
python3 nyxatar_heroes_saga.py --enable-game-saving C:\Users\YourUser\Documents\MySagas\nhs_instance2_save.json

By specifying a unique JSON file for each instance, you ensure their progress is saved independently and safely.

Understanding and Managing Save Files

When game saving is enabled, Nyxatar Heroes Saga employs several mechanisms to protect your progress and provide information. Save files are stored in JSON format, making them human-readable if you wish to inspect them (though manual editing is highly discouraged and can easily corrupt your saga).

Periodic Saves

To prevent data loss from unexpected interruptions, the game automatically performs a periodic save.

Backup Files (`.bak`)

Each time the game successfully saves (either periodically or upon graceful exit), it first creates a backup of your existing save file.

Crash Files (`.CRASH`)

In the unfortunate event of a critical error or unhandled exception within the game, it will attempt to save its current state to a special .CRASH file.

Save File Version (`GAME_STATE_VERSION`)

The script includes a GAME_STATE_VERSION constant (e.g., "0.1.0"). This version string is embedded in your save file.

Running Unattended in the Background (Linux/macOS/etc.)

If you want Nyxatar Heroes Saga to continue running and progressing uninterrupted (e.g., on a server or a machine where you might close the terminal), tools for background operation are recommended. On Linux, macOS, or other **NIX-like systems, utilities such as nohup (often used with &) or terminal multiplexers (e.g., tmux, screen) are ideal.

Example using `nohup`

nohup (no hang up) allows a command to keep running even after the user logs out.

nohup python3 nyxatar_heroes_saga.py --enable-game-saving ~/my_nyxatar_saga_instance_1.json > ~/my_nyxatar_saga_instance_1.log &

This command:

Remember to use a unique save file path for each concurrently running saved instance. Please consult the documentation for nohup, tmux, or screen for their specific usage details and how to manage backgrounded processes.

Using `systemd` for Long-Term Grinding on Linux

For a robust, persistent grinding experience on modern Linux systems (like Ubuntu, Fedora, Debian), systemd can manage the saga as a background service. This properly handles starting automatically on login (for user services), automatic restarts on failure, and integrates with system logging via journalctl, making it more robust than manually using nohup.

The easiest way for personal use is often a User Service (doesn't require root privileges):

mkdir -p ~/.config/systemd/user/
[Unit]
Description=Nyxatar Heroes Saga - Persistent Grind Instance Alpha
After=network.target

[Service]
Type=simple
# ADJUST THESE PATHS! Use full absolute paths.
# Systemd user services automatically expand ${HOME} to your home directory.
# Example: ExecStart=/usr/bin/python3 ${HOME}/games/nyxatar/nyxatar_heroes_saga.py --enable-game-saving ${HOME}/games/nyxatar_saves/alpha_save.json
ExecStart=/usr/bin/python3 /full/path/to/nyxatar_heroes_saga.py --enable-game-saving /full/path/to/your_unique_alpha_save.json

# Automatically restart if it exits unexpectedly (e.g., script crashes)
Restart=on-failure
# Wait 5 seconds before attempting a restart
RestartSec=5s
# Optional: Set a working directory if your script relies on relative paths for assets (though NHS usually doesn't)
# WorkingDirectory=/full/path/to/script_directory

[Install]
# Start this service when your user's session starts
WantedBy=default.target

Key point: You MUST replace the example paths in ExecStart= with the correct, full absolute paths to your Python 3 executable, the nyxatar_heroes_saga.py script, and your desired unique save file location for this specific instance. Using --enable-game-saving is crucial for persistence!

systemctl --user daemon-reload
systemctl --user enable --now nyxatar_heroes_saga_instance_alpha.service
systemctl --user status nyxatar_heroes_saga_instance_alpha.service

Look for "active (running)". If it failed, journalctl (see next step) will have error details.

journalctl --user -u nyxatar_heroes_saga_instance_alpha.service -f

To view just the last 30 lines (without paging):

journalctl --no-pager --user -u nyxatar_heroes_saga_instance_alpha.service -n 30

That's it! Your Nyxatar Heroes Saga instance will now be managed by systemd, running reliably in the background whenever your user session is active. To run multiple independent sagas, create multiple .service files (e.g., nhs_beta.service) ensuring each has a unique Description and ExecStart line pointing to a unique save file.

Important Note on Uniqueness with systemd: While systemd ensures this specific service unit (e.g., nhs_alpha.service) doesn't run multiple instances of itself, it doesn't automatically prevent other processes (like manual runs from the terminal, or a differently named service file) from potentially accessing the same save file path defined in ExecStart=. To avoid save file corruption, it remains crucial to ensure that any persistent instance of the saga, however launched, uses its own completely unique save file path provided via the --enable-game-saving flag.

In-Depth Script Customization

For those who wish to delve into the very fabric of Nyxatar's reality, the Python script (nyxatar_heroes_saga.py) offers a gateway. Numerous global constants, defined near the beginning of the file, control core aspects of the game. Modifying these allows you to fine-tune game balance, probabilities, content generation, and overall feel. (For more on game balance and features, see About the Saga).

A Word of Caution: Editing these constants can significantly alter the intended game experience, difficulty, and stability. It's highly recommended to:

Below are key categories and notable constants you might consider tweaking. Refer to the script's comments for more details on specific variables.

Game Loop & Core Engine

These constants affect the fundamental rhythm and speed of the game.

Saving and Loading

Controls how and when the game state is persisted.

XP, Leveling, and Tiers

These constants shape the hero's journey from a fledgling adventurer to a seasoned veteran.

Economy & Inheritance

Governs wealth accumulation and what is passed to the next generation.

Combat & Stats

Defines hero survivability and combat prowess.

Death & Survival

The chances of a hero meeting their True Death.

Item & Monster Generation

Controls the variety and power of foes and treasures.

Hero Actions & Events

The probabilities and parameters governing what heroes do and what happens to them.

Generational & World

Settings that affect the long-term arc of the saga and its flavor.

Modifying Procedural Content (Lexicons)

Beyond numerical constants, a significant portion of the game's unique flavor comes from large Python lists that serve as lexicons for procedural generation. These are found directly in the script:

When editing these lists, simply add or remove string entries following the existing Python list syntax.

Customizing Log Display via Script (Default Values)

While command-line arguments (--log-lines and --log-width, see Basic Command-Line Customizations) are recommended for temporary changes to the log display, you can also change the default values directly in the script by editing these constants:

A small note on script formatting: The Python script is formatted using Ruff for code consistency. This means some lines, especially comments alongside configuration variables at the top of the file, might be wrapped or adjusted by the formatter to maintain a standard line length.

Smoke Tests Methodology & Results

The "Smoke Test Mode" is a crucial diagnostic tool for this project, allowing for the simulation of vast amounts of game time at hyper-speed. It's primarily used by the author for development and pre-release stability checking but can be enabled by advanced users if they wish to perform their own stress tests (by setting SMOKE_TEST_MODE = True in the script).

Why use Smoke Tests? (Methodology)

This mode serves to:

During a smoke test:

The author strives to conduct extensive smoke tests, often several hours long, before each release. While unit tests might cover individual components, these smoke tests provide confidence in the overall system's endurance and the integrity of a long-running saga.

Latest Smoke Test Results (version `1.0.0`)

---

Other Nyxatar Heroes Saga pages: