One click map testing within Spark
Mendasp
I touch maps in inappropriate placesValencia, Spain Join Date: 2002-07-05 Member: 884Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow, WC 2013 - Shadow, Retired Community Developer
There are two tools in this thread now:
<ul><li><a href="https://us.v-cdn.net/5019629/uploads/FileUpload/3f/39b6553ea0463d3f659434d13996e6.zip" target="_blank">LaunchMap</a>: For quick testing. It will copy your map in the correct folder, generate the overview for your map and launch NS2 with it.</li><li><a href="https://us.v-cdn.net/5019629/uploads/FileUpload/fe/0456afe1aab08a409226a730dc4475.zip" target="_blank">ZipMap</a>: For packaging your map for distribution. It will ask for the final map name so you can have your own version control different from the main publishing one. It will generate a zip file with your level and overviews on your desktop with the specified name. Any further custom content has to be included manually.</li></ul>
<b>LAUNCHMAP</b>
Download <a href="https://us.v-cdn.net/5019629/uploads/FileUpload/3f/39b6553ea0463d3f659434d13996e6.zip" target="_blank">this file</a> and unzip it anywhere you want. I have it in my maps folder.
These are the contents of the LaunchMap.bat file:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->copy %1 ns2\maps /Y
Overview.exe %1 ns2
start NS2.exe map %2<!--c2--></div><!--ec2-->
As you can see it's not overly complicated.
Now, open Spark and go to Tools -> External Tools. Set a Title for your "Tool", I have it set to Test Map.
In Command, select your .bat file.
In Arguments, you need to put this (<b>WITH</b> quotes): "$(ItemPath)" "$(ItemFileName)"
It has to look like this.
<img src="http://i49.tinypic.com/20gzedy.jpg" border="0" class="linked-image" />
As you can see, I have a separate one that's just Install Map, it's a second batch file without the last line, so it doesn't launch NS2 again in case I have it launched already...
<b>ZIPMAP</b>
I have another "tool", it's the <a href="https://us.v-cdn.net/5019629/uploads/FileUpload/fe/0456afe1aab08a409226a730dc4475.zip" target="_blank">ZipMap</a> utility, which will make a compressed zip with your map file and the overview and set the name that you prefer. For example, you can be working on ns2_mymap_test_alpha_2012.level but want to release it as ns2_mymap (or the other way around). You can generate the zip with the map name that you want and all the files will have the correct names. The zip will automatically appear on your desktop.
This one is a little more complex as it involves 3 files, unzip all the files to a folder of your choosing, and then do the same as with the LaunchMap batch file, but in this case, you have to use ZipMap.bat.
Now for maximum awesome, you can go to Tools -> Settings and you can assign a keyboard shortcut to this new tool. So I usually press Ctrl+T when I want to test my map and I have it ready to go with a freshly generated overview :)
Hopefully this helps people :)
<ul><li><a href="https://us.v-cdn.net/5019629/uploads/FileUpload/3f/39b6553ea0463d3f659434d13996e6.zip" target="_blank">LaunchMap</a>: For quick testing. It will copy your map in the correct folder, generate the overview for your map and launch NS2 with it.</li><li><a href="https://us.v-cdn.net/5019629/uploads/FileUpload/fe/0456afe1aab08a409226a730dc4475.zip" target="_blank">ZipMap</a>: For packaging your map for distribution. It will ask for the final map name so you can have your own version control different from the main publishing one. It will generate a zip file with your level and overviews on your desktop with the specified name. Any further custom content has to be included manually.</li></ul>
<b>LAUNCHMAP</b>
Download <a href="https://us.v-cdn.net/5019629/uploads/FileUpload/3f/39b6553ea0463d3f659434d13996e6.zip" target="_blank">this file</a> and unzip it anywhere you want. I have it in my maps folder.
These are the contents of the LaunchMap.bat file:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->copy %1 ns2\maps /Y
Overview.exe %1 ns2
start NS2.exe map %2<!--c2--></div><!--ec2-->
As you can see it's not overly complicated.
Now, open Spark and go to Tools -> External Tools. Set a Title for your "Tool", I have it set to Test Map.
In Command, select your .bat file.
In Arguments, you need to put this (<b>WITH</b> quotes): "$(ItemPath)" "$(ItemFileName)"
It has to look like this.
<img src="http://i49.tinypic.com/20gzedy.jpg" border="0" class="linked-image" />
As you can see, I have a separate one that's just Install Map, it's a second batch file without the last line, so it doesn't launch NS2 again in case I have it launched already...
<b>ZIPMAP</b>
I have another "tool", it's the <a href="https://us.v-cdn.net/5019629/uploads/FileUpload/fe/0456afe1aab08a409226a730dc4475.zip" target="_blank">ZipMap</a> utility, which will make a compressed zip with your map file and the overview and set the name that you prefer. For example, you can be working on ns2_mymap_test_alpha_2012.level but want to release it as ns2_mymap (or the other way around). You can generate the zip with the map name that you want and all the files will have the correct names. The zip will automatically appear on your desktop.
This one is a little more complex as it involves 3 files, unzip all the files to a folder of your choosing, and then do the same as with the LaunchMap batch file, but in this case, you have to use ZipMap.bat.
Now for maximum awesome, you can go to Tools -> Settings and you can assign a keyboard shortcut to this new tool. So I usually press Ctrl+T when I want to test my map and I have it ready to go with a freshly generated overview :)
Hopefully this helps people :)
Comments
Mendasp for Mayor of Imagespamville.
Thanks :)
Edit: can anyone web this ? ;)
It can be anywhere, the problem you are running in to is most likely that there are spaces in the name of one of the folders in the path where it is saved. (e.g. c:\Program Files\ <---- the batch won't like that space).
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->"$(ItemPath)" $(ItemFileName)<!--c2--></div><!--ec2-->
or change the batch file so it isn't using quotes allready
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->copy %1 ns2\maps /Y
Overview.exe %1 ns2
start NS2.exe map %2<!--c2--></div><!--ec2-->
Nice Batch Mendasp!;)
<!--quoteo(post=1949141:date=Jul 5 2012, 11:50 AM:name=brechtos)--><div class='quotetop'>QUOTE (brechtos @ Jul 5 2012, 11:50 AM) <a href="index.php?act=findpost&pid=1949141"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Nice Batch Mendasp!;)<!--QuoteEnd--></div><!--QuoteEEnd-->
That's a bit of an overstatement, considering what the batch file does, hah. The only notable thing was finding out the arguments thing for the editor, which I think was because it's in the help file, somewhere.
The bat file receives the arguments enclosed in quotes this way, so they're fine, no need to have double quotes (Editor quotes + bat quotes). The problem before is that if the argument had spaces, the bat file would interpet this as more than 2 arguments, as the arguments are separated by spaces.
The way it's setup right now will execute:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->start NS2.exe map "asd df"<!--c2--></div><!--ec2-->
If you add quotes in the bat (so you have it both on the bat and in spark) you will get
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->start NS2.exe map ""asd df""<!--c2--></div><!--ec2-->
Which Spark won't know what the hell is going, in fact it returns:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Error: Map 'maps/.level' doesn't exist<!--c2--></div><!--ec2-->
You can see what it does if you open the Output Window in Spark (Window -> Output), and see how it's running. You will notice how it's already retaining the quotes passed from the arguments.
Funny how modern computer software can't even handle spaces properly :)
I've also added a new tool to this list of "tools", it's the <a href="http://www.mendasp.net/stuff/ZipMap.zip" target="_blank">ZipMap</a> utility, which will make a compressed zip with your map file and the overview and set the name that you prefer. For example, you can be working on ns2_mymap_test_alpha_2012.level but want to release it as ns2_mymap (or the other way around). You can generate the zip with the map name that you want and all the files will have the correct names. The zip will automatically appear on your desktop.
This one is a little more complex as it involves 3 files, unzip all the files to a folder of your choosing, and then do the same as with the LaunchMap batch file, but in this case, you have to use ZipMap.bat.
I'm editing the first post and including this information, maybe a new title for the thread is needed now? :P
The minimum requirements for a map to be working in Spark are:
<ul><li>Location entities enclosing your rooms</li><li>At least 2 tech point rooms (one for marines, one for aliens) -- these should also include power_point entities.</li><li>ns2_gamerules</li><li>pathing_settings</li><li>readyroom_start, if it's missing you'll spawn at map origin (0,0,0).</li><li>minimap_extents enclosing your entire map (otherwise commander mode/minimap won't work).</li></ul>
You might also want to include at least 1 commander_camera so you can test the commander view...
I see lvlname, path, other things, too?
C:\progam files (x86)\steam\steaapps\common\natural selection 2\ns2\maps\map tools\launchmap.bat
And the arguments is set up the way you said like so: "$(ItemPath)" "$(ItemFileName)"
But alas it won't start I have even tried loading one of the maps the devs made, because their maps are made properly and even then NS2 stops responding. So I would appreciate any help that would help me resolve this issue. Thank you
Sadly I don't know if there are errors NS2 just stops responding during the "starting local server" when the blue loading circle comes up. I would like to use the console to see if there are but I end up having to shut it down using task manager and yes I tried the console way of loading and it seems to work the console says it loaded the map but it never actually let's me play in the server (probably internets is needed) but when loading from the editor it crashes every time. So I was just wanting to know if I set it up correctly.
(Also they should make an offline play available but that's just an opinion)
C:\Program Files (x86)\Steam\SteamApps\common\Natural Selection 2>copy "$C:\Users\Guest\Documents\""ns2_test.level" ns2\maps /Y
$C:\Users\Guest\Documents\ns2_test.level
0 file(s) copied.
C:\Program Files (x86)\Steam\SteamApps\common\Natural Selection 2>Overview.exe "$C:\Users\Guest\Documents\""ns2_test.level" ns2
Usage: overview.exe <path\map name.level> <output dir> <optional width> <optional height> <optional info>Outputs .tga and .hmp into (output dir)\maps\overviews
C:\Program Files (x86)\Steam\SteamApps\common\Natural Selection 2>start NS2.exe map
Output completed - Normal Termination
Continued from previous post:
above I have copied the output text as you can see I am getting a syntax error