Author Topic: Modding Expeditions (KF)  (Read 45995 times)

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #50 on: July 23, 2018, 10:52:16 pm »
I recall someone's recounting that the dialogue TIMs were copy-protected. I guess that the program in the game expects them to match a checksum, but they are stored unprotected. Have you tried to modify them?

Have you found anything linking the models to their textures? I think I have a program for converting TMD to SOM's formats. Do you have anything that generates plain TMD files?

P.S. I think you ought to keep the attachments on the first post up-to-date. And replace TScan with Psycpros if you don't believe in it. But for heaven's sake fix that GPU spin bug in it. If I don't find something to do with myself soon I'm going to have figure out a new project to undertake.

Off-topic: SOM actually has MIDI support. I wonder if it's possible to convert the music into MDI files. I reckon that the CD quality soundtrack will just be used by the SOM ported version.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #51 on: July 23, 2018, 11:38:51 pm »
So... looking at your new KF2US.CT file, it seems to me that Cheat Engine is inadequate for this. I think if you're going to keep using swordofmoonlight.com for this, then we need to break this up into more than one forum thread, in an appropriate forum. I would prefer a different venue. But this is your initiative.

Have you discovered item locations, etc. in any of the data files? If not, what is the width of the records, that you have for Objects and Entities in your CE table? And do you know if these records are static? Or do they get filled out with things as they appear?

If static, then the best way to get the coordinates out is to dump the memory, and run it through a little program to convert the fixed-point numbers, etc. into text. Then we can post tables online, and use those to resurrect these maps in SOM.

The workflow will be to enter a map, and dump its memory, etc. Unless you know where there data is in the data files?

P.S. I'm eager to have as much data as possible. I would like to have the models in front of me if possible, so I can begin collating them. And we can dump the tilings also while we're at it.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #52 on: July 25, 2018, 06:26:23 pm »
I've GIT Cloned your C# Psycpros... I think I require more functionality than this before "extracting" however I stopped at the SHBrowseForFolder dialog. (Also it crashed when I canceled it.) I think that there is a way to configure it to have an address bar.... but if you can't get it to have an address bar, just don't use this thing, because it's a humiliating experience to click through a tree like this just to do a task!

I don't know why Microsoft keeps it around. It's so preposterous. We're no longer in the days of DOS working out of our C volumes. If you can't copy a path into it, find another way. Maybe the address bar just shows the current selection. I can't remember.

EDITED: One simple solution is to initialize the dialog to the folder with the T file. At least that will likely get closer to a project folder.

P.S. For SOM_MAIN I replaced its SHBrowseForFolder dialog with the GetOpenFileName dialog, with some tweaks that makes it work for directories. Part of it is giving it a nonsense filter like *.qqqqqqqqqqqqqqqqqqqqqqqqq and probably some simple hooking to handle the OK button with an empty selection so that it will accept the opened or selected Folder.
« Last Edit: July 25, 2018, 06:35:45 pm by Holy_Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #53 on: July 27, 2018, 12:00:58 am »
Quote
ITEM.T:
Has some regular TIM files for item description text.

I looked in FDAT.T and didn't find any items. I found this TMD (pictured) in ITEM.T which looks like the last map in the game, although I remember it looking more like SOM's version of this item... I doubt this is an alternative/unused variation on the item. Anyway, it's the first I opened.

I can see in Psycpros's history that there was some code for displaying TMDs, and the "RTMD" (remaining TMD?) just have that index adjustment that you'd mentioned.

I think this topic/thread is long in the tooth. I'm getting anxious to the point I'm inclined to go it alone. I am grateful for your insights, but am dismayed that this code is not more productive than it's so proven to be. I think to be useful it needs to assign useful extensions to the outputted files where possible, and normalize anything that can be, provided normalization does not destroy information.

I want to be collating this data. I would like a new topic that is geared toward sharing actionable information. This topic has become a lazy dumping ground. We need to be documenting/deciphering this thing, with hard facts and figures. I will take any help I can get. You've whet my appetite.
« Last Edit: July 27, 2018, 12:02:38 am by Holy_Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #54 on: July 29, 2018, 01:34:37 am »
Ah, I think there has been a mis-understanding about the tile data; the entire top section of the files (10 * 16384 bytes) is made up of actual grid data of the map.  It just points to the meshes and draws them according to a 2D array. This is why the light data can be different for each tile.

Which file is this? I don't see any unknown (archival) files this large? (160KB)

The first section of FDAT.T seems to repeat every 10 bytes, but is much smaller than this. (65KB)

