Rxdata Versioning Utility

EDIT: I have upgraded this utility to an RMXP plugin system and uploaded the new code to a Git repository here.

Rxdata Versioning Utility
Version: 1.0.2

By: Raku ([email hidden])

Introduction

Have you ever wanted to work on an RMXP game with a group of friends, but ran into trouble with conflicts when multiple people edit the same rxdata files? If you want to safely and efficiently version the data in your RMXP game, then read on!

I have written a series of Ruby scripts to export all of the RMXP rxdata files (scripts, system data, maps, etc.) into plain-text files which are human-readable and can be easily versioned with a versioning system such as Subversion or Mercurial. I've also written scripts which can read these exported text files and import them back into rxdata files so that RMXP can read them. Now, anytime two people change a map, a script, or any other game data, all of the conflicts can be easily resolved in plain text.

I've been careful to make sure that the RGSS objects are always exported in the same way, so that unnecessary conflicts are avoided. The data files are exported as YAML files and the RGSS scripts are exported as normal Ruby files. This provides other benefits beyond just versioning the data. For example, you could use your favorite text editor outside of RMXP to edit your scripts; just make sure you don't export the scripts before you import your changes. Also, seeing what changed in the YAML files when you do something in RMXP is really helpful in understanding how the game data works!

This is my first script that I've posted here on the forums. Hopefully it's useful! Please give me suggestions or comments if you have any ideas how I could improve this utility.

Features
  • Exports rxdata files (except Scripts.rxdata) to text files in the YAML data format.
  • Exports all scripts contained in Scripts.rxdata to individual Ruby files.
  • Imports YAML files back into rxdata files that RMXP can read.
  • Imports Ruby scripts previously exported back into a Scripts.rxdata file that RMXP can read.
  • Automatic importing/exporting via Game.bat which can import all scripts and run RMXP. When RMXP is closed, all data is exported.
  • Utility behavior is configurable via a config.yaml file.
  • Only exports rxdata files if they need to be exported (i.e. have been modified since RMXP was opened or haven't been exported yet).
  • Only exports scripts if they are not empty (for example, place-holder scripts)
  • Cleanup script (called clean.rb) provided to help identify stale scripts (i.e. scripts which are added in RMXP's script editor, exported, and then later removed from the script editor, but still remain in your scripts directory).

Downloads

A demo project created using the utility and Subversion (Just run Game.bat, instead of Game.rxproj NOTE: SVN metadata not included in the project).

The RMXP Data Exporter/Importer Utility (follow instructions below to use with your project)

Sample Files

A sample YAML file exported from System.rxdata.
System.yaml Show
  1. ---
  2. root: !ruby/object:RPG::System
  3.   _: 7829367
  4.   actor_collapse_se: !ruby/object:RPG::AudioFile
  5.      name: 011-System11
  6.      pitch: 100
  7.      volume: 80
  8.   battle_bgm: !ruby/object:RPG::AudioFile
  9.      name: 001-Battle01
  10.      pitch: 100
  11.      volume: 100
  12.   battle_end_me: !ruby/object:RPG::AudioFile
  13.      name: 001-Victory01
  14.      pitch: 100
  15.      volume: 100
  16.   battle_start_se: !ruby/object:RPG::AudioFile
  17.      name: 009-System09
  18.      pitch: 100
  19.      volume: 80
  20.   battle_transition: 003-Blind03
  21.   battleback_name: 003-Forest01
  22.   battler_hue: 0
  23.   battler_name: 001-Fighter01
  24.   buzzer_se: !ruby/object:RPG::AudioFile
  25.      name: 004-System04
  26.      pitch: 100
  27.      volume: 80
  28.   cancel_se: !ruby/object:RPG::AudioFile
  29.      name: 003-System03
  30.      pitch: 100
  31.      volume: 80
  32.   cursor_se: !ruby/object:RPG::AudioFile
  33.      name: 001-System01
  34.      pitch: 100
  35.      volume: 80
  36.   decision_se: !ruby/object:RPG::AudioFile
  37.      name: 002-System02
  38.      pitch: 100
  39.      volume: 80
  40.   edit_map_id: 2
  41.   elements:
  42.   - ""
  43.   - Fire
  44.   - Ice
  45.   - Thunder
  46.   - Water
  47.   - Earth
  48.   - Wind
  49.   - Light
  50.   - Darkness
  51.   - vs Undead
  52.   - vs Snake
  53.   - vs Aquatic
  54.   - vs Beast
  55.   - vs Goblin
  56.   - vs Bird
  57.   - vs Devil
  58.   - vs Angel
  59.   enemy_collapse_se: !ruby/object:RPG::AudioFile
  60.      name: 012-System12
  61.      pitch: 100
  62.      volume: 80
  63.   equip_se: !ruby/object:RPG::AudioFile
  64.      name: 005-System05
  65.      pitch: 100
  66.      volume: 80
  67.   escape_se: !ruby/object:RPG::AudioFile
  68.      name: 010-System10
  69.      pitch: 100
  70.      volume: 80
  71.   gameover_me: !ruby/object:RPG::AudioFile
  72.      name: 005-Defeat01
  73.      pitch: 100
  74.      volume: 100
  75.   gameover_name: 001-Gameover01
  76.   load_se: !ruby/object:RPG::AudioFile
  77.      name: 008-System08
  78.      pitch: 100
  79.      volume: 80
  80.   magic_number: 77323823
  81.   party_members:
  82.   - 1
  83.   - 2
  84.   - 7
  85.   - 8
  86.   save_se: !ruby/object:RPG::AudioFile
  87.      name: 007-System07
  88.      pitch: 100
  89.      volume: 80
  90.   shop_se: !ruby/object:RPG::AudioFile
  91.      name: 006-System06
  92.      pitch: 100
  93.      volume: 80
  94.   start_map_id: 1
  95.   start_x: 10
  96.   start_y: 11
  97.   switches:
  98.   -
  99.   - ""
  100.   - ""
  101.   - ""
  102.   - ""
  103.   - ""
  104.   - ""
  105.   - ""
  106.   - ""
  107.   - ""
  108.   - ""
  109.   - ""
  110.   - ""
  111.   - ""
  112.   - ""
  113.   - ""
  114.   - ""
  115.   - ""
  116.   - ""
  117.   - ""
  118.   - ""
  119.   - ""
  120.   - ""
  121.   - ""
  122.   - ""
  123.   - ""
  124.   - ""
  125.   - ""
  126.   - ""
  127.   - ""
  128.   - ""
  129.   - ""
  130.   - ""
  131.   - ""
  132.   - ""
  133.   - ""
  134.   - ""
  135.   - ""
  136.   - ""
  137.   - ""
  138.   - ""
  139.   - ""
  140.   - ""
  141.   - ""
  142.   - ""
  143.   - ""
  144.   - ""
  145.   - ""
  146.   - ""
  147.   - ""
  148.   - ""
  149.   test_battlers:
  150.   - !ruby/object:RPG::System::TestBattler
  151.      actor_id: 1
  152.      armor1_id: 1
  153.      armor2_id: 5
  154.      armor3_id: 13
  155.      armor4_id: 0
  156.      level: 1
  157.      weapon_id: 1
  158.   - !ruby/object:RPG::System::TestBattler
  159.      actor_id: 2
  160.      armor1_id: 1
  161.      armor2_id: 5
  162.      armor3_id: 13
  163.      armor4_id: 0
  164.      level: 1
  165.      weapon_id: 5
  166.   - !ruby/object:RPG::System::TestBattler
  167.      actor_id: 7
  168.      armor1_id: 0
  169.      armor2_id: 9
  170.      armor3_id: 21
  171.      armor4_id: 0
  172.      level: 1
  173.      weapon_id: 25
  174.   - !ruby/object:RPG::System::TestBattler
  175.      actor_id: 8
  176.      armor1_id: 0
  177.      armor2_id: 9
  178.      armor3_id: 21
  179.      armor4_id: 0
  180.      level: 1
  181.      weapon_id: 29
  182.   test_troop_id: 1
  183.   title_bgm: !ruby/object:RPG::AudioFile
  184.      name: 062-Slow05
  185.      pitch: 100
  186.      volume: 100
  187.   title_name: 001-Title01
  188.   variables:
  189.   -
  190.   - ""
  191.   - ""
  192.   - ""
  193.   - ""
  194.   - ""
  195.   - ""
  196.   - ""
  197.   - ""
  198.   - ""
  199.   - ""
  200.   - ""
  201.   - ""
  202.   - ""
  203.   - ""
  204.   - ""
  205.   - ""
  206.   - ""
  207.   - ""
  208.   - ""
  209.   - ""
  210.   - ""
  211.   - ""
  212.   - ""
  213.   - ""
  214.   - ""
  215.   - ""
  216.   - ""
  217.   - ""
  218.   - ""
  219.   - ""
  220.   - ""
  221.   - ""
  222.   - ""
  223.   - ""
  224.   - ""
  225.   - ""
  226.   - ""
  227.   - ""
  228.   - ""
  229.   - ""
  230.   - ""
  231.   - ""
  232.   - ""
  233.   - ""
  234.   - ""
  235.   - ""
  236.   - ""
  237.   - ""
  238.   - ""
  239.   - ""
  240.   windowskin_name: 001-Blue03b2
  241.   words: !ruby/object:RPG::System::Words
  242.      agi: AGI
  243.      armor1: Shield
  244.      armor2: Helmet
  245.      armor3: Body Armor
  246.      armor4: Accessory
  247.      atk: ATK
  248.      attack: Attack
  249.      dex: DEX
  250.      equip: Equip
  251.      gold: G
  252.      guard: Defend
  253.      hp: HP
  254.      int: INT
  255.      item: Item
  256.      mdef: MDEF
  257.      pdef: PDEF
  258.      skill: Skill
  259.      sp: SP
  260.      str: STR
  261.      weapon: Weapon
  262.  
Expand to see the code.

A sample export digest. This file is generated by the RGSS script exporter and is a list of all exported scripts. It is used so they can be re-imported into Scripts.rxdata in the original order later. Notice that the third column (exported Ruby file name) for the second entry is EMPTY. No file is actually exported, since that script in RMXP was actually an empty entry.
digest.txt Show
  1. 91679711      Test_Script                                                   Test_Script.rb
  2. 85299656      ---------------------------                           EMPTY
  3. 75819864      Game_Temp                                                      Game_Temp.rb
  4. 61166382      Game_System                                                   Game_System.rb
  5. 65768432      Game_Switches                                                Game_Switches.rb
  6. 77770996      Game_Variables                                              Game_Variables.rb
  7. 93212223      Game_SelfSwitches                                          Game_SelfSwitches.rb
  8. 52755737      Game_Screen                                                   Game_Screen.rb
  9. 79550171      Game_Picture                                                 Game_Picture.rb
  10. 52884295      Game_Battler_1                                              Game_Battler_1.rb
  11. 2845129       Game_Battler_2                                              Game_Battler_2.rb
  12. 39520892      Game_Battler_3                                              Game_Battler_3.rb
  13. 65931833      Game_BattleAction                                          Game_BattleAction.rb
  14. 93706232      Game_Actor                                                    Game_Actor.rb
  15. 19485474      Game_Enemy                                                    Game_Enemy.rb
  16. 84307861      Game_Actors                                                   Game_Actors.rb
  17. 20162964      Game_Party                                                    Game_Party.rb
  18. 96014404      Game_Troop                                                    Game_Troop.rb
  19. 45114136      Game_Map                                                       Game_Map.rb
  20. 37136841      Game_CommonEvent                                           Game_CommonEvent.rb
  21. 85238647      Game_Character_1                                           Game_Character_1.rb
  22. 91992187      Game_Character_2                                           Game_Character_2.rb
  23. 97808837      Game_Character_3                                           Game_Character_3.rb
  24. 75787353      Game_Event                                                    Game_Event.rb
  25. 47174434      Game_Player                                                   Game_Player.rb
  26. 76586914      Sprite_Character                                           Sprite_Character.rb
  27. 35537720      Sprite_Battler                                              Sprite_Battler.rb
  28. 18621826      Sprite_Picture                                              Sprite_Picture.rb
  29. 85012817      Sprite_Timer                                                 Sprite_Timer.rb
  30. 2353947       Spriteset_Map                                                Spriteset_Map.rb
  31. 92516995      Spriteset_Battle                                           Spriteset_Battle.rb
  32. 30856323      Window_Base                                                   Window_Base.rb
  33. 61843872      Window_Selectable                                          Window_Selectable.rb
  34. 83996582      Window_Command                                              Window_Command.rb
  35. 77997554      Window_Help                                                   Window_Help.rb
  36. 97998046      Window_Gold                                                   Window_Gold.rb
  37. 10275269      Window_PlayTime                                             Window_PlayTime.rb
  38. 73623657      Window_Steps                                                 Window_Steps.rb
  39. 19290161      Window_MenuStatus                                          Window_MenuStatus.rb
  40. 82366943      Window_Item                                                   Window_Item.rb
  41. 97657          Window_Skill                                                 Window_Skill.rb
  42. 97927834      Window_SkillStatus                                        Window_SkillStatus.rb
  43. 99822998      Window_Target                                                Window_Target.rb
  44. 73541260      Window_EquipLeft                                           Window_EquipLeft.rb
  45. 20193482      Window_EquipRight                                          Window_EquipRight.rb
  46. 67379761      Window_EquipItem                                           Window_EquipItem.rb
  47. 42657471      Window_Status                                                Window_Status.rb
  48. 81494140      Window_SaveFile                                             Window_SaveFile.rb
  49. 75433349      Window_ShopCommand                                        Window_ShopCommand.rb
  50. 98941040      Window_ShopBuy                                              Window_ShopBuy.rb
  51. 52413940      Window_ShopSell                                             Window_ShopSell.rb
  52. 50042725      Window_ShopNumber                                          Window_ShopNumber.rb
  53. 42938232      Window_ShopStatus                                          Window_ShopStatus.rb
  54. 77163696      Window_NameEdit                                             Window_NameEdit.rb
  55. 74963379      Window_NameInput                                           Window_NameInput.rb
  56. 12512207      Window_InputNumber                                        Window_InputNumber.rb
  57. 59899902      Window_Message                                              Window_Message.rb
  58. 63909912      Window_PartyCommand                                       Window_PartyCommand.rb
  59. 78381347      Window_BattleStatus                                       Window_BattleStatus.rb
  60. 18789673      Window_BattleResult                                       Window_BattleResult.rb
  61. 70270804      Window_DebugLeft                                           Window_DebugLeft.rb
  62. 74315432      Window_DebugRight                                          Window_DebugRight.rb
  63. 15695525      Arrow_Base                                                    Arrow_Base.rb
  64. 82011983      Arrow_Enemy                                                   Arrow_Enemy.rb
  65. 716537         Arrow_Actor                                                   Arrow_Actor.rb
  66. 76431274      Interpreter_1                                                Interpreter_1.rb
  67. 94946289      Interpreter_2                                                Interpreter_2.rb
  68. 21948242      Interpreter_3                                                Interpreter_3.rb
  69. 55160522      Interpreter_4                                                Interpreter_4.rb
  70. 77288818      Interpreter_5                                                Interpreter_5.rb
  71. 2407837       Interpreter_6                                                Interpreter_6.rb
  72. 32165528      Interpreter_7                                                Interpreter_7.rb
  73. 48831177      Scene_Title                                                   Scene_Title.rb
  74. 29223633      Scene_Map                                                      Scene_Map.rb
  75. 95355584      Scene_Menu                                                    Scene_Menu.rb
  76. 21041870      Scene_Item                                                    Scene_Item.rb
  77. 97256469      Scene_Skill                                                   Scene_Skill.rb
  78. 82235717      Scene_Equip                                                   Scene_Equip.rb
  79. 95739746      Scene_Status                                                 Scene_Status.rb
  80. 71942138      Scene_File                                                    Scene_File.rb
  81. 77130127      Scene_Save                                                    Scene_Save.rb
  82. 58364868      Scene_Load                                                    Scene_Load.rb
  83. 79702758      Scene_End                                                      Scene_End.rb
  84. 4299927       Scene_Battle_1                                              Scene_Battle_1.rb
  85. 63449097      Scene_Battle_2                                              Scene_Battle_2.rb
  86. 40844727      Scene_Battle_3                                              Scene_Battle_3.rb
  87. 33132935      Scene_Battle_4                                              Scene_Battle_4.rb
  88. 40350342      Scene_Shop                                                    Scene_Shop.rb
  89. 45690918      Scene_Name                                                    Scene_Name.rb
  90. 52774048      Scene_Gameover                                              Scene_Gameover.rb
  91. 44960761      Scene_Debug                                                   Scene_Debug.rb
  92. 34503174      Main                                                             Main.rb
  93.  
Expand to see the code.

A sample config file for the utility.
config.yaml Show
  1. #===============================================================================
  2. # Filename:      config.yaml
  3. #
  4. # Developer:    Raku ([email hidden])
  5. #
  6. # Description: This file contains all configurable parameters for the RMXP
  7. #      Importer/Exporter Utility.
  8. #===============================================================================
  9. ---
  10. #-------------------------------------------------------------------------------
  11. #   Import/Export Directories
  12. #-------------------------------------------------------------------------------
  13. # NOTE: All paths in this file are relative to the directory where the utility
  14. # scripts are located (and hopefully where this file is located).
  15. #-------------------------------------------------------------------------------
  16.  
  17. # Modify this path to specify where your .rxdata files reside
  18. rxdata_dir:    ../Data
  19.  
  20. # Modify this path to specify where you want the game data emitted in YAML
  21. yaml_dir:       ../Data/Yaml
  22.  
  23. # Modify this path to specify where you want the RGSS scripts exported to
  24. scripts_dir:   ../Data/Scripts
  25.  
  26. # Modify this path to specify the RMXP project directory (where Game.rxproj is)
  27. project_dir:   ..
  28.  
  29. #-------------------------------------------------------------------------------
  30. #   Miscellaneous Parameters
  31. #-------------------------------------------------------------------------------
  32.  
  33. # This array specifies all .rxdata files which are to be ignored by the data
  34. # exporter script.   Note that the script exporter doesn't look at this array,
  35. # since it always exports the Scripts.rxdata file.   Add entries to this array
  36. # if you do not wish to version certain .rxdata files.
  37. rxdata_ignore_list:       ["Scripts.rxdata"]
  38.  
  39. # This parameter determines whether the import/export scripts print verbose
  40. # information such as each filename as it is imported or exported and timing
  41. # information.   Errors are always printed.
  42. #    Valid values:   [true || false]
  43. verbose: true
  44.  
  45. # This is the value always used for System object's magic_number field.   RMXP
  46. # changes this value whenever System.rxdata is modified, so having a default
  47. # value prevents unnecessary conflicts when versioning the System.yaml file.
  48. # If, for any reason, this causes problems, you can disable the default magic
  49. # number functionality by setting the value -1.
  50. magic_number: 77323823
Expand to see the code.

The default Game.bat importer/exporter runner.
Game.bat Show
  1. @echo off
  2.  
  3. REM #========================================================
  4. REM #                      Developed by Raku
  5. REM #========================================================
  6. REM # Use this batch file as you please, just give me some
  7. REM # credit if you do.   Thanks and happy scripting!
  8. REM #========================================================
  9.  
  10. REM #========================================================
  11. REM #   Setup the Paths for the Importer/Exporter
  12. REM #========================================================
  13.  
  14. REM # The path to the ruby scripts which import and export
  15. REM # RPG Maker XP Data
  16. SET SCRIPTS_DIR="Utility"
  17.  
  18. REM #===============================
  19. REM #   Change to Scripts Directory
  20. REM #===============================
  21.  
  22. SET PREV_DIR=%CD%
  23. CD %SCRIPTS_DIR%
  24.  
  25. REM #========================
  26. REM #   RGSS script Importer
  27. REM #========================
  28.  
  29. RUBY script_importer.rb
  30.  
  31. REM #======================
  32. REM #   RMXP Data Importer
  33. REM #======================
  34.  
  35. RUBY data_importer.rb
  36.  
  37. REM #=======================
  38. REM #   Start RPG Maker XP
  39. REM #=======================
  40.  
  41. RUBY start_rmxp.rb
  42.  
  43. REM #======================
  44. REM #   RMXP Data Exporter
  45. REM #======================
  46.  
  47. RUBY data_exporter.rb
  48.  
  49. REM #========================
  50. REM #   RGSS Script Exporter
  51. REM #========================
  52.  
  53. RUBY script_exporter.rb
  54.  
  55. REM #================================
  56. REM #   Return to Original Directory
  57. REM #================================
  58.  
  59. CD %PREV_DIR%
Expand to see the code.

Sample Game.bat output (verbose mode)
Game.bat Output Show
  1. F:\projects\RMXP\TestSvnRepo\RxdataImporterExporterDemo>Game.bat
  2. --------------------------------------------------------------------------------
  3.   RGSS Script Import
  4. --------------------------------------------------------------------------------
  5. Imported Test_Script.rb                               (001/091)
  6. Imported Game_Temp.rb                                  (002/091)
  7. Imported Game_System.rb                               (003/091)
  8. Imported Game_Switches.rb                            (004/091)
  9. Imported Game_Variables.rb                           (005/091)
  10. Imported Game_SelfSwitches.rb                      (006/091)
  11. Imported Game_Screen.rb                               (007/091)
  12. Imported Game_Picture.rb                              (008/091)
  13. Imported Game_Battler_1.rb                           (009/091)
  14. Imported Game_Battler_2.rb                           (010/091)
  15. Imported Game_Battler_3.rb                           (011/091)
  16. Imported Game_BattleAction.rb                      (012/091)
  17. Imported Game_Actor.rb                                 (013/091)
  18. Imported Game_Enemy.rb                                 (014/091)
  19. Imported Game_Actors.rb                               (015/091)
  20. Imported Game_Party.rb                                 (016/091)
  21. Imported Game_Troop.rb                                 (017/091)
  22. Imported Game_Map.rb                                    (018/091)
  23. Imported Game_CommonEvent.rb                        (019/091)
  24. Imported Game_Character_1.rb                        (020/091)
  25. Imported Game_Character_2.rb                        (021/091)
  26. Imported Game_Character_3.rb                        (022/091)
  27. Imported Game_Event.rb                                 (023/091)
  28. Imported Game_Player.rb                               (024/091)
  29. Imported Sprite_Character.rb                        (025/091)
  30. Imported Sprite_Battler.rb                           (026/091)
  31. Imported Sprite_Picture.rb                           (027/091)
  32. Imported Sprite_Timer.rb                              (028/091)
  33. Imported Spriteset_Map.rb                            (029/091)
  34. Imported Spriteset_Battle.rb                        (030/091)
  35. Imported Window_Base.rb                               (031/091)
  36. Imported Window_Selectable.rb                      (032/091)
  37. Imported Window_Command.rb                           (033/091)
  38. Imported Window_Help.rb                               (034/091)
  39. Imported Window_Gold.rb                               (035/091)
  40. Imported Window_PlayTime.rb                         (036/091)
  41. Imported Window_Steps.rb                              (037/091)
  42. Imported Window_MenuStatus.rb                      (038/091)
  43. Imported Window_Item.rb                               (039/091)
  44. Imported Window_Skill.rb                              (040/091)
  45. Imported Window_SkillStatus.rb                     (041/091)
  46. Imported Window_Target.rb                            (042/091)
  47. Imported Window_EquipLeft.rb                        (043/091)
  48. Imported Window_EquipRight.rb                      (044/091)
  49. Imported Window_EquipItem.rb                        (045/091)
  50. Imported Window_Status.rb                            (046/091)
  51. Imported Window_SaveFile.rb                         (047/091)
  52. Imported Window_ShopCommand.rb                     (048/091)
  53. Imported Window_ShopBuy.rb                           (049/091)
  54. Imported Window_ShopSell.rb                         (050/091)
  55. Imported Window_ShopNumber.rb                      (051/091)
  56. Imported Window_ShopStatus.rb                      (052/091)
  57. Imported Window_NameEdit.rb                         (053/091)
  58. Imported Window_NameInput.rb                        (054/091)
  59. Imported Window_InputNumber.rb                     (055/091)
  60. Imported Window_Message.rb                           (056/091)
  61. Imported Window_PartyCommand.rb                   (057/091)
  62. Imported Window_BattleStatus.rb                   (058/091)
  63. Imported Window_BattleResult.rb                   (059/091)
  64. Imported Window_DebugLeft.rb                        (060/091)
  65. Imported Window_DebugRight.rb                      (061/091)
  66. Imported Arrow_Base.rb                                 (062/091)
  67. Imported Arrow_Enemy.rb                               (063/091)
  68. Imported Arrow_Actor.rb                               (064/091)
  69. Imported Interpreter_1.rb                            (065/091)
  70. Imported Interpreter_2.rb                            (066/091)
  71. Imported Interpreter_3.rb                            (067/091)
  72. Imported Interpreter_4.rb                            (068/091)
  73. Imported Interpreter_5.rb                            (069/091)
  74. Imported Interpreter_6.rb                            (070/091)
  75. Imported Interpreter_7.rb                            (071/091)
  76. Imported Scene_Title.rb                               (072/091)
  77. Imported Scene_Map.rb                                  (073/091)
  78. Imported Scene_Menu.rb                                 (074/091)
  79. Imported Scene_Item.rb                                 (075/091)
  80. Imported Scene_Skill.rb                               (076/091)
  81. Imported Scene_Equip.rb                               (077/091)
  82. Imported Scene_Status.rb                              (078/091)
  83. Imported Scene_File.rb                                 (079/091)
  84. Imported Scene_Save.rb                                 (080/091)
  85. Imported Scene_Load.rb                                 (081/091)
  86. Imported Scene_End.rb                                  (082/091)
  87. Imported Scene_Battle_1.rb                           (083/091)
  88. Imported Scene_Battle_2.rb                           (084/091)
  89. Imported Scene_Battle_3.rb                           (085/091)
  90. Imported Scene_Battle_4.rb                           (086/091)
  91. Imported Scene_Shop.rb                                 (087/091)
  92. Imported Scene_Name.rb                                 (088/091)
  93. Imported Scene_Gameover.rb                           (089/091)
  94. Imported Scene_Debug.rb                               (090/091)
  95. Imported Main.rb                                          (091/091)
  96. --------------------------------------------------------------------------------
  97. The total import time:   0.594 seconds.
  98. --------------------------------------------------------------------------------
  99.  
  100. --------------------------------------------------------------------------------
  101.   RMXP Data Import
  102. --------------------------------------------------------------------------------
  103. Imported Actors.yaml                            (001/016)      0.093 seconds
  104. Imported Animations.yaml                      (002/016)      0.907 seconds
  105. Imported Armors.yaml                            (003/016)      0.062 seconds
  106. Imported Classes.yaml                           (004/016)      0.016 seconds
  107. Imported CommonEvents.yaml                   (005/016)      0.015 seconds
  108. Imported Enemies.yaml                           (006/016)      0.063 seconds
  109. Imported Items.yaml                              (007/016)      0.016 seconds
  110. Imported Map001.yaml                            (008/016)      0.046 seconds
  111. Imported Map002.yaml                            (009/016)      0.032 seconds
  112. Imported MapInfos.yaml                         (010/016)      0.015 seconds
  113. Imported Skills.yaml                            (011/016)      0.078 seconds
  114. Imported States.yaml                            (012/016)      0.016 seconds
  115. Imported System.yaml                            (013/016)      0.016 seconds
  116. Imported Tilesets.yaml                         (014/016)      1.234 seconds
  117. Imported Troops.yaml                            (015/016)      0.047 seconds
  118. Imported Weapons.yaml                           (016/016)      0.016 seconds
  119. --------------------------------------------------------------------------------
  120. The total import time:   2.672 seconds.
  121. Total YAML load time:    1.173 seconds.
  122. Total RXDATA dump time: 1.499 seconds.
  123. --------------------------------------------------------------------------------
  124.  
  125. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  126. !!!DO NOT CLOSE THIS COMMAND WINDOW!!!
  127. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  128.  
  129. --------------------------------------------------------------------------------
  130.   RMXP Data Export
  131. --------------------------------------------------------------------------------
  132. Exported Tilesets.rxdata                      (001/003)      7.703 seconds
  133. Exported Troops.rxdata                         (002/003)      0.329 seconds
  134. Exported Weapons.rxdata                        (003/003)      0.109 seconds
  135. --------------------------------------------------------------------------------
  136. The total export time:   8.141 seconds.
  137. Total RXDATA load time: 0.718 seconds.
  138. Total YAML dump time:    7.423 seconds.
  139. --------------------------------------------------------------------------------
  140.  
  141. --------------------------------------------------------------------------------
  142.   RGSS Script Export
  143. --------------------------------------------------------------------------------
  144. No RGSS scripts need to be exported.
Expand to see the code.


Instructions
Requirements
  • Ruby Interpreter - Get the most recent version here. It is required to run the utility scripts outside of RMXP. You will need a version with the YAML and Zlib modules (the latest version should have these).
  • RPG Maker XP - Obviously! :)
  • Windows XP - Not sure if this utility works on Windows Vista. The only problem I forsee could be the batch file commands. Since I don't have access to a Vista machine, could someone confirm this?
  • (Optional) Versioning System - If you want to keep track of versions of your exported data, you will need a versioning system like SVN, Mercurial, or Github.
Setup
  • Download the RMXP Data Exporter/Importer Utility above.
  • Back up your project (just copy it somewhere for safe-keeping). :)
  • Extract the archive into your RMXP project directory. NOTE: If you already have a Utility directory in the base directory of your RMXP project, you may want to extract to a temporary directory and change the name of the Utility directory to something else. Just make sure to update the SCRIPTS_DIR environment variable set in Game.bat (see above).
  • Optional: Modify any configuration parameters you want, in the config.yaml file, such as output directory paths for the YAML and Ruby files.

Usage
Automated (recommended)
  • Just run Game.bat.
  • Kick back, relax, and let the batch file do everything for you. NOTE: It will ignore importing the first time it is run, since no data has been exported yet. When you close RMXP, all of the data will be exported (as long as you don't close the command window that Game.bat opened). :)

Manual
  • Open a command prompt
  • Change to the scripts directory (default name is Utility).
  • > ruby script_importer.rb
  • > ruby data_importer.rb
  • > ruby logtime.rb (This is to log the time we started RMXP to determine if files were modified)
  • Open RPG Maker XP
  • Close RPG Maker XP
  • > ruby data_exporter.rb
  • > ruby script_exporter.rb

What to Version
  • The exported data YAML files
  • The exported Ruby scripts
  • The script export digest (digest.txt)
  • All RMXP Exporter/Importer Utility scripts (so that everyone sharing your project has them)
  • Game.bat (if you are using it - I highly recommend to use it, since it is easy to forget to import or export)

FAQ
  • Does this utility work for RMVX? No, it needs to be modified to work with RMVX. I only own RMXP, but if anyone wants to modify it, I will post the RMVX version here too. It should be pretty easy to make the modifications (*knock on wood*).
  • What versioning system does this utility work with? Theoretically, all of them. Exported files should be versionable by any versioning system that can version UTF8-encoded text files, which I think is all of them. I've tested this versioning two different RMXP projects with Subversion with no problems.
  • When versioning the exported files, why do I get conflicts when there is no change in the files? Probably this is due to editing the exported file in a text editor or diff program which modified the newlines in the file. Try telling your versioning system to ignore new line differences or always convert them automatically.
  • Why are my changes not exported after I close RMXP? If you ran the Game.bat file, you may want to check that you have not accidentally closed the command window that says, "DO NOT CLOSE THIS COMMAND WINDOW!!!". The export step should automatically execute from the batch script when you close RMXP. If you're manually running the scripts, then just run the export script (see Usage).

Compatibility
NOTE: I'm currently investigating compatibility with SDK. I'll post an update as soon as I know for sure.

This utility should be compatible with any script modifications, since it runs outside of RMXP and treats scripts as data. However, you may experience problems if you have directly modified any of the classes in the RPG module. In general, one should not directly modify these classes, but in case you have, I've included a Ruby file for RGSS modifications (the default location is /Utility/rmxp/rgss_mod.rb). You will need to add your changes to that file so that they can be automatically picked up by the importer/exporter scripts.

Credits and Thanks

Author's Notes

  • This is the final release of the Rxdata Versioning Utility. I have made an RMXP Plugin System which covers the functionality of this utility, plus much more. I'll post it on the forums shortly.
  • THIS UTILITY MODIFIES YOUR PROJECT'S .rxdata FILES! Make sure to back them up before using it.
  • If anyone can help me test this utility out on more RMXP projects, I would really appreciate it!
  • Since I don't have access to a Vista machine, could someone confirm if this utility works on Vista?
  • If you need Ruby implementations of the Table, Color, and Tone classes that can load and dump the .rxdata files that RMXP can read, they are included in the utility in rgss_internal.rb, or you can email me and I'll send them to you. :)

Terms and Conditions

This utility is free for any use, commercial or otherwise.
Woah!
Cheers! we can now use SVN :)
nowayskill wrote:
Woah!
Cheers! we can now use SVN :)

