timotheeg / nestrischamps

A web-based OCR and restreamer system for NES Classic Tetris players
MIT License
45 stars 11 forks source link

No support for tetris gym levels post 29 #95

Closed Huff01 closed 2 years ago

Huff01 commented 3 years ago

the tetris gym level counter is correct until a certain point, so when the ocr corrects it, it actually just gets the level wrong

timotheeg commented 3 years ago

2 possibilities I can see:

  1. introduce a switch where level correction can be turned on and off based on the rom you are playing on
  2. Suggestion from @alex-ong: we should change level detection to detect first transition and then stop scanning levels; and assume 10 lines per level. Sample python code below for illustration:
    
    raw_level = None if  transitioned else scan_level()
    raw_lines = scan_lines()
    raw_score = scan_score()

//code to convert from raw to adjusted with the 2 frame wait buffer blah //code goes here, blah

if (!transitioned and lines_changed and level_changed) { transition_lines = lines; transitioned = true; }

// set level based purely on lines if we've transitioned if (transitioned) { level = (lines - transition_lines) / 10 + start_level } else //set level based on OCRed value { level = scanned_level }

timotheeg commented 2 years ago

Added query string option to producer to disable level correction ?fixlevel=0

Closing this issue for now, will revisit not reading levels some other time.