Skip to content

Conversation

@Sebastian-Griesbach
Copy link

@Sebastian-Griesbach Sebastian-Griesbach commented Feb 5, 2026

It seems that the current code actually does not contain any intended detection for the Timeout.

logo_timer is non zero when the Activision Logo scrolls in the bottom left.

This is happening

  1. At the beginning of the game before the player moved
  2. When the player lost all lives
  3. When the timer ran out
    Apparently the logo_timer was put here because the lives_bytes alone can temporarily take on a zero value during the death transition.

The current Termination condition m_terminal thus only checks if all lives have been lost. There is no detection for the timer reaching zero. I added two variables tracking minutes and seconds and added it to the termination condition.

I don't see how to reasonably add tests for this as the timer only exists

  1. in ram what I am using now
  2. Visually which is hard to use in a test.

I wrote a little script that records the last view frames of a episode to visually confirm that the timer runs out right before timeout termination which I can provide if needed.

Edit: I did not know that I can not add issue references in the title: #654, #268

@pseudo-rnd-thoughts pseudo-rnd-thoughts changed the title Adding timeout termination to PitFall (#654, #268) Adding timeout termination to PitFall Feb 5, 2026
int timer_seconds = readRam(&system, 0xD9);
// Game terminates when: (1) all lives lost and logo screen shown, OR (2) timer runs out (00:00)
bool timer_expired = (timer_minutes == 0 && timer_seconds == 0);
m_terminal = (lives_byte == 0 && logo_timer != 0) || timer_expired;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, whats the difference between the logo_timer and the actual timer that you've extracted?

Also, could this timer_exprired feature be enabled or disabled

Copy link
Author

@Sebastian-Griesbach Sebastian-Griesbach Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logo_timer controls the timing of the scrolling of the logo. When it's active it scrolls between "Activision" and "Copyright 1982", this is not directly related to the in game timer. It just happens to co-inside with gameover which I assume is why this was originally used.

How should I add the mentioned option? As I understand I can not directly add an argument to the environment initialization. I can use a game "mode" that takes an int, is that the intended way?

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