Skip to content

Preparations for RPG_RT - Player regression testing #2297

@Ghabry

Description

@Ghabry

With PRs such as #2208 where normal code reviews fail we finally need an automatic regression tester.

@fmatthew5876 I could need your help here. I ask you to provide two things. It would help me when you can contribute them (best would be as a seperate PR, so I can use it in both master and your character PR)

My idea is the following:

  1. Add a "unit test" mode to Player which saves the game each frame
  2. Replay the input in RPG_RT through injected DLL while saving the game each frame (for synchronization the Game_System.frame_counter is used)
  3. Compare the save files
  4. .....
  5. PROFIT

TODO

  • Invent a better input recording format [1] @Ghabry
  • Add a new SavegameManager class that provides a Save(int save_id) function. @fmatthew5876 can you help with this? A Load function isn't needed yet but I need a globally accesible Save. [2]
  • Write a unit test mode that saves the game each frame (easy to add when Save() exists)
  • Write a DynRpg plugin that can replay input and save each frame @Ghabry
  • Write an automatic difftool (python based?), could parse lcf2xml output and skip chunks that usually don't match (see [2])
  • Record some tests

Known issues

  • DynRPG only writes up to Save99.lsd, needs some trickery (file renaming) to record longer
  • The recording desyncs when there is a teleport. Is off by 5 frames?!

[1] My suggestion: 6531fd8 The important lines are the "F" lines, the format is game_system_frame,keys..... A frame can occur multiple times because Game_System frames are reset in some cases, but this is no problem.

H EasyRPG Player Recording
V 2
D 2020-08-23-23-27-37
F 45,DECISION
F 0,DECISION
F 5,RIGHT
F 6,RIGHT
[...] <- A line is only written when there was an input in this frame
F 28,RIGHT,UP
F 29,RIGHT,UP
F 30,RIGHT,UP

[2]

Notes about savegame incompatibility

  • title.timestamp - this varies (obviously)
  • system.scene is 0 on the map
  • easyrpg.version - only we write this

Strange observations

  • system.save_count when using dynrpg save this is always 0
  • system.save_slot when using dynrpg save this is always 1

Incompatible save storage

  • Player stores <saveactor><status>0 0 0 0 0 0 0 0 0 0</status>, but RPG_RT stores <status></status> @fmatthew5876 can you fix this? I guess RPG_RT only writes numbers until it reaches all zero.

Lower priority

  • Write a program that injects a DLL in RPG_RT that is DynRPG independent and provides the required features

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions