project-navigation
Personal tools

Author Topic: New Batch file for maps on Windows  (Read 7161 times)

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
New Batch file for maps on Windows
« on: January 04, 2009, 05:27:45 pm »
I used to write batch files all the time, but it has been so long - Anyways, I put together a quick and dirty batch file, starting with a copy of the .bat file used to compile maps on Windows:


delete_maps.bat
Code: [Select]
@echo off
setlocal
rem setlocal ensures implicit endlocal call howevert batch exits.
rem so we can goto :EOF  or ctrl-c an at point and env variables
rem and directory will be reset

pushd ..\..

echo This batch file will delete all compiled maps!

echo Press CTRL-C to abort, or
pause

echo Deleting all compiled maps...

@echo on
@del /q /f /s base\maps\*.bsp
@echo off

pause

Here is why I put this together, and what it is useful for:

I've found through updating a working SVN copy and re-compiling everything that sometimes ufo2map.exe is updated with fixes and therefore all the maps are then out-of-date and will not have the fixes unless they are all compiled.  After running this new batch file, I can run the compile_maps.bat file but interrupt the map compiling if I need that machine to work on something else for a while, and then click on the compile_maps.bat file again so it will pick up where it left off.
By comparison, if I simply run compile_maps.bat with the "/clean" switch, it starts over with re-compiling the maps, meaning even if I had let it run for two hours first and it was almost done but I had to stop it to use the computer for something else, running compile_maps.bat again with the /clean switch would mean waiting another several hours instead of it simply finishing the last maps.
If this new batch file is run first, before committing to re-compiling all the maps, then compile_maps.bat can be run without any special switches, interrupted, and then pick up where it left off if run again.

This might sound complex at first, but in short it allows someone to re-compile all the maps in sections instead of all at once, so if someone updates ufo2map.exe with their SVN copy, they can start re-compiling while eating a meal, etc., but use the computer for something else afterward and continue re-compiling again the next time they step away from their machine.

This avoids having a computer tied-up for hours while re-compiling all the maps, if someone wants to use the machine for something else for a while, and break up the re-compiling into sections.

I admit this new file might not be the best solution for this scenario, but what do you guys think?

P.S. - I tested this, and yes, it works as it is coded presently.  Use it with caution!
« Last Edit: January 04, 2009, 05:29:18 pm by Destructavator »

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: New Batch file for maps on Windows
« Reply #1 on: January 04, 2009, 10:17:46 pm »
Do you have such a slow machine?
try to run the script with
start /low cyz.bat
any childprocess should came up on low priority than

Compiling inside my VM (VMware) took much longer
but on my real machine AMD x2 2GHZ its a fast job

ziping all those maps took a while
but you can add the -mmt switch for 7z to speed it up
if you own a dualcore++

I've merged all those batch files into one
added some more functions
even if you start from scratch the script points you to the right direction
including error checking
A fire and forget script
end up with those NSIS installer

make_win32.cmd
place it into root (configure, install-sh ....) of ufoai svn

PS: A strange thing is that my build (ufo.exe) wants a libfreetype-6.dll

[attachment deleted by admin]
« Last Edit: January 08, 2009, 09:52:59 pm by Muton »

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
Re: New Batch file for maps on Windows
« Reply #2 on: January 04, 2009, 10:48:14 pm »
Nice...  8)

I'll try this out and see how it works with my SVN copy.

I'll also give the additional library patch another shot (Just downloaded that too) and see if I can make the next installer I upload compatible with W2K.

Part of the reason I wanted to be able to compile the maps parts at a time is that I run a lot of video and music software apps that really need exclusive resources - I have a powerful multi-core machine, yes, but I really can't have anything doing unrelated stuff in the background, it would just screw things up big-time.  Another reason is that these various software apps are spread across multiple partitions each with its own installation of Windows, so if I wanted to take a break with making music for example, I have to re-boot the machine to do something else.  Needless to say, this would interrupt the map-compiling.

I also thought it would be a good idea to be able to break it up for other people who have a shared computer (family, kids, etc.) so that the machine wouldn't be tied up making maps for a while and have to start all over if interrupted.

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: New Batch file for maps on Windows
« Reply #3 on: January 06, 2009, 12:11:34 pm »
fixed some bugs

Offline Wizard^^

  • Rookie
  • ***
  • Posts: 22
    • View Profile
Re: New Batch file for maps on Windows
« Reply #4 on: January 08, 2009, 11:08:40 am »
Tried your make_win32.cmd and got
Code: [Select]
search for codeblocks.exe inside your Path variable
seach in E:\Coding\Codeblocks\MinGW\bin
seach in E:\Coding\Codeblocks\MinGW\lib
seach in E:\Coding\Codeblocks\MinGW\include
seach in E:\Coding\Codeblocks\MinGW\include\SDL
seach in E:\Coding\Codeblocks
found at E:\Coding\Codeblocks
\Quicktime was unexpected at this time.

