Skip to content

Move NLE terminal dimension initialisation - #133

Merged
StephenOman merged 1 commit into
NetHack-5-upgradefrom
move-terminal-dimensions-initialization
Oct 25, 2026
Merged

StephenOman merged 1 commit into
NetHack-5-upgradefrom
move-terminal-dimensions-initialization

Conversation

@StephenOman

Copy link
Copy Markdown
Collaborator

NetHack 5 has refactored all global variables into alphabetical structures. For example, all global variables starting with the letter 'a' are now in a structure called ga (see decl.h:141 and decl.c:1085). Initialising these global variables is now controlled by individual functions, so that the game engine can be totally initialised. See decl.c:1080 for this initialisation function, called decl_globals_init.

For NLE purposes, this initialisation occurs after the original initialisation of the terminal dimensions in nle.c. This PR changes this as follows:

  • moves the terminal dimension specification to the TMT initialisation on startup
  • adds initialisation to gettty() for subsequent calls to the terminal. Adding it here in nle.c avoids changes in NetHack code.

Note: This NetHack 5 change opens the possibility for simplifying multiple runs of the game engine as the global variables could be reinitialised. This is out of the scope for NH5 upgrade.

@StephenOman
StephenOman requested a review from heiner October 25, 2026 16:46
@heiner

heiner commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

This NetHack 5 change opens the possibility for simplifying multiple runs of the game engine as the global variables could be reinitialised.

This is excellent! It means no dlopen/dlclose to reinitialize, which likely makes episode restarts a good deal faster.

@StephenOman
StephenOman merged commit 2a0e3ba into NetHack-5-upgrade Oct 25, 2026
11 of 19 checks passed
@StephenOman
StephenOman deleted the move-terminal-dimensions-initialization branch October 25, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants