Actions

Making Might and Magic maps with Trenchbroom: Difference between revisions

From MM6 Wiki

 
(71 intermediate revisions by the same user not shown)
Line 1: Line 1:
<seo title="Making Might and Magic Maps with Trenchbroom" metakeywords="Might and Magic, Trenchbroom, Making maps for Might and Magic" metadescription="Making maps for Might and Magic is a little bit tricky since it requires usage of some 3D software like Blender or 3Ds Max. To make it easier map editor can be used. MMEditor which is used to edit Might and Magic maps can import 3D models in OBJ format, that means that any program that can export such models can be used for making objects or even entire maps for the game." />
<seo title="Making Might and Magic Maps with Trenchbroom" metakeywords="Might and Magic, Trenchbroom, Making maps for Might and Magic" metadescription="Making maps for Might and Magic is a little bit tricky since it requires usage of some 3D software like Blender or 3Ds Max. To make it easier map editor can be used. MMEditor which is used to edit Might and Magic maps can import 3D models in OBJ format, that means that any program that can export such models can be used for making objects or even entire maps for the game." />


Making maps for Might and Magic is a little bit tricky since it requires usage of some 3D software like Blender or 3Ds Max. To make it easier map editor can be used. [https://github.com/GrayFace/MMExtension MMEditor] is used to edit Might and Magic maps. It can import 3D models in OBJ format. That means that any program that can export such models can be used for making objects or even entire maps for the games.
[[category: modding]]
[[category: modding]]
Making maps for Might and Magic is a little bit tricky since it requires usage of some 3D software like Blender or 3Ds Max. To make it easier map editor can be used. MMEditor which is used to edit Might and Magic maps can import 3D models in OBJ format, that means that any program that can export such models can be used for making objects or even entire maps for the game.




Line 9: Line 9:
<br />
<br />


===Setting up the editor===
==Setting up the editor==


=====Exporting textures from the game=====
To extract the textures [https://grayface.github.io/mm/#MMArchive MMArchive] can be used. The textures are stored in the '''/data/bitmaps.lod''' archive.


''PAL or palette files are not required and can be deleted after extraction.''
There are pre-made texture collections for Trenchbroom:


====Project structure====
*[https://mm6.wiki/files/mods/trenchbroom/textures/MM6_Trenchbroom.zip Might and Magic VI]
Now for Trenchbroom to find the textures a specific folder structure needs to be created
*[https://mm6.wiki/files/mods/trenchbroom/textures/MM7_Trenchbroom.zip Might and Magic VII]


It needs to look like that:
*[https://mm6.wiki/files/mods/trenchbroom/textures/Minecraft_Trenchbroom.zip Minecraft]
 
<br />
- ''Project name''
  - Bitmaps
    - ''Any folder name''
      ... (textures) ...
    - ''Any folder name''
      ... (textures) ...
    - ''Any folder name''
      ... (textures) ...
 
 
''Trenchbroom uses texture collections / packs / groups to manage sets of textures, that is why there is a need to create and additional folder in the '''Bitmaps''' directory. Structure like that allows to enable or disable folders on the maps when needed.''


Select one of depending on the game. Then extract it somewhere.


As an example the following structure will be used:
''More information on how to make a custom texture pack can be found on the [[Talk:Making Might and Magic maps with Trenchbroom|Discussion]] page.''


<pre>
===Trenchbroom configuration===
- Might and Magic Trenchbroom
By default it seems that BMP image support in Trenchbroom is not enabled. That can be solved by creating a custom game configuration file.
  - Bitmaps
    - MM6
      ...(textures)...
</pre>


[https://mm6.wiki/files/mods/trenchbroom/MM_Trenchbroom_gameconfig.zip Might and Magic game config]


 
To add this configuration: extract the ZIP file into the '''Trenchbroom/Games''' directory.
Now the textures can be placed in the MM6 directory to be further visible by the editor.
If the configuration files worked then the new entry will be visible when creating a new map:
 
However, by default it seems that BMP image support is not enabled. That can be solved by creating custom configuration file for a game that needs it.
 
 
====Trenchbroom configuration====
 
[https://mm6.wiki/files/mods/trenchbroom/MightAndMagic.zip Might and Magic game preset for Trenchbroom]
 
To add this configuration: extract the ZIP file into '''Trenchbroom/Games''' directory.
If the configuration files worked then a new entry will be visible when creating a new map:


<br />[[File:Mm6 trenchbroom select game.png|frameless|700x528px]]
<br />[[File:Mm6 trenchbroom select game.png|frameless|700x528px]]




Now Trenchbroom needs a path to the project directory, with textures, created earlier. To set it, press the '''Open preferences...''' button. And set the path for '''Might and Magic''' to the project ('''Might and Magic Trenchbroom''') folder.
Now Trenchbroom needs a path where the textures are stored. To set it, press the '''Open preferences...''' button. And set the path for '''Might and Magic''' preset to the texture pack (the folder that contains the '''textures''' directory).


<br />[[File:Mm6 trenchbroom configure engines.png|frameless|928x755px]]<br />
<br />[[File:Mm6 trenchbroom configure engines.png|frameless|928x755px]]<br />
Line 68: Line 41:
[[File:Mm6 trenchbroom adding texture group.png|alt=|right|frameless|973x973px]]
[[File:Mm6 trenchbroom adding texture group.png|alt=|right|frameless|973x973px]]


===Making a map / object===
 
After the path to textures is set Trenchbroom will be able to load all the texture collections within the directory.




Now creating new map with Might and Magic preset will be loading the project folder and the textures will be available. To proceed start a new map using Might and Magic preset.
The textures will be added once at least one texture collection is imported. Open the '''Face''' tab and in the '''Texture Collections''' section double click on any available texture collection. Once the texture collection is loaded the textures should be visible in the Texture Browser.




The textures will be available once texture collection is selected. Open the '''Face''' tab and in the '''Texture Collections''' section double click on the '''bitmaps\MM6''' collection. Once the texture collection is loaded the textures should be visible in the Texture Browser.
''From now on the process is very similar to making a custom map for Quake, so the general tutorials for Trenchbroom apply.''


==Creating maps with Trenchbroom==


From now on the process is very similar to making a custom map for Quake, so the general tutorials for Trenchbroom apply.
===Introduction===
<br />


====Limitations====
====Mapping limitations====


Might and Magic engine has its own limitations that are not present in Quake engine.
Might and Magic engine has its own limitations that are not present in Quake engine. Most of them are tied to texture mapping.


<br />
<br />
Line 91: Line 65:




None of that will be applied after the model is exported and will lead to inconsistent results between the editor and the game.
None of that will be applied after the model is exported. Importing a model like that will lead to inconsistent results between the editor and the game.
 
 
(As a workaround for all that a duplicate of the texture is usually created and altered in some editor to get a rotated / flipped / scaled version of the texture)
 


<br />To avoid some of those things untick '''Texture Lock''' and '''UV lock''' in the '''Edit''' menu:
<br />To get the most consistent results untick '''Texture Lock''' and '''UV lock''' in the '''Edit''' menu:




Line 100: Line 78:
[[File:Mm6 trenchbroom object ready.png|1899x1899px|frameless]]<br />
[[File:Mm6 trenchbroom object ready.png|1899x1899px|frameless]]<br />
<br />
<br />
====Optimizing the object with _Invisible_ texture====
[[File:Invisible .png|frame|The texture used to make the sample model. It needs to be renamed to _Invisible_ in order to work.|alt=|border]]


====Making invisible walls====


In Might and Magic engine if two model faces overlap each other they will blink / flicker and such. That effect is also known as Z-fighting. Face overlapping is very common when modelling with a Quake editor. That happens because instead of modeling with polygons directly, shapes are made using brushes / boxes.
Hiding faces is a nice way to make invisible walls and movement helpers (like ramps for example). Marking faces using texture named "_Invisible_" will ensure that the face is not visible in the game. The texture is already included in the pre-made texture pack, it is in the texture collection named '''mmeditor'''.


''<br />''
''The texture itself can be anything, the only rule is that it has to be named exactly like that. The texture can be made in any image editor and then loaded within any texture collection.''


To remove the faces they need to be marked using a texture named '''_Invisible_'''. The texture itself can be anything, the only rule is that it has to be named exactly like that. The texture can be made in any image editor and then loaded within any texture collection.
[[File:Mm6 trenchbroom object ready 2.png|frameless|1899x1899px]]


===Making outdoor maps===


It is recommended to mark all faces that are not supposed to be visible during gameplay with that texture. MMEditor will remove all the faces marked with the '''_Invisible_''' texture during import.
Since MMEditor handles making terrain that is compatible with Might and Magic out of box then making outdoor maps completely in Trenchbroom is not really necessary. Instead it may be better to just make objects one by one and then import and place them using MMEditor. The example of pipeline will be something like that:
Make a house / building in Trenchbroom -> Import in MMEditor -> Place it manually -> repeat


[[File:Mm6 trenchbroom object ready 2.png|frameless|1899x1899px]]


Faces / segments of the object that are really close to each other will blink / flicker / disappear in-game. To solve that the colliding parts can be masked using _Invisible_ texture. More information can be found in the '''Making invisible walls''' section.
===Making indoor maps===


===Export to MMEditor===
===Export to MMEditor===


Once the object is finished export the model by using '''File -> Export -> Wavefront OBJ ...'''
Once the object is finished export the model by using '''File -> Export -> Wavefront OBJ ...'''. That will export the entire map regardless of what is selected.


Doing that will create 2 files: .OBJ and .MTL
Doing that will create 2 files: .OBJ and .MTL
Line 123: Line 106:
<br />
<br />


====Altering MTL file to work with MMEditor====
==Setting up MMEditor==
For now Trenchbroom exports .MTL files without texture entries. Without them MMEditor will not be able to find the textures required by a model.


Ways to fix that:
[https://github.com/GrayFace/MMExtension MMEditor] is used for editing maps in the game. Follow the steps for installation of MMEditor, afterwards run the game once to generate the required files and directories.     
<br />
<br />


=====Manual=====
Open .MTL file and you will see a lot of lines similar to this:<pre>
newmtl MM6/CsBr128
</pre>


For MMEditor to correctly process the model the following script: [https://mm6.wiki/files/mods/trenchbroom/mtl.lua mtl.lua]


needs to be placed at the '''/Scripts/General''' directory.


Note the name after slash, that is a texture name. A texture entry looks like that:<pre>
Once the game is loaded press '''alt + F1''' and open any internal map.
map_Kd CsBr128
</pre>


 
===Importing objects (outdoor)===
'''map_Kd''' is an attribute and doesn't change, '''CsBr128''' is a texture name. Line like that needs to be added after each '''newmtl''' entry. So the final material definition would look like:
<br /><pre>
newmtl MM6/CsBr128
map_Kd CsBr128
</pre><br />
 
=====Bash script=====
[https://gist.github.com/Anerag/dccef061d24c606dce1f6c07002f0c85 mtlc.sh]
 
Automates the process described above.
 
<br />
 
====Importing the model====
   
   
To import the model click on the '''Import''' button'''.'''


[https://grayface.github.io/mm/ext/ MMEditor] is used for editing maps in the game.
Select '''Cancel''' when asked to delete models, that will keep the rest of the map intact.
 
If a map compiled by the editor crashes the solution is [https://www.celestialheavens.com/forum/10/10423?hilit=crashes&start=580 here].
 
 
 
Once the game loaded press '''alt + F1''' and open any internal map.
 
To import a model click on the '''Import''' button'''.'''
 
Select '''Cancel''' when asked to delete models, that will keep the rest of the map in tact.


If the model was created not far from the center of coordinates in Trenchbroom it will be placed somewhere around 0,0,0 coordinates in the game, which is the center of the map. The newly imported object should be there.
If the model was created not far from the center of coordinates in Trenchbroom it will be placed somewhere around 0,0,0 coordinates in the game, which is the center of the map. The newly imported object should be there.


[[File:Mm6 trenchbroom mmeditor import.png|frameless|740x740px]]
[[File:Mm6 trenchbroom mmeditor import.png|frameless|740x740px]]
Line 189: Line 140:


[[File:Mm6 trenchbroom mmeditor object selected.png|frameless|740x740px]]
[[File:Mm6 trenchbroom mmeditor object selected.png|frameless|740x740px]]


Now there are 2 options:
Now there are 2 options:
Line 202: Line 155:
[[File:Mm6 trenchbroom ingame.png|frameless|641x641px]]
[[File:Mm6 trenchbroom ingame.png|frameless|641x641px]]


===Possible enhancements===
===Importing objects (indoor)===
 
To import map geometry for indoor map just select import object (not rooms) and select the .OBJ file exported from Trenchbroom.
There are some drawbacks regarding this method:
 
 
1. The entire minimap will be revealed right away.
 
2. It can possibly result in lower performance than if importing rooms 1 by 1. Since that way the rooms are not being hidden if not visible.
====Room import====
As for now room import is a bit too convoluted since it will require a 3D modelling application like blender to merge all objects into 1 room since Trenchbroom exports each object separately.
 
==Sample maps==
 
===Minecraft===
<youtube>rBuNyAvVqfE</youtube>
 
[https://mm6.wiki/files/mods/trenchbroom/maps/Minecraft/minecraft.bitmaps.lod minecraft.bitmaps.lod] - LOD with map textures


[https://mm6.wiki/files/mods/trenchbroom/maps/Minecraft/map.dat map.dat] - MMEditor project file


The steps described above are proof of concept. The things that can be improved are:
[https://mm6.wiki/files/mods/trenchbroom/maps/Minecraft/Minecraft.map Minecraft.map] - Trenchbroom map file


*A way to merge Trenchbroom brushes without using 3D Software (merge everything on import in MMEditor for example)
Texture collection for Trenchbroom used to make this map can be found in the section above.
*Better support for texture alignment in Might and Magic (texture flipping, offsets, scaling)
*Convert existing maps to OBJ to use as a reference in the editor
*Crossplatform MTL conversion

Latest revision as of 16:09, 26 July 2020

Making maps for Might and Magic is a little bit tricky since it requires usage of some 3D software like Blender or 3Ds Max. To make it easier map editor can be used. MMEditor is used to edit Might and Magic maps. It can import 3D models in OBJ format. That means that any program that can export such models can be used for making objects or even entire maps for the games.


Trenchbroom is a map editor for Quake-based games.


Setting up the editor

There are pre-made texture collections for Trenchbroom:

Select one of depending on the game. Then extract it somewhere.

More information on how to make a custom texture pack can be found on the Discussion page.

Trenchbroom configuration

By default it seems that BMP image support in Trenchbroom is not enabled. That can be solved by creating a custom game configuration file.

Might and Magic game config

To add this configuration: extract the ZIP file into the Trenchbroom/Games directory. If the configuration files worked then the new entry will be visible when creating a new map:



Now Trenchbroom needs a path where the textures are stored. To set it, press the Open preferences... button. And set the path for Might and Magic preset to the texture pack (the folder that contains the textures directory).






After the path to textures is set Trenchbroom will be able to load all the texture collections within the directory.


The textures will be added once at least one texture collection is imported. Open the Face tab and in the Texture Collections section double click on any available texture collection. Once the texture collection is loaded the textures should be visible in the Texture Browser.


From now on the process is very similar to making a custom map for Quake, so the general tutorials for Trenchbroom apply.

Creating maps with Trenchbroom

Introduction

Mapping limitations

Might and Magic engine has its own limitations that are not present in Quake engine. Most of them are tied to texture mapping.


  • The textures can not be rotated
  • The textures can not be flipped
  • The textures can not be scaled


None of that will be applied after the model is exported. Importing a model like that will lead to inconsistent results between the editor and the game.


(As a workaround for all that a duplicate of the texture is usually created and altered in some editor to get a rotated / flipped / scaled version of the texture)



To get the most consistent results untick Texture Lock and UV lock in the Edit menu:




Making invisible walls

Hiding faces is a nice way to make invisible walls and movement helpers (like ramps for example). Marking faces using texture named "_Invisible_" will ensure that the face is not visible in the game. The texture is already included in the pre-made texture pack, it is in the texture collection named mmeditor.


The texture itself can be anything, the only rule is that it has to be named exactly like that. The texture can be made in any image editor and then loaded within any texture collection.

Making outdoor maps

Since MMEditor handles making terrain that is compatible with Might and Magic out of box then making outdoor maps completely in Trenchbroom is not really necessary. Instead it may be better to just make objects one by one and then import and place them using MMEditor. The example of pipeline will be something like that: Make a house / building in Trenchbroom -> Import in MMEditor -> Place it manually -> repeat


Faces / segments of the object that are really close to each other will blink / flicker / disappear in-game. To solve that the colliding parts can be masked using _Invisible_ texture. More information can be found in the Making invisible walls section.

Making indoor maps

Export to MMEditor

Once the object is finished export the model by using File -> Export -> Wavefront OBJ .... That will export the entire map regardless of what is selected.

Doing that will create 2 files: .OBJ and .MTL


Setting up MMEditor

MMEditor is used for editing maps in the game. Follow the steps for installation of MMEditor, afterwards run the game once to generate the required files and directories.


For MMEditor to correctly process the model the following script: mtl.lua

needs to be placed at the /Scripts/General directory.

Once the game is loaded press alt + F1 and open any internal map.

Importing objects (outdoor)

To import the model click on the Import button.

Select Cancel when asked to delete models, that will keep the rest of the map intact.

If the model was created not far from the center of coordinates in Trenchbroom it will be placed somewhere around 0,0,0 coordinates in the game, which is the center of the map. The newly imported object should be there.

Moving the object

Many building in the game are considered to be a single object by the engine. Those had many shapes merged in one using 3D software. In Trenchbroom objects are built using brushes and usually there are many brushes that constitute one object. When Trenchbroom exports a model it keeps the shapes separate. That means that the object can not be selected all at once.

To move imported object:

  1. Click on any face on the model
  2. Press the Model button
  3. Hold the Left Shift key and select the other parts



Now there are 2 options:

  • Use arrow keys + Page Up / Down to move the object around
  • Move the party to the destination and press the Move To Party button

! Note that the Land function will not help to align the object to the ground since it will align every segment individually and not the entire group.

The result:


Importing objects (indoor)

To import map geometry for indoor map just select import object (not rooms) and select the .OBJ file exported from Trenchbroom. There are some drawbacks regarding this method:


1. The entire minimap will be revealed right away.

2. It can possibly result in lower performance than if importing rooms 1 by 1. Since that way the rooms are not being hidden if not visible.

Room import

As for now room import is a bit too convoluted since it will require a 3D modelling application like blender to merge all objects into 1 room since Trenchbroom exports each object separately.

Sample maps

Minecraft

minecraft.bitmaps.lod - LOD with map textures

map.dat - MMEditor project file

Minecraft.map - Trenchbroom map file

Texture collection for Trenchbroom used to make this map can be found in the section above.