First off, I want to thank everyone that has supported NESMaker. You guys are the best. I know everyone is excited about using the latest version. At the time that I am writing this 4.1 is about to be released! I thought this would be a great time to talk a little about code management. I know it’s not the sexiest thing to discuss, but I think that it will make your lives much easier as you become more familiar with NESMaker, and want to dig into the asm a little.
In previous versions of NESMaker, editing the asm could be stressful because if you make a change that breaks everything, you might be worried about getting back to a known good working point. I am writing this article to show you how easy it is to play around with different versions of the asm and see how it affects your game. I’ll show you how to flip back and forth between multiple versions, and how easy it is to back everything up in case you want to share it with other developers. This tutorial is written for 4.1, but most of it is still applicable to previous versions too! Let’s get started!
First off all, let’s start with a brand new project.
Creating a new project
- Click on “File-New” from the menu.
- This will give you the dialog shown below. I like to start with Blank tiles, but you can choose whatever you like. Type in a folder name for your tilesets, and choose whatever starting module you like. I chose a module that I made. (I’ll show you how to do that in a future article!) But, you can select whatever you like.
- Next, lets save your project. Click File-Save, verify that you are in your “Projects” folder and give it a good name. I like to have my project name match, or be similar to the folder name that my tiles are in. You don’t have to though. It’s your game, so do what you like! The reason why I like to save right away is because it’s easy to forget what folder all of your tilesets are in so this keeps everything fresh in your mind.
At this point, you can start making your game! You can edit your tiles. You can start creating heroes, monsters, assets, whatever you like! Now lets say that you reach a point in your development where you want to play with changing the .asm files. Great! Let’s stay safe though. The first thing we are going to do is make a copy of all the files that we might want to tweak. Then, when we work with them, if we ever want to go back to the original scripts, it’s very easy! This is how we do it.
Creating a backup of the script folder
- Click “File-Backup Script Folder” from the menu. This will show a dialog for creating a “ZipScript” file. It might look odd, but it will make a lot of sense.
- Next, click on the ellipse for “Folder to Backup” and navigate to the “GameEngineData\Routines” folder. From there, navigate into the folder of the module you are working with. If you are making an adventure game, it might be the “adventure” folder. If it’s a platform game, it might be “platform”. If you are not sure, you can click on the “Project-Project Settings” menu option then go to the “Script Settings” tab. In the example below, you can see that all the scripts are in the “Basic” folder, so that is where I navigate to. Once there, don’t worry about clicking on a file; you are good.
- Now, you should verify two things. first, that you have selected the correct module folder. It’s always good to double check! Second, you’ll notice that the “Restore Root Location” has changed! This should reflect the folder that you picked. In my case, it says “Basic”.
- Next, Specify the location that you want to save the zip file. You can save this anywhere you like, but you might want to create a folder called “Backup” and save it there. That’s what I did. Just pick a good name for it that you’ll remember.
- Finally, because we want to keep our original scripts safe, we are going to change the name of the Restore Location Root. In this example, I want to remember that it is the first change from the original “Basic” set of scripts, so I named it “Basic.01”. Make sure you check the “Include Root Define” checkbox!
- Now, when you click “OK” it will create a normal zip file with All of your asm scripts in the correct place! You can use this like any other zip file. There is a special difference though! Inside this zip you will find an XML file. This xml contains instructions to NESMaker on how to link all those zip files to the defined scripts. That is where the magic happens. I’ll post another article in the future that gives more information on what each line does.
Restoring the backup
We are now reaching the fun part! Lets restore this backup so we can change the scripts without worrying about breaking everything.
- Click the “Project-Run Project Script” menu option.
- Select the zip file that you just created, and click OK.
- You should see a success dialog!
- The final step is to go to the “Project-Project Settings” menu option, and select the “Script Settings” tab. Verify that the “ROOT” is set to the location that you specified before when you created the zip file, and then click the “Update Root” button. This will update the location of all of your scripts to now point to the new folder specified in Root!
- Now try building and testing your application. It should run exactly like before. The only difference is that NESMaker is now using all the scripts in the new folder. You can now make any changes you like to the asm files and see how the changes are reflected in your game! If you want to go back to the way things were BEFORE you make any changes to your asm files, just select the “ROOT” entry in Project Settings, change it back to the previous value (In my case, it would say “Routines\Basic”) and then click The “Update Root” button again. It will all be back to normal!
Thanks for reading this guys! I hope that the level of detail was about right. If you think that it was too little, or too much, please let me know. If you would like a little more info on what is happening in that xml file, read on, and I’ll give some of the gory details! If you just want to backup up your files though, and keep them safe, you are good to go.
OK, I am assuming that if you are still reading, you are comfortable extracting the xml file from that zip file that you created, and have it opened in Notepad. In that zip file, there are two types of lines: The “AddAction / AddScript” line, and the “LinkAction/LinkScript” line. The AddAction line just tells NESMaker to extract the file specified in the “source” parameter from the zip file, and place it where “target” says. Simple! The LinkAction line just tells NESMaker to set an entry in Script settings that is specified in the display/label/param parameters. It is that easy! In fact, if you wanted to create a zip file by hand that only had that single zml file in it, and all that xml file had was LinkAction lines, you could very easily set all of your links with just a click. I’ll leave that for you to try out.
Thanks again guys! As always we appreciate your support, and I hope that this was helpful.