Yep! :thumb:

I've actually been using the script exporter part with Subversion for many months now working on a game with a team. It's been really helpful in managing conflicts. Now that we can version our data too, it should really help speed things up. Until now, only one person at a time could edit the Maps, Events, Database, etc. Basically, one guy ended up making all changes which was obviously a development bottle-neck!

Now we even correct spelling mistakes and other stuff in the text files! 😀
Raku wrote:
nowayskill wrote:
Woah!
Cheers! we can now use SVN :)

Yep! :thumb:

I've actually been using the script exporter part with Subversion for many months now working on a game with a team. It's been really helpful in managing conflicts. Now that we can version our data too, it should really help speed things up. Until now, only one person at a time could edit the Maps, Events, Database, etc. Basically, one guy ended up making all changes which was obviously a development bottle-neck!

Now we even correct spelling mistakes and other stuff in the text files! 😀

If you'll find a way to make a patcher it would be good..
I think you should make it download the Rxdata files from a host using
the berka's RMXP net module which allow you to make that easily
to check what data is not the same as the data in the web
and download it all through YAML
nowayskill wrote:
If you'll find a way to make a patcher it would be good..
I think you should make it download the Rxdata files from a host using
the berka's RMXP net module which allow you to make that easily
to check what data is not the same as the data in the web
and download it all through YAML

