Save and Load .bat game

后端 未结 7 1636
予麋鹿
予麋鹿 2020-12-05 21:13

I\'m making a text game written in bat, and the game has been done, (or more, a good part of it, such as the commands, and at the stage where you can play it); however, I wa

7条回答
  •  北海茫月
    2020-12-05 21:20

    I've once written a batch game (text-adventure like) back in DOS 5 era. I've then chosen to make each location in the game a separate folder on disk. Each location had its own bat file to initialize the location, like showing its description and to initialize which locations could be moved to from there.

    Objects and persons had their own bat file. So when talking to a person, the bat file of that person needed to handle that, and save conversation info. Picking up an object was as simple as moving object.bat from the location directory to the inventory directory.

    That way, not only could I easily add locations, objects and persons to the game, but also most of the information was saved automatically, because the status was kept inside files, or in the location of files. The rest was saved by saving relevant values to a batch file that was run on load, in a similar way as Mat described in his answer.

    I must say, I didn't know then of all the for loop trickery and string manipulation possibilities, if they even were possible MSDOS 5, otherwise it could have been a little easier, not to mention faster. ;)

提交回复
热议问题