Game Logic in XML Files

前端 未结 5 1502
迷失自我
迷失自我 2020-12-22 20:24

I\'m dealing with game dialogue files (conversation between player and non-playable-characters) where dialogue choices and their outcome depend on certain conditions and res

5条回答
  •  自闭症患者
    2020-12-22 21:19

    Unless your game will have less than half a dozen unique dialogs, you should definitely put this information in some kind of data file. XML is a strong contender for the format. I don't speak Ruby, so it may not work in this case, but another option would be to define the dialog as data directly in Ruby code. (I know this would work pretty well in Lua, Python, and Javascript... I assume defining nested data structures is also easy in Ruby.)

    We used XML files to define all the static data in Pirates of the Burning Sea, and it was a great way to go. Having a data format like this lets non-programmers control the data and frees up the programmers to work on features instead of data entry. Having those data files be text means that you can keep them under source control so you can tell when they change.

提交回复
热议问题