One click map testing within Spark

MendaspMendasp 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
edited August 2013 in Mapping
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 :)
«13

Comments

  • SkieSkie Skulk Progenitor Join Date: 2003-10-18 Member: 21766Members, NS2 Playtester, Reinforced - Shadow
    Cool, thanks.
    Mendasp for Mayor of Imagespamville.
  • FunkyFungusFunkyFungus Join Date: 2003-09-09 Member: 20691Members
    edited July 2012
    Nice !!!




    Thanks :)


    Edit: can anyone web this ? ;)
  • AngeluszAngelusz Harmonic entropist Join Date: 2003-07-10 Member: 18072Members, Forum Moderators, Constellation, NS2 Playtester
    Cheers Mendasp, stickied for awesomeness! :)
  • AngeluszAngelusz Harmonic entropist Join Date: 2003-07-10 Member: 18072Members, Forum Moderators, Constellation, NS2 Playtester
    Question! Where must the map file be saved for the editor to pick it up? I've got a custom filepath and it doesn't work.
  • IndustryIndustry Esteemed Gentleman Join Date: 2010-07-13 Member: 72344Members, Reinforced - Shadow, WC 2013 - Supporter
    <!--quoteo(post=1948852:date=Jul 4 2012, 06:32 AM:name=Angelusz)--><div class='quotetop'>QUOTE (Angelusz @ Jul 4 2012, 06:32 AM) <a href="index.php?act=findpost&pid=1948852"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Question! Where must the map file be saved for the editor to pick it up? I've got a custom filepath and it doesn't work.<!--QuoteEnd--></div><!--QuoteEEnd-->

    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).
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    edited July 2012
    Yeah, I just took a look at the problem and it's simple to solve, you have to enclose the arguments in External Tools in quotes. I'm updating the first post to reflect this.
  • brechtosbrechtos Belgium Join Date: 2008-04-18 Member: 64100Members, Reinforced - Gold
    In order for it to launch the actual level you need to either leave the quotes in the arguments:

    <!--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!;)
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    edited July 2012
    I'm not sure why it has quotes there, considering the copy I use which is slightly different doesn't use them... so I'm gonna opt for dropping the quotes in the bat. Thanks for letting me know :P

    <!--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.
  • remiremi remedy [blu.knight] Join Date: 2003-11-18 Member: 23112Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester
    You actually need the quotes in both places to ensure that it works even if the map's path includes spaces. (Otherwise it gets confused about what the second argument is)
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    edited July 2012
    <!--quoteo(post=1950241:date=Jul 10 2012, 04:58 AM:name=Psyke)--><div class='quotetop'>QUOTE (Psyke @ Jul 10 2012, 04:58 AM) <a href="index.php?act=findpost&pid=1950241"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->You actually need the quotes in both places to ensure that it works even if the map's path includes spaces. (Otherwise it gets confused about what the second argument is)<!--QuoteEnd--></div><!--QuoteEEnd-->
    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.
  • YuukiYuuki Join Date: 2010-11-20 Member: 75079Members
    Doesn't work for me, doesn't even copy the map.
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    Could you give more details? Path where your map is stored? Output (Window->Output), how you set it up in the External Tools section.
  • YuukiYuuki Join Date: 2010-11-20 Member: 75079Members
    Ok, it works, now, there was a space into the path of my bat file.

    Funny how modern computer software can't even handle spaces properly :)
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    edited July 2012
    I have included InstallMap.bat to the LaunchMap zip file in the first post.

    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
  • MoochieMoochie Join Date: 2011-10-18 Member: 128058Members
    What do I need in my map for me to use this? Launch map and everything seems to work but when I get into the game my whole screen is black and just says the build version at the top left.
  • AzaralAzaral Join Date: 2012-11-19 Member: 172408Members
    Link for download isn't working. What exactly do I have to have in my map in order to actually launch and run around in it?
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    edited January 2013
    Sorry, my site was down (DNS changed -- it needs some time before the change propagates), it should be working again shortly.

    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...
  • PandademicPandademic Join Date: 2013-02-26 Member: 183359Members
    Just tried this, it's absurdly helpful getting started. Thank you!
  • ApdorApdor Join Date: 2013-03-06 Member: 183735Members
  • JimWestJimWest Join Date: 2010-01-03 Member: 69865Members, Reinforced - Silver
    What arguments can you get from the spark editor?
    I see lvlname, path, other things, too?
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    If you go to Tools -> External tools you can see them by clicking on the ">" button on arguments, it lists: item path, item directory, item file name and item extension.
  • DoomToasterDoomToaster Join Date: 2013-04-03 Member: 184619Members
    Hi, this is my first post but I need to know if I set everything up right. First let me say that when I try to test my map NS2 stops responding, I had a conclusion that it is probably from a lack of interwebs, but I'm not sure. My file path to the Launchmap.bat is thus:

    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
  • PandademicPandademic Join Date: 2013-02-26 Member: 183359Members
    @doomtoaster Do you get errors in the console while the map attempts to load? When does it freeze? Can you load the map manually (enter console in game and type "map ns2_x), without using launchmap?
  • DoomToasterDoomToaster Join Date: 2013-04-03 Member: 184619Members
    Pandademic wrote: »
    @doomtoaster Do you get errors in the console while the map attempts to load? When does it freeze? Can you load the map manually (enter console in game and type "map ns2_x), without using launchmap?

    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)
  • MendaspMendasp I touch maps in inappropriate places Valencia, 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
    Yes, internet connection is required to test maps.
  • DoomToasterDoomToaster Join Date: 2013-04-03 Member: 184619Members
    Yeah I found out when I went to friends house and used his internet. It works now so at least I did set it up correctly.
  • 2d0x2d0x Join Date: 2013-03-16 Member: 184030Members, Reinforced - Supporter
    thanks for LaunchMap :)
  • diry1996diry1996 Join Date: 2013-07-04 Member: 185920Members
    I could use some help as well. I installed the launch map tool, but it only launches ns2. It only places me at the main menu screen.
  • diry1996diry1996 Join Date: 2013-07-04 Member: 185920Members
    The filename, directory name, or volume label syntax is incorrect.
    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
  • QwiXXeRQwiXXeR Join Date: 2004-11-05 Member: 32640Members
    Looks like an issue with your Quotes. Mind giving us a screenshot of your external tools and a paste from whats in your bat file :)
Sign In or Register to comment.