Mount&Blade Cartographer | Just my own spin-off...

Users who are viewing this thread

Hi. It's a tiny dynamic library plugin to read the Windows Registry from LuaJIT, here's the full source code, I built it myself with the script in that folder nine years ago: https://github.com/Swyter/cartographer/blob/revamp/src/lregistry.c

I use it here to auto-find the game install paths: https://github.com/Swyter/cartographer/blob/revamp/mab-registry.lua

Makes sense that some antivirus are a bit weary of it, given the weird compiler I used (TinyCC). But it looks like a false alarm to me.

Here's the changeset: https://github.com/Swyter/cartographer/commit/bf0828ce4151939d1982f838cb8863186febd98e
 
Hi.
Whenever I try running the map editor, I get this error:
luajit: cartographer.lua:1: module 'vectors' not found: no field package.preload['vectors'] no file 'C:\Program Files (x86)\LuaRocks\lua\vectors.lua' no file 'C:\Program Files (x86)\LuaRocks\lua\vectors\init.lua' no file '"c:\lua\5.3\\share\lua\5.3\vectors.lua' no file 'c:\lua\5.3\\share\lua\5.3\vectors\init.lua"' no file 'c:\lua\5.3\\lib\lua\5.3\vectors.dll' stack traceback: [C]: in function 'require' cartographer.lua:1: in main chunk [C]: ?

I tried completely uninstalling LuaRocks and Lua that I had previously, but still doesn't work. Might be a long shot, but help would be appreciated
 
Hi, sounds like you've been installing a Lua distribution like you would for Python and trying to launch Cartographer with it.

The short version is that this is a self-contained package with its own bundled version of LuaJIT.exe and vectors.lua, so you only need to double-click cartographer.cmd to launch it, as shown in the guide.


There are no library or software dependencies or anything, you only need to extract the whole thing and run it. If running cartographer.cmd throws some errors and doesn't work for you please post the logs or screenshots here.
 
Last edited:
Still isn't working sadly. Lua shouldn't be installed anywhere else now, so i'm not sure what is going on. Must've forced it somehow to try and use LuaRocks, but i'm not sure how

Here's the command window: link
 
How are you running cartographer.cmd? This is essentially telling you that vectors.lua does not exist, but if you take a look inside the .zip file it's part of the files. Are you extracting everything? Can you show a screenshot of the extracted folder?

Because otherwise here it seems like you still have a luajit.exe in your %PATH% from some other application that is launching instead of the bundled one. Press Windows key + R, write cmd then press enter, and type luajit and press enter and see what happens.

If that succeeds then you have a global LuaJIT instance. Try editing cartographer.cmd and replace @luajit with @.\luajit. That way it should pick up the local, bundled one.
 
Last edited:
Hello, I am having trouble running the editor. The mab files are having trouble fetching information from the computer files it would seem. typed in the paths to some of them, but the mab-parties won't let me do that. Do you have any suggestions?

Thanks
 
Posting your configuration and what you did would help. You shouldn't have to edit any of those Lua files. Only the configuration, as shown in the guide here:
my configuration is set as

cartographer.conf =
{
--# use \\ or / for path separators but don't even thing about single backlashes like this one: \
msysparties = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\MountBlade Warband\\Modules\\parties.py"

--# set to false if the extra comment at the right when saving parties bothers you, in case you're a neat freak
sprevcoords = true
}

I tried defining it as filename, or insering it directly into the function, but did not work either

I am also now getting a message that reads
luajit: cartographer.conf.ini:10: '}' expected (to close '{' at line 5) near 'sprevcoords'
stack traceback:
[C]: in function 'dofile'
cartographer.lua:26: in main chunk
[C]: ?
 
msysparties = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\MountBlade Warband\\Modules\\parties.py"

You are missing a comma (,) at the end of each config item, that's why it's throwing that syntax error. Make sure you only edit cartographer.conf.ini, leaving everything else as normal. I'm guessing it launched fine with the default configuration.

Also, keep in mind that it needs a module_parties.py. That thingie doesn't look like a valid module system file, and the parties.txt you see in the mod folder won't work. The .txt files get generated from the .py files, usually stored in a different folder. Without Native's or a mod's module system you won't be able to edit the settlements.

If you just want to export or edit the map surface you can replace the sample map.txt under the bundled res/mod/ folder with anything else and reopen the program. That way you don't need to create a dummy or new mod to edit that part. Works without .py files or "source code".
 
Last edited:
You are missing a comma (,) at the end of each config item, that's why it's throwing that syntax error. Make sure you only edit cartographer.conf.ini, leaving everything else as normal. I'm guessing it launched fine with the default configuration.

Also, keep in mind that it needs a module_parties.py. That thingie doesn't look like a valid module system file, and the parties.txt you see in the mod folder won't work. The .txt files get generated from the .py files, usually stored in a different folder. Without Native's or a mod's module system you won't be able to edit the settlements.

If you just want to export or edit the map surface you can replace the sample map.txt under the bundled res/mod/ folder with anything else and reopen the program. That way you don't need to create a dummy or new mod to edit that part. Works without .py files or "source code".
I tried running the code on a new folder with the warband module system. I changed the configuratio to

cartographer.conf =
{
--# use \\ or / for path separators but don't even thing about single backlashes like this one: \
msysparties = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\MountBlade Warband\\Modules\\mb_warband_module_system_1171\\Module_system 1.171\\module_parties.py",

--# set to false if the extra comment at the right when saving parties bothers you, in case you're a neat freak
sprevcoords = true
}

But the log brings out another error

Found WB installation on <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband>
Msys folder at <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171>
Module folder at <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\..\WOTS\Modules\Native>
@--start loading font xml
luajit: .\mab-font.lua:22: bad argument #1 to 'lines' (C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\..\WOTS\Modules\Native\..\..\Data\FONT_DATA.XML: No such file or directory)
stack traceback:
[C]: in function 'lines'
.\mab-font.lua:22: in function 'load'
cartographer.lua:46: in main chunk
[C]: ?
 
That means good progress, the only thing you are missing is configuring your module system (in module_info.py) to direct it to your mod folder. It's using the default one.

As you can see right now it points to C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\..\WOTS\Modules\Native, which after collapsing the relative path (..\WOTS\) ends up being C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\Modules\Native, which doesn't exist.


You want it to point to ..\..\MyCoolModFolder, make a copy of Native and there you go.

If you try running build_module.bat to compile your mod right now it won't work either. Check the beginner's guide by Lumos or the others, it should explain what to do.

As this tool basically edits the settlements in the module system (and that needs to target a mod where to spit the final text stuff) I grab the final mod path from the same place.
 
Last edited:
That means good progress, the only thing you are missing is configuring your module system (in module_info.py) to direct it to your mod folder. It's using the default one.

As you can see right now it points to C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\..\WOTS\Modules\Native, which after collapsing the relative path (..\WOTS\) ends up being C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\mb_warband_module_system_1171\Module_system 1.171\Modules\Native, which doesn't exist.


You want it to point to ..\..\MyCoolModFolder, make a copy of Native and there you go.

If you try running build_module.bat to compile your mod right now it won't work either. Check the beginner's guide by Lumos or the others, it should explain what to do.

As this tool basically edits the settlements in the module system (and that needs to target a mod where to spit the final text stuff) I grab the final mod path from the same place.
Thank you very much for all your help. It has been working perfectly. Congratulations for this amazing program! :grin:
 
"@--start loading font xml
width:1024 height:1024 padding:5
font loaded in 0.001s
@--start loading font dds
luajit: .\soil.lua:100: SOIL DDS failed
stack traceback:
[C]: in function 'error'
.\soil.lua:100: in function 'loadTexture'
.\mab-font.lua:55: in function 'load'
cartographer.lua:46: in main chunk
[C]: ?
_________________________
Oops, looks like we have a bug over there :smile:"

Im assuming a texture failed to load? but which one and why?
 
"@--start loading font xml
width:1024 height:1024 padding:5
font loaded in 0.001s
@--start loading font dds
luajit: .\soil.lua:100: SOIL DDS failed
stack traceback:
[C]: in function 'error'
.\soil.lua:100: in function 'loadTexture'
.\mab-font.lua:55: in function 'load'
cartographer.lua:46: in main chunk
[C]: ?
_________________________
Oops, looks like we have a bug over there :smile:"

Im assuming a texture failed to load? but which one and why?
I'm going to need a bit of background info. Does this happen in a vanilla cartographer folder without changing anything? i.e. it comes with a self-contained Native demo map bundled; so that should always run. 🫠

If that works fine then it may be a case of not finding the font file in your mod folder. Knowing if your mod has custom fonts or not is also helpful. Maybe it's not finding the game or mod folder, show your config and more of the log.

Please help me help you.
 
I'm going to need a bit of background info. Does this happen in a vanilla cartographer folder without changing anything? i.e. it comes with a self-contained Native demo map bundled; so that should always run. 🫠

If that works fine then it may be a case of not finding the font file in your mod folder. Knowing if your mod has custom fonts or not is also helpful. Maybe it's not finding the game or mod folder, show your config and more of the log.

Please help me help you.
vanilla works
yes the mod has custom fonts, the font_data is in Data folder and the texture in textures folder
this is the config, i want to keep what im working on secret for now so i replaced the module name with "x", also im editing this mod, it's not mine.
-- swyter's cartographer
-- for those entertaining moments when you have to configure something, oh, so l33t!

cartographer.conf =
{
--# use \\ or / for path separators but don't even thing about single backlashes like this one: \
msysparties = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\MountBlade Warband\\Modules\\x\\source\\module_parties.py",

--# set to false if the extra comment at the right when saving parties bothers you, in case you're a neat freak
sprevcoords = true
}
and this is the full log
Found WB installation on <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband>
Msys folder at <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\x\source>
Module folder at <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\x>
@--start loading font xml
width:1024 height:1024 padding:5
font loaded in 0.002s
@--start loading font dds
luajit: .\soil.lua:100: SOIL DDS failed
stack traceback:
[C]: in function 'error'
.\soil.lua:100: in function 'loadTexture'
.\mab-font.lua:55: in function 'load'
cartographer.lua:46: in main chunk
[C]: ?
_________________________
Oops, looks like we have a bug over there :)
 
Okay, the paths and everything seem fine, I would try renaming the font.dds and font_data.xml files and see if that works, that would mean that the DDS file has been saved in a weird (uncompressed?) format that the SOIL texture-loading library doesn't understand. If you can drop your DDS file here or send it via PM I can take a quick look in a hex editor. Hope that helps.
 
Okay, the paths and everything seem fine, I would try renaming the font.dds and font_data.xml files and see if that works, that would mean that the DDS file has been saved in a weird (uncompressed?) format that the SOIL texture-loading library doesn't understand. If you can drop your DDS file here or send it via PM I can take a quick look in a hex editor. Hope that helps.
renaming the xml and the dds makes it load up and makes it work for like a second before the program freezes, im sending you the dds.

edit: this is the log
Found WB installation on <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband>
Msys folder at <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\x\source>
Module folder at <C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\x>
@--start loading font xml
width:2048 height:1024 padding:5
font loaded in 0.003s
@--start loading font dds
SOIL DDS created a new texture with handle 1
@--start parsing map
ended parsing 0.193s
64008 vertex, 127006 faces
ended filling arrays 0.291s
ly:30.3248 lz:496.665009 lz wins! keeping coordinate system
@--start parsing parties
181 parties loaded... 0.002s
ground aligned in 0.227s
(i)no cache available, rebuilding displaylist
generated displaylist 0.236s
 
Last edited:
That font.dds file had an oddly empty/barebones header, which I don't think it's totally standard, and it's definitely missing some flags. The DXT5 format was okay. Some picky programs may struggle with it, I recommend saving the lossless PNG file from whatever image editor you use and try converting/compressing it with a more standards-compliant one, like NVIDIA Texture Tools or AMD Compressonator. Adding DDSCAPS_TEXTURE makes it work. Sent you the fixed file.

324144590-4057b40a-cc88-41e8-b431-dd418a1aaadf.png


About the program freezing, I was having similar issues with my AMD graphics card struggling to load a very dense Chinese map someone gave me while diagnosing issues where the mountains appeared flipped vertically when saving twice. I cut a good chunk off in Blender and reimported it and it showed up and worked (slowly). So having a lot of triangles may be the culprit. Unfortunately without more information that's all I can say about it.
 
Back
Top Bottom