Hmm...sounds interesting, but I'm not sure I completely understand. Currently, the import/export scripts run outside of RMXP. Are you saying that it would be good to have the scripts run in RMXP and import the data by downloading the YAML from a remote host and generate the rxdata files? If so, here are some questions that we'd need to answer:

  • What is gained over traditional code versioning systems like SVN? This importer/exporter is not really meant for deploying patches to players after a game is released (although we could add that if its useful). It is more to enable people to work concurrently while the game is being developed.
  • Is YAML supported in RMXP's version of Ruby? It is quite trimmed down.

Since the importer/exporter scripts in this utility are run before/after RMXP starts, I am tossing around the idea of making a plug-in architecture so that all people would need to do to have something done at startup or shutdown of RMXP would be to implement a plugin class. For example:

  1. class PluginInterface
  2.   def on_startup
  3.      raise NotImplementedError.new
  4.   end
  5.  
  6.   def on_shutdown
  7.      raise NotImplementedError.new
  8.   end
  9. end
  10.  
  11. class DataImporterExporter < PluginInterface
  12.   def initialize
  13.   end
  14.  
  15.   def on_startup
  16.      # Import the rxdata files from text
  17.      puts 'Importing data...'
  18.   end
  19.  
  20.   def on_shutdown
  21.      # Export the rxdata files to text
  22.      puts 'Exporting data...'
  23.   end
  24. end
  25.  
  26. class ScriptImporterExporter < PluginInterface
  27.   def initialize
  28.   end
  29.  
  30.   def on_startup
  31.      # Import the scripts from text
  32.      puts 'Importing scripts...'
  33.   end
  34.  
  35.   def on_shutdown
  36.      # Export the scripts to text
  37.      puts 'Exporting scripts...'
  38.   end
  39. end
  40.  
  41.  
  42. # In the startup script
  43. plugins = []
  44. plugins << ScriptImporterExporter.new
  45. plugins << DataImporterExporter.new
  46.  
  47. # Before starting RMXP
  48. plugins.each do |plugin|
  49.   plugin.on_startup
  50. end
  51.  
  52. # START RMXP...
  53.  
  54. # After exiting RMXP
  55. plugins.each do |plugin|
  56.   plugin.on_shutdown
  57. end
  58.  
  59. # Outputs:
  60. =begin
  61. Importing scripts...
  62. Importing data...
  63. Exporting scripts...
  64. Exporting data...
  65. =end
