MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

The role-playing games (I-X) that started it all and the various spin-offs (including Dark Messiah).

Moderator: Moderators

kkolyan
Leprechaun
Leprechaun
Posts: 7
Joined: 12 Sep 2018

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby kkolyan » May 27 2020, 20:24

Rodril wrote:
kkolyan wrote:How MM6 stores mapping between MONSTERS.TXT entries and monster sprite images in SPRITES.LOD?

There's file "MonList.txt" in "...Data\Tables" folder, it contains entries for each monster and it's SFT group names for each kind of animation.

Thanks, this table contains exactly what I search for.

I'd like to fetch it without MMExtensions (actually I''m interested in all these tables). Could you help with information? As I understand, these tables generated by MMExtensions. Where do MMExtensions fetch them from? Are these tables are packed inside mm6.exe?
Last edited by kkolyan on May 27 2020, 22:51, edited 2 times in total.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » May 29 2020, 16:51

kkolyan wrote:I'd like to fetch it without MMExtensions (actually I''m interested in all these tables). Could you help with information? As I understand, these tables generated by MMExtensions. Where do MMExtensions fetch them from? Are these tables are packed inside mm6.exe?

Yes, dmonlist.bin. Just take it from DataFiles (where it's generated by MMExtension) and use in your mod. Upon installation the mod should delete/backup the SFT.txt from Data\Tables and dmonlist.bin from DataFiles so that it can be installed on top of MMExtension.
Last edited by GrayFace on May 29 2020, 16:55, edited 2 times in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

kkolyan
Leprechaun
Leprechaun
Posts: 7
Joined: 12 Sep 2018

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby kkolyan » May 29 2020, 22:10

GrayFace wrote:
kkolyan wrote:I'd like to fetch it without MMExtensions (actually I''m interested in all these tables). Could you help with information? As I understand, these tables generated by MMExtensions. Where do MMExtensions fetch them from? Are these tables are packed inside mm6.exe?

Yes, dmonlist.bin. Just take it from DataFiles (where it's generated by MMExtension) and use in your mod. Upon installation the mod should delete/backup the SFT.txt from Data\Tables and dmonlist.bin from DataFiles so that it can be installed on top of MMExtension.

Of course! And why I haven't realized it?) Actually your hint pushed me find the lua code in MMExtension (01 common structs.lua) that parses this binary file in pretty declarative way, so I can easily create my own parser or even embed it to my runtime using lua interpreter. I'd prefer not to include any data into my code for some reason (It will be clear why when I publish first demo :) ).

Thanks!
Last edited by kkolyan on May 29 2020, 22:10, edited 1 time in total.

User avatar
Anubis
Demon
Demon
Posts: 310
Joined: 08 Sep 2011
Location: Canada

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby Anubis » Jun 2 2020, 8:15

Question 1: I've wanted to redo the npcnames.txt file for a while and give the names a more medieval feel. However, I've noticed that I need to make sure that I have an exact number of male & female names.

Let's say I cut down the number of male names from 541 to 530. I'll start getting an issue like this: https://cdn.discordapp.com/attachments/ ... nknown.png

I'm assuming it's because the game is picking a value between 530 and 541 and no name is registered in that slot. Is there a way to change these values at all or is it hard-coded to the point that I must stay with the default number of male/female NPC names?

Question 2: Is it at all possible to sort NPC names by race? For example, we know that the first column of NPCnames.txt is for males and that the second column is for females. I'm talking about potentially making the first column for Human Males, second column for Human Females, adding a third column for Elven Males, adding a fourth column for Elven Females, etc. If so, how?
Last edited by Anubis on Jun 2 2020, 8:20, edited 3 times in total.

raekuul
Pixie
Pixie
Posts: 131
Joined: 05 Jul 2019

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby raekuul » Jun 2 2020, 10:57

You'd need to do that by hand EDIT: Wait, never mind, I thought you were referring to the creatures table.
Last edited by raekuul on Jun 2 2020, 20:56, edited 1 time in total.
You need to install the base mod first, and then install the latest GrayFace patch on top of that.

cthscr
Pixie
Pixie
Posts: 112
Joined: 12 Jan 2020

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby cthscr » Jun 4 2020, 18:40

Anubis wrote:Question 1: I've wanted to redo the npcnames.txt file for a while and give the names a more medieval feel. However, I've noticed that I need to make sure that I have an exact number of male & female names.

Let's say I cut down the number of male names from 541 to 530. I'll start getting an issue like this: https://cdn.discordapp.com/attachments/ ... nknown.png

I'm assuming it's because the game is picking a value between 530 and 541 and no name is registered in that slot. Is there a way to change these values at all or is it hard-coded to the point that I must stay with the default number of male/female NPC names?

Question 2: Is it at all possible to sort NPC names by race? For example, we know that the first column of NPCnames.txt is for males and that the second column is for females. I'm talking about potentially making the first column for Human Males, second column for Human Females, adding a third column for Elven Males, adding a fourth column for Elven Females, etc. If so, how?

In both cases you have to patch *.exe code, I'm afraid.

cthscr
Pixie
Pixie
Posts: 112
Joined: 12 Jan 2020

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby cthscr » Jun 5 2020, 14:42

const.Screens.MainManu
const.Season (0) should be Spring. const.Season (2) - either Autumn (British) or Fall (American).
const.FaceAnimation (75) is something like ShopItemBought
Player.SpellBookPage is u1 in MM8 rather than i4 (Rodril's catch)
Mouse:AddItem(item_ptr) [or item table, whatever] causes crash. However 'mem.call(0x491A27, 1, 0xB20E90, item_ptr)' works fine for me.

Points of interest:
mem.call(0x424D5B, 1, num) - Adds num experience to Party, distributing [equally] between party players with subsequent multiply by learning bonuses.

0xFFD408 (probably i4) - in-house NPC current subscreen
  • 1 - Main
  • 2 - Buy Standard
  • 3 - Sell
  • 4 - Identify
  • 5 - Repair
  • 94 - Display Inventory
  • 95 - Buy Special
  • 96 - Learn Skills
  • 110 - Fire Magic
  • 111 - Air Magic
  • 112 - Water Magic
  • 113 - Earth Magic
  • 114 - Spirit magic
  • 115 - Mind Magic
  • 116 - Body Magic

Questions:
Is there info on mem.call arguments (specifically the second one - 0 is "all onto stack", 1 is "first into ecx, following - onto stack", what about others)?
Is there info on Actions somewhere?
I'm in a hook on middle of Action 81 (something like "left click on item in shop") procedure that have three pops at the end. How can I force exit from the house? (Right now I did it with events.Action, [conditionally] checking for CurrentScreen == 0xD and overwriting action with action 113 - taking an idea from Rodril's hack. This requires additional action by user to be done.)

User avatar
Anubis
Demon
Demon
Posts: 310
Joined: 08 Sep 2011
Location: Canada

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby Anubis » Jun 6 2020, 3:07

@cthscr I appreciate the responses to my questions(s) in this thread & the other one. That helps a ton. Thanks.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » Jun 6 2020, 9:02

cthscr wrote:Is there info on mem.call arguments (specifically the second one - 0 is "all onto stack", 1 is "first into ecx, following - onto stack", what about others)?

Yes,
0 - stdcall or cdecl (stack)
1 - thiscall (ecx, stack)
2 - fastcall (ecx, edx, stack)
3 - just for completeness (ecx, edx, eax, stack) - probably not included in the version used in MMMerge

cthscr wrote:Is there info on Actions somewhere?

The easiest way to find out is to log it:

Code: Select all

events.Action = |t| print(dump(t))

Then trigger the needed action. There's a big procedure dealing with all the actions, looking at it is another option.

Thanks for error reports.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

cthscr
Pixie
Pixie
Posts: 112
Joined: 12 Jan 2020

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby cthscr » Jun 6 2020, 17:27

GrayFace wrote:
cthscr wrote:Is there info on Actions somewhere?

The easiest way to find out is to log it:

Code: Select all

events.Action = |t| print(dump(t))

Then trigger the needed action. There's a big procedure dealing with all the actions, looking at it is another option.

Oh, I'm already logging them. Problem is two actions 113 are used to quit from subscreen. And I'm unable to do two actions at once [at least yet]. Looks like action 113 supposes to clear actions queue if Param2 is 0. Setting it to something else won't help though.

And speaking about errors - there is nasty one with Debug Console [losing focus]: https://gitlab.com/templayer/mmmerge/-/issues/669

User avatar
Vinevi
Leprechaun
Leprechaun
Posts: 35
Joined: 17 Jul 2017

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby Vinevi » Jun 7 2020, 17:34

Hello! There is now a guide on how to use Trenchbroom to make geometry for Might and Magic maps. There are some possible enhancements on the side of MMEditor which will make the process more streamlined. It would be really nice if those tools could work together smoothly.

https://mm6.wiki/w/Making_Might_and_Magic_maps_with_Trenchbroom
Last edited by Vinevi on Jun 7 2020, 17:35, edited 1 time in total.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » Jun 10 2020, 16:35

cthscr wrote:Oh, I'm already logging them. Problem is two actions 113 are used to quit from subscreen. And I'm unable to do two actions at once [at least yet]. Looks like action 113 supposes to clear actions queue if Param2 is 0. Setting it to something else won't help though.

There's a function for exiting a single house screen: mem.call(mmv(0x4A4AA0, 0x4BD818, 0x4BB3F8), 0) (or Game.ExitHouseScreen() in current version from Github). You can exit all house screens like this:

Code: Select all

while mem.call(mmv(0x4A4AA0, 0x4BD818, 0x4BB3F8), 0) ~= 0 do
end
-- then add action 133 which would close house dialog properly

Also note the ability to call the function that processes actions like this: mem.call(mmv(0x42ADA0, 0x4304D6, 0x42EDD8), 0)
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » Jun 10 2020, 16:51

Vinevi wrote:Hello! There is now a guide on how to use Trenchbroom to make geometry for Might and Magic maps. There are some possible enhancements on the side of MMEditor which will make the process more streamlined. It would be really nice if those tools could work together smoothly.

https://mm6.wiki/w/Making_Might_and_Magic_maps_with_Trenchbroom

Cool! The step with invisible textures can be done better by importing the model into 3D software and using the function that would join the elements and remove these facets altogether (I don't remember how vladimir maestro called that function). I know in original Quake maps all facets that couldn't possibly be seen were removed too.
I can help with "Convert existing maps to OBJ to use as a reference in the editor" step, with MTL and also look into the Land command problem. As for texture rotation/scaling and flipping, I was considering it at some point, but it probably won't happen. Offsets are supported, of course.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » Jun 12 2020, 10:36

I've done an editor update for this Trenchbroom process at https://github.com/GrayFace/MMExtension
This will export all maps as .obj:

Code: Select all

BatchExport()

This will make import use texture name without the need to alter .mtl (save it as a Lua script in Global or General folder):

Code: Select all

events.EditorImportMissingTexture = function(s)
  return path.name(s)
end
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Vinevi
Leprechaun
Leprechaun
Posts: 35
Joined: 17 Jul 2017

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby Vinevi » Jun 13 2020, 16:41

The new .mtl feature works great!

Vertical offsets
I was exploring on how the game interprets vertical texture offsets and I am trying to figure out this behavior:
https://i.imgur.com/g0eCs8Y.png
Can it be limitation of the engine or it's just 2 engines interpreting offsets in a different way?

Before that Trenchbroom was exporting mirrored textures, because I didn't set the proper map preset (there is Standard / Quake 2 / Valve) and texture mapping differs between them as I understand. But now horizontal offsets seem to work correctly.

GrayFace wrote:Cool! The step with invisible textures can be done better by importing the model into 3D software and using the function that would join the elements and remove these facets altogether (I don't remember how vladimir maestro called that function). I know in original Quake maps all facets that couldn't possibly be seen were removed too.


For me the goal is to completely remove 3D software from the process. Mainly due to import / export making everything much more complicated.
Quake games use the exact the same approach for removing unnecessary geometry, it's just named differently - Skip, instead of _Invisible_. Everything marked with Skip gets removed during BSP compilation step, so it is really convenient as is.

Map references

I've also tried to convert the New Sorpigal map to a Quake .map, but if I try to export the entire thing blender just freezes, assumingly because of the highly detailed terrain.
Here's the converter: https://github.com/c-d-a/io_export_qmap
It seems to work great with indoor maps.. Maybe I just need to give it more time.

Object groups

Trenchbroom assigns the same prefix to the brushes that belong to the same group or map layer. That prefix can be used to group object when importing models into MMEditor. Best case scenario is room import, since for now it wouldn't work because each object will be treated as a separate room.

Here's what it looks like:
https://i.imgur.com/BuTT9HR.png

---

By the way are MMEditor and MMExtension merged now? Since both readme and the files from MMEditor are in the repository. If so I'll just keep the link to the repository instead of the github.io page.
Last edited by Vinevi on Jun 14 2020, 10:20, edited 14 times in total.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » Jun 15 2020, 11:05

Vinevi wrote:Vertical offsets
I was exploring on how the game interprets vertical texture offsets and I am trying to figure out this behavior:
https://i.imgur.com/g0eCs8Y.png
Can it be limitation of the engine or it's just 2 engines interpreting offsets in a different way?

Either a bug in Trenchbroom export to OBJ or in MMEditor import of OBJ.

On sloped surfaces you'll probably see differences too. MM stretches textures on nearly vertical walls vertically.

Vinevi wrote:For me the goal is to completely remove 3D software from the process. Mainly due to import / export making everything much more complicated.
Quake games use the exact the same approach for removing unnecessary geometry, it's just named differently - Skip, instead of _Invisible_. Everything marked with Skip gets removed during BSP compilation step, so it is really convenient as is.

No, _Invisible_ only makes the facet invisible. It's still included and stays solid. Rather than marking invisible textures I still think it'd be easy enough to once run the thing through 3D software on release. It's only for software mode, in D3D rendering mode it doesn't matter.

Vinevi wrote:Map references

I've also tried to convert the New Sorpigal map to a Quake .map, but if I try to export the entire thing blender just freezes, assumingly because of the highly detailed terrain.
Here's the converter: https://github.com/c-d-a/io_export_qmap
It seems to work great with indoor maps.. Maybe I just need to give it more time.

What if you delete the terrain?

Vinevi wrote:Object groups

Trenchbroom assigns the same prefix to the brushes that belong to the same group or map layer. That prefix can be used to group object when importing models into MMEditor. Best case scenario is room import, since for now it wouldn't work because each object will be treated as a separate room.

Here's what it looks like:
https://i.imgur.com/BuTT9HR.png

What does it mean for MMEditor?

Vinevi wrote:By the way are MMEditor and MMExtension merged now? Since both readme and the files from MMEditor are in the repository. If so I'll just keep the link to the repository instead of the github.io page.

Yes they are. They'll still be separate downloads, because MMEditor doesn't have to be included into mods, but the version number would be the same across them.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Vinevi
Leprechaun
Leprechaun
Posts: 35
Joined: 17 Jul 2017

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby Vinevi » Jun 15 2020, 19:16

GrayFace wrote:What does it mean for MMEditor?

Trenchbroom exports objects as a set of segments / brushes. That means that room import will not work since every wall will be considered a separate room. It also makes it difficult to move complex objects after import. Merging things together using some software as additional step will make the whole process much slower since it will be required to do that on every iteration. However Trenchbroom allows to group objects together or place them on different map layers and will add the same prefix to the objects belonging to the same group or layer. That data can be used to implement grouping in MMEditor and make the process of mapping and testing much simpler since there will be no need to open the exported object in some 3D editor to merge brushes together.

GrayFace wrote:What if you delete the terrain?

It did export a single building. I didn't really try to export without terrain, since it's the main goal to get it converted. It can be used to help modelling objects that are influenced by terrain in some way, such as bridges for example.
Last edited by Vinevi on Jun 15 2020, 19:23, edited 6 times in total.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » Jun 18 2020, 8:17

Vinevi wrote:
GrayFace wrote:What does it mean for MMEditor?

Trenchbroom exports objects as a set of segments / brushes. That means that room import will not work since every wall will be considered a separate room.

As it stands for now, rooms generation is a problematic step in any workflow, you also need to create portals at the same time. Quake does use portals and rooms, so I wonder if output from its BSP generation step could be used.

Vinevi wrote:It also makes it difficult to move complex objects after import.

One way to deal with this would be to import each building individually, but I see that you'd prefer to edit whole maps in Trench. Well, I can certainly make the editor use prefixes instead of groups.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.

User avatar
Vinevi
Leprechaun
Leprechaun
Posts: 35
Joined: 17 Jul 2017

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby Vinevi » Jun 22 2020, 19:03

GrayFace wrote:As it stands for now, rooms generation is a problematic step in any workflow, you also need to create portals at the same time. Quake does use portals and rooms, so I wonder if output from its BSP generation step could be used.

Will it be sufficient to just mark all room entrances with box shapes to make it work? Or there is a set of rules for it to work correctly? As I understand it is probably not as strict as in Quake since there are no visibility or light calculation stages. If that is enough then it could probably be done by just marking all portal objects with some specific material. Or something like "Import portals" feature which will expect an .OBJ file containing all the portals for the map.
GrayFace wrote:One way to deal with this would be to import each building individually, but I see that you'd prefer to edit whole maps in Trench. Well, I can certainly make the editor use prefixes instead of groups.

Importing buildings one by one will work great for outdoor maps! But for indoor parts it would be really nice to be able to import the entire thing since workflow regarding them is a bit different due to not having any terrain.
Last edited by Vinevi on Jun 22 2020, 19:04, edited 2 times in total.

User avatar
GrayFace
Round Table Hero
Round Table Hero
Posts: 1521
Joined: 29 Nov 2005

Re: MMExtension v2.2 + MMEditor v2.1 Level Editor [June 4, 2019]

Postby GrayFace » Jun 22 2020, 23:28

Vinevi wrote:
GrayFace wrote:As it stands for now, rooms generation is a problematic step in any workflow, you also need to create portals at the same time. Quake does use portals and rooms, so I wonder if output from its BSP generation step could be used.

Will it be sufficient to just mark all room entrances with box shapes to make it work? Or there is a set of rules for it to work correctly? As I understand it is probably not as strict as in Quake since there are no visibility or light calculation stages. If that is enough then it could probably be done by just marking all portal objects with some specific material. Or something like "Import portals" feature which will expect an .OBJ file containing all the portals for the map.

Definitely not. A portal is a facet that belongs to one of the rooms and neatly fits the hole in another room. MMEditor doesn't create the rooms by itself based on portals either, it's lazy and offloads that process onto you. Which is why Quake editor/(or BSP builder if it's separate) is appealing, because it should do these things. Though, making it do these things is something I'd like to implement, but I don't know when. Denoting portals with boxes is an interesting idea! Assuming these boxes include only those vertices that need to be turned into the portal facet.

Vinevi wrote:Importing buildings one by one will work great for outdoor maps!

In case you don't know, to do so you need to select the Model button and then press Type. I can also implement batch export of buildings from standard maps as OBJ files.
Last edited by GrayFace on Jun 22 2020, 23:34, edited 1 time in total.
My patches: MM6 MM7 MM8. MMExtension. Tools. Also, I love Knytt Stories and Knytt Underground. I'm also known as sergroj.


Return to “Might and Magic”

Who is online

Users browsing this forum: deadreak, Google [Bot] and 16 guests