EDITED/BTW I looked at about half of the level models. I found some that are the holes you can fall through. One had a ceiling, but the other did not. (I don't think so anyway.) But I didn't see any multi level tiles otherwise, suggesting to me that there is indeed a layer system.
« Last Edit: July 29, 2018, 01:39:16 am by Holy_Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #55 on: July 29, 2018, 02:29:17 am »
I think I figured it out :cool:

The 64KB+ files hold the maps. And they begin with number 64k, which seem to be the end of the tiling/beginning of something else. 64k means that the maps are 80x80 tiles, most likely (except I'm not sure how layers can fit into this, and 80x80 is not a figure that I would have predicted.)

EDITED: I wonder if the layers could be the other maps, just at unused locations? I coun't 9 level files, but there are only 8 maps. I wonder if one is a hidden layer, that isn't represented by a map. All 9 are 64k. So I'm inclined to believe in 80x80.

EDITED: Here's a picture of 80x80. I'd say it lines up very well, except that KF's tiles have walls on the outsides, whereas SOM's stock models (used here) have their walls on the inside. Edited: for the record, 80x80 is 2.5 pixels per tile on the in-game maps, that are 200x200 pixels. This suggests the maps are hand drawn (over a guide) and it's at the artists discretion what to do with the half pixel. That would explain the funkiness of the lines discussed earlier in this topic.

« Last Edit: July 29, 2018, 03:28:23 am by Holy_Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #56 on: July 30, 2018, 12:46:26 am »
Port progress topic: http://www.swordofmoonlight.net/bbs2/index.php?topic=286.0



Not trying to hijack this topic, but here is first image of a map loaded into SOM. Just FYI the maps may be stored South to North. But I have a feeling it's SOM that is S to N, because its vertical map coordinates run backward.

EDITED: That was fun, but I think I'm going to flesh out the last two maps first, both because they have few pieces, and I'm not sure what they are (one must be Guyra's lair.) I will figure out how to interpret the elevation fields from that.
« Last Edit: July 30, 2018, 01:00:10 am by Holy_Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #57 on: August 01, 2018, 02:26:02 am »
For what it's worth, the scale is 1:10341024. 1 meter that is. This seems like a weird number? Any clue? Also, the walls are not right on the edge of the tiles. They are maybe 0.25 out.

Strikeout: Transparent water tiles don't use 1034. I'm assuming they use 1000 (no, it's 1024 :doh:) and the 34 is a strategy to make cracks appear less often (by overlapping polygons.) From a geometric POV it's probably easier to use 1034 and fix the fewer amount of water tiles. But that depends on the UV maps, which I've not gotten into.

EDITED: See next post for elevation scale factors and its implications for the vertical scale factor, especially under SOM.

I can't place the 9th level. It seems to be missing two of its TMD models. There is little to it. There is a wide corridor that runs the entire width of the map, and a two tile hallway that goes up from one end, into a small room. The corridor has a high ceiling, and a doorway in the middle...

I can't locate it on any maps. I doubt that it is junk. But I don't understand why those tiles are amiss if not. It would have to be a loading/streaming transition section that isn't on any of the maps I think to be of use. Those missing tiles are the last in the RTMD.T file.

Strikeout: found it! One of the two is actually 254, which I suspect is a special value. That is either a dummy like in SOM, or possibly even a cue that layering is in play, since it's used in a place where the level is otherwise Swiss cheese. (The other was a programming typo--off by one error.) EDITED: While I'm here, I want to add that large corridor seems too long to have appeared in the game. Certainly longer than any connective section.

Guyra's map doesn't have any tiles on the section where a map on GameFAQs says Guyra lives. Maybe their platform is a big "object" or they don't seem to live in that location. I think that the dark sections on the purple map are fake, inaccessible areas that don't exist, though I've not yet determined how layering is accomplished. It's possible they are large "objects" if they are visible from in the game. It's possible "objects" can be walked around in just like tiles. (I've been meaning to try to find objects in the form of TMD files. I don't think I've seen one yet. They may be MO files.)

EDITED: Oh yeah, rotation is opposite of SOM's. So, clockwise, where 0 is north.

EDITED: The GameFAQs guide of Guyra's lair has icons on the darker sections, suggesting they are indeed accessible.
« Last Edit: August 03, 2018, 10:29:00 pm by Holy_Diver »

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #58 on: August 01, 2018, 10:55:51 pm »
The unknown values don't appear to do anything, I think two of them change how the tile is rendered, and either one or two of them are some form of packet ID for the tile. I'm writing up that reader now to see if we can get more information, since MO files are currently taking too much of my focus from the other aspects.

Turns this is the second layer! It's first because it's really a sub-layer, but the main layer is typically last last 5 bytes.

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #59 on: August 02, 2018, 02:42:30 am »
Here is a scene from a sub layer. The elevation units are in increments of 128. To make this work in SOM I've scaled the vertical dimension by a factor of 0.1/128. This is very likely distorting the height of things versus in the game, but it's also possible the game is designed to compensate for these weird units. Once furnishings are dropped in it will be obvious if their tops don't line up.

EDITED: Turns out the real factor is 0.125 meters per unit. I should've known this. My brain was just not firing on all cylinders :doh:

« Last Edit: August 02, 2018, 10:09:32 pm by Holy_Diver »