Expand to see the code.

I wonder what people think about this idea. This way people could easily integrate scripts in the startup and shutdown process for their RMXP project.

I've already been thinking of creating a plugin that can read the dialogue/vocab from the rxdata files and import/export it from/to a separate file for translation purposes. This way people could get all the language out of their RMXP project, translate it in an easy way, then it gets imported back in before RMXP starts. (I know that there are already scripts out there that help in translation, but I don't really like the format they dump the data in).
Very nice set of utilities! Me and Brewmeister were using a similar solution that exported Scripts.rxdata to single Ruby files so that we could use SVN, but yours is much more developed; I just put something together quickly to be able to code right away.

As for your plugin idea, there'd have to be some sort of prioritization mechanism; certain scripts need to be ran before, or some such. But good endeavor!
∫∆µ wrote:
Very nice set of utilities! Me and Brewmeister were using a similar solution that exported Scripts.rxdata to single Ruby files so that we could use SVN, but yours is much more developed; I just put something together quickly to be able to code right away.

As for your plugin idea, there'd have to be some sort of prioritization mechanism; certain scripts need to be ran before, or some such. But good endeavor!

You're absolutely right! I've been thinking about the same prioritization issue as well. One possible solution could be to specify ordering constraints in a config file using a hash. For example:

  1. module Config
  2.   # The data exporter might need to run before the language exporter
  3.   # because the language exporter could use the YAML text to extract
  4.   # all language information.   Then the import for the language importer
  5.   # would need to be run to update the data exporter's yaml files with
  6.   # new language texts.
  7.   STARTUP_PRIORITIES = {'LanguageImporterExporter' => 'DataImporterImporter'}
  8.   SHUTDOWN_PRIORITIES = {'DataImporterExporter' => 'LanguageImporterExporter'}   
  9. end