this is my full path list
Code: [Select]
PATH=E:\Coding\Codeblocks\MinGW\bin;E:\Coding\Codeblocks\MinGW\lib;
E:\Coding\Codeblocks\MinGW\include;E:\Coding\Codeblocks\MinGW\include\SDL;
E:\Coding\Codeblocks;C:\PROGRA~2\COMMON~1\GTK\2.0\bin;C:\WINDOWS\system32;
C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files (x86)\QuickTime Alternative\QTSystem\;
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\TortoiseSVN\bin;
C:\Program Files\TortoiseSVN\bin

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: New Batch file for maps on Windows
« Reply #5 on: January 08, 2009, 10:02:45 pm »
MS is so stupid x86 will do the same job
but (x86) is the pure horror inside cmd.exe

I've fixed that problem (work around)
added some new switches
Code: [Select]
@echo   /waitmaps  the script waits for userinput before continuing the buildscript
@echo              useful if you build inside a VirtualMachine
@echo   /makemapsonly the script compiles only maps
@echo                 useful if you build inside a VirtualMachine and use there /waitmaps
@echo   /waitpk3   the script waits for userinput before continuing the buildscript
@echo              useful if you build inside a VirualMchine
@echo   /makepk3only the script compiles only pk3 files
@echo                useful if you build inside a VirtualMachine and use there /waitpk3

removed some bugs
added build and rev number (if TortoiseSVN is used)

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: New Batch file for maps on Windows
« Reply #6 on: January 17, 2009, 06:26:18 pm »
A new version of my cmd
I've added this commands into it

Code: [Select]
  /make7z    you build a 7z file instead of pk3
             pk3 files will be build on the user system during installation
             It reduce filesize by 1/3
             but use enormous ammount of ram during build (1GB)
             cmd tool fsutil will be needed to use /make7z
  /full      a complete install will be build
  /diff      only a differential install will be build
             much smaller download 'couse only different files (pk3 inventory)
             will be added into the install
  /small     a samll install will be build
             no source and no mapediting tools are included

extract the zip into root (configure, install-sh ....) of ufoai svn
the file fsutil.exe must be stored at %systemroot%\system32
On XP this file should already be present.

========================

a small update
now checking for modifications on some files
src\ports\windows\installer.nsi
contrib\scripts\are_maps_compiled.bat
contrib\scripts\compile_maps.bat
contrib\scripts\compile_po.bat
contrib\scripts\update_potfiles_in.bat
base\archives.bat

and this switches for C::B decrease compiletime for mapbuild
build\projects\ufo2map.cbp
Code: [Select]
<Option compiler="gcc" />
<Compiler>
<Add option="-march=i686" />
<Add option="-fexpensive-optimizations" />
<Add option="-O3" />

'couse of compiler errors during po file compiling
i've added a loop to prevent a complete recompile

[attachment deleted by admin]
« Last Edit: January 22, 2009, 06:05:28 pm by Muton »

Offline Wizard^^

  • Rookie
  • ***
  • Posts: 22
    • View Profile
Re: New Batch file for maps on Windows
« Reply #7 on: March 07, 2009, 11:09:21 am »
To Muton

Great script but would like to know if it could log its output?
Also I keep getting "You'r system is low on Diskspace" how does it work this out???

As you can see I have lots of space on E: and C:
And now I'm missing something.. http://www.cleanourseas.org/other/log.txt

Please help..

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: New Batch file for maps on Windows
« Reply #8 on: March 07, 2009, 08:23:48 pm »
Great script but would like to know if it could log its output?

redirect output
V:\MinGW\ufoai\make_win32.cmd /onlynewer /make7z /diff /small >>V:\MinGW\ufoai\build.log


Quote
Also I keep getting "You'r system is low on Diskspace" how does it work this out???
please run
dir c:\* /A:D /-C /D
an past the last lines in here

I take the 3rd token from the last line to get free diskspace
Code: [Select]
......
               0 File(s)              0 bytes
              12 Dir(s)        99631104 bytes free
« Last Edit: March 07, 2009, 08:25:56 pm by Muton »

Offline Wizard^^

  • Rookie
  • ***
  • Posts: 22
    • View Profile
Re: New Batch file for maps on Windows
« Reply #9 on: March 11, 2009, 02:45:25 pm »
Ok thats an easy way to log it.

here are the last 2 lines.
Code: [Select]
               0 File(s)              0 bytes
               9 Dir(s)      6399270912 bytes free

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: New Batch file for maps on Windows
« Reply #10 on: March 11, 2009, 07:17:54 pm »
> Also I keep getting "You'r system is low on Diskspace" how does it work this out???
fixed

I've added somthing new too
more info here
http://ufoai.ninex.info/forum/index.php?topic=2830.msg23805#msg23805

[attachment deleted by admin]