Expand to see the code.


Then we could just sort the array of plugins based on these priorities.

Any other ideas for how priority ordering might be achieved? Perhaps some code mechanism the author of a plugin could include to make sure another plugin has already been run? I'd like to find a clean way so that users don't need to do the above configuration themselves.

By the way, I'm glad you're finding the utility useful! That will help encourage me to post updates! :thumb:
You could use some sort of weighing system; you give each plugins certain weights, kind of like how Windows handles its process prioritization.

All plug-ins start with a 0 weight; plug-ins with higher priority are given higher weights and so forth (or the other way around). Each weight could be assigned to a particular level of prioritization, so that all plug-ins on a given level are not supposed to interfere with each other.
The link is broken or down. Could you please Re-Upload the Scripts?
Thx
Hi All,

Not to Necro the post, though I guess I am, does anyone have a copy of this program or the code? I did contact a Mod and sent an email to Raku, though I don't have very high hopes for a response since he has not been on since June of 2009. As I told them in the email, if no one is working on this I can give it a shot, but I would rather not reinvent the wheel.

Any help would be appreciated,
Ab
Hi Everyone,

Let me first start off by apologizing for not tending this post for so long. I know how frustrating it must have been for those of you who really wanted this utility. I really, really, whole-heartedly apologize to you. There is no excuse. (If you're interested, I moved to Japan, my laptop harddisk crashed, I got engaged, and I've been learning how to work mad hours at a Japanese company.)

Now for the good news! Luckily, I managed to save a copy of the utility on a friend's SVN repository. So I will be uploading a new link to it within 24 hours!

I'll do my best to contact those of you who wanted the script directly. I am so sorry!!! m(_ _)m

-Raku
Hi all,

I've fixed the links! They now point to the files on Google Docs, so unless Google goes down, you should be able to access them in the forseeable future.

Thanks to those of you who contacted me directly to get this resolved.

Happy Coding/Designing/Creating!
Raku
This... This is one of the most amazing things I've ever seen...
If this could improve the ways databases could be made for independent games. Being able to directly work with the code in a games database.
I tip my hat to you sir. *tips hat*

Say, you know vgvgf is trying to make a rgss shell from just the code? He might be a tad interested in what you have here...
Untra wrote:
This... This is one of the most amazing things I've ever seen...

Thanks! I'm glad you like it.

Untra wrote:
If this could improve the ways databases could be made for independent games. Being able to directly work with the code in a games database.
I tip my hat to you sir. *tips hat*

I have considered that, instead of exporting to text files (for versioning), all of the game data could be exported into an external database (for example, mySQL or more simply CouchDB). It seems (without looking deeply into it) that the RGSS scripts in RMXP could be modified to load all the data directly from the database instead of the .rxdata files. But I'm not sure off the top of my head any compelling reasons to do this. If you have any ideas for how this utility could improve game databases, I'm all ears. :)

Thanks for pointing me to vgvgf's ARGSS project page! I'll keep my eye on its development.
Raku, thank you very much, you saved my day. Otherwise I would have started programming this myself. Great work!!! Any chance you will put the code in an SVN or GIT repository from where new versions can be maintained :)?
nice work mannn; impressive!
bogey wrote:
Raku, thank you very much, you saved my day. Otherwise I would have started programming this myself. Great work!!! Any chance you will put the code in an SVN or GIT repository from where new versions can be maintained :)?


Hi bogey,

Sorry for not tending this topic. I took your advice and set up a Git repo on Github. It is for the RMXP Plugin System which is an improvement on this utility. In fact it does the same thing, but supports extension for other plugin-like features (for example, patching potentially).

https://github.com/rakudayo/rmxp-plugin-system

It's public, so anyone can fork it and submit their own changes when bugs are discovered, or if anyone wants to submit new plugins.

Regards,
Raku
Very good work, Raku ;)

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=63438