Author Topic: Modding Expeditions (KF)  (Read 45993 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 #60 on: August 02, 2018, 10:20:44 pm »
:movingeyes: CLARIFICATION :movingeyes:

Um, final word on units etc. is they are in PlayStation fixed-point (duh) and each tile is 0.5 of these end to end. This means 1024 (0.25) is 1 in SOM.

As for elevation, each unit is 0.03125 in PlayStation units, or 128. 128 divides int 1024 8 times, so in SOM units, each elevation unit is 0.125. Most of the time KF2's map change this 4 units at a time, and so most of the time it is in increments of 0.5. That works out nicely for SOM.

In the other times, SOM_MAP respects the odd units, but I have to do some work to make it work with the elevation tools, since the values are rounded in the tile information field, and presumably it's impossible to change the elevation to a compatible value that isn't a multiple of 0.5.

I found out yesterday where they are stored in SOM_MAP, which is a good finding since it will open the door to powerful editing extensions. I found that they are not rounded off when stored.

I ultimately decided to map 1034 to 1 meter for the conversion. What convinced me to is the climbing tiles had this transformation applied to the horizontal dimensions, but not to the vertical one. So to normalize things in all 3 dimensions, I applied the change. It causes problems for diagonal walls, but on the whole is for the best I think, in terms of work later on. And I reasoned that if the vertical dimension omitted the transformation, that it's likely the UV maps omit it as well. Guyra's section has the overlap, even though their pieces are transparent. I guess that overlap contributes to the grid effect overlaying their area. It could even be the sole source of it.



Offline TheStolenBattenberg

  • Capricorn Crusher
  • **
  • Posts: 192
Re: Modding Expeditions (KF)
« Reply #61 on: August 03, 2018, 11:21:18 am »
Okay, note to self: Don't rely on this forum to send email updates. I missed all of this, and really wish I hadn't.

Quote
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.

I agree with you. Personally I'm making these tools as a final solution to any kind of KF2 modding, weather it be the extraction of files, importing of files, converting of files... It's very general purpose, if you understand? File extensions have been added in the latest version, and so has some form of default file naming and sorting, as you've seen in the latest version.

I think we should open a dedicated repository specific to documenting the files and routines of KF2. I think this would be a better choice than hosting documentation of Psycpros repository, and I would be happy to work on this and move documentation I currently have over, and make it fit your preferred coding style, if you would provide a template or example of sorts for me to look at.

Quote
Which file is this? I don't see any unknown (archival) files this large? (160KB)
Your findings have proven mine wrong, and I'm happy about this because it means that they are understood.


Rather than me replying and quoting through all of this, would you mind if we discussed this over email? I would like to hear what you've found, and the fact you've got to the point of understanding this data enough to import it into SOM outstands me.

PS:
Quote
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...
Quote
Maybe some left over area, or a debug room they forgot to remove? The other files such as the database would add more information on that.
« Last Edit: August 03, 2018, 05:20:38 pm by TheStolenBattenberg »
Ashes to ashes, Dust to dust...
Honor to glory; And iron to rust.
Hate to bloodshed, From rise to fall.
If I never have to die; Am I alive at all?

Offline TheStolenBattenberg

  • Capricorn Crusher
  • **
  • Posts: 192
Re: Modding Expeditions (KF)
« Reply #62 on: August 03, 2018, 05:22:01 pm »
Managed to get the map data loading myself, though mirrored unfortunately:


The gaps are due to me not bothering to sort the draw order.
Ashes to ashes, Dust to dust...
Honor to glory; And iron to rust.
Hate to bloodshed, From rise to fall.
If I never have to die; Am I alive at all?

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #63 on: August 03, 2018, 10:17:33 pm »
I recommend http://swordofmoonlight.org/wiki/ ... but I think that if nothing else this forum could be used to coordinate, just because people flock to it by default... maybe because search-engines give priority to dot-com sites.

I don't think Git is appropriate for wiki work, and to be honest, you will get me to engage more if the wiki is one I own, both because I can be confident it will remain in good hands, and provide any support that is required. This (https://www.reddit.com/r/KingsField/) subreddit lists it as the wiki for SOM, which should be synonymous with any technical work done on KF. I think copying KF to another "engine" is probably a bad idea, because From Software has provided a legitimate platform, and so to do an outlaw version of it, just invites legal questions where none are actually required. It would dilute the brand I think, and draw comparisons about which is legitimate. I don't think SOM puts KF in the public domain, but it effectively does for developers who choose SOM.

EDITED: I also don't recommend GitHub's wiki feature, because it doesn't get copied when a project is forked.

I consider Shadow Tower and Armored Core part of the SOM family, because A) SOM has more ST art work than anything, and is actually closer to ST than KF in terms of its original technical specs. B) The Moonlight Sword is a prominent fixture of Armored Core, and so when the time comes, I will go to the mat to include it in SOM. I think that now is the time to begin championing PlayStation era games. I feel like "independent" video game developers are not doing good enough work, compared to what commercial companies where doing then. And even now, video games seem to have lost their way, insofar as the big companies can't seem to make a compelling product, and I'm even seeing games made by the likes of SquareEnix that look like trashy indie games. So I think video games need to make a transition into a respectable field of study and history so the subject can be taken seriously before it's completely lost to a decadent cowboy ethic/culture.

King's Field is definitely worth conserving in my book. If nothing else is. I think maybe all of 3D video games is a mistake, and maybe we should just go back to the drawing board, by looking more closely at KF2.

This site has a chat server here ( https://discordapp.com/invite/2J45XKD ) that I've not logged into. I don't know if it's useful or not myself. But something like chat could be useful for coordinating a wiki editing effort, and would be more public than using an instant-messenger. Maybe if you chimed in there, you could get them to make a new sub forum here for hacking From Software data discs. There's certainly much discussion of hacking Brigandine here, that is not even a From Software title.
« Last Edit: August 03, 2018, 10:20:38 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 #64 on: August 13, 2018, 08:17:34 pm »
Here is my first complete picture of the waterfall. It took a while to add the beginnings of a layer feature to SOM. Apparently it had a layer feature originally, that is disabled in the final product. Bits and pieces of it are usable. So the new feature is a mix of old and new without delving into the details. I noticed some of the code some time ago. And I wasn't exactly certain what to make of it at the time. Fortunately/unfortunately I've had more than a week to become familiar with it thanks to this line of work.


Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #65 on: August 14, 2018, 08:33:22 pm »
Voila :rainbow:


Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #66 on: August 22, 2018, 08:25:03 pm »
typedef struct {
   char Unknown;
   char Unknown;
   char Unknown;
   char Unknown;
   char Unknown;
   char TileMeshIndex;
   char TileHeight;
   char TileRotation;
   char CollisionMesh;
   char LightValue;
} Tile;

Here (attached) is images of bytes 4 (CollisonMesh?) and 5 (LightValue?) on both planes.

I'm wondering what made you name these fields this? Did you see experimental results within the emulator?

None of these really look like light to me.... which is kind of messed up because I already planned a layout to add a light map feature to SOM. Did you see the lights change? Is it possible it is a lighting enable flag mixed in with other bit level encoded fields?

What's strange about byte 4, is it is lit up on the secondfirst plane where there are no tiles, and possibly vice versa. EDITED: for example, it shows the pier from the second plain on the first, but also shows the ground under the pier on the second. (The "first plane" is the secondary layer. I'm trying to be consistent, but it's a little confusing.)

Byte 5 is likewise, and weirder still is the image produced by byte 5 is shifted on the first plane. In the attached is a blueshifted version where the images are aligned. If I wasn't prompted to try to make a light map this shift may never have gone unnoticed.

P.S. The name of this ZIP is a misnomer... I would have called it light?.zip if it were allowed.
« Last Edit: August 23, 2018, 02:00:02 am by Holy_Diver »

Offline TheStolenBattenberg

  • Capricorn Crusher
  • **
  • Posts: 192
Re: Modding Expeditions (KF)
« Reply #67 on: August 22, 2018, 11:20:39 pm »
I don't think that what I marked as collision is a collision mesh, as I've found other data that appears to set the collisions.

The light value byte could be rendering flags as only bits 0 - 3 (LSB) of the byte effect it... I noticed that when a higher value was used (by modification in cheatengine), you'd get darker tiles. We know King's Field supported some form of very simple lighting, and it is limited to tiles, you can see it in quiet a few places, like the dark lag-out room in the pirate area, or the stairs going down to the first save point and Star Gate.

I haven't stopped working on this, nor Psypros. But new findings have been slow, and oddities are being found. One of which is to do with the Tilesets and their textures, which doesn't make sense. Something needs to be looked into with the 'CPT' flag (I think that's what it's called) in the tileset TMD primitives, since some tiles use the wrong textures, while others use the correct ones in my test program.

On a slightly related note, I found out that a lot of the files in KF2 and KF3 are similar formats to files from KF1. Chances are, the engine was pretty similar too, which probably explains the level of confusion I'm experiencing.

Just a thought, but does level streaming work in SoM or have you not implemented it yet? I know it used to use some sort of teleport or transition system to move from level to level.

P.S:
Just for the sake of it, I'm going to crack open Pilot Style tomorrow. Since all of the files are on the disc, I want to see if I can find some beta goodies.
Ashes to ashes, Dust to dust...
Honor to glory; And iron to rust.
Hate to bloodshed, From rise to fall.
If I never have to die; Am I alive at all?

Offline Holy_Diver

  • Holy Diver
  • Archmage of Light
  • *****
  • Posts: 2280
  • This account won't read/reply to Private Messages
Re: Modding Expeditions (KF)
« Reply #68 on: August 23, 2018, 12:59:53 am »
I have a TMD manual that doesn't mention CPT. I cracked it open, out of curiosity. I hadn't looked in it in years.

If you can say more precisely where parts of KF2 have lighting transitions that do not look like alternative textures, I would like to see these areas for myself. Though right now, I can only readily visit areas on the starting zone. I will try to locate the ones you mentioned.

EDITED: I wanted to mention that I think the dark cave where one of the Truth Glasses is (I think so, but I might be confusing it with DMPDesign's SOM game) definitely uses some form of lighting transition.

I noticed that the game seems larger than my reconstruction in SOM. I'm not sure if it's just using a much higher focal length, or if the scale is very different from 1024 is 1 meter. Like it's possible even that 1024 is 2 meters. Or some other unit. At first it seemed that the character was really short... but I realized that the top of the water was serving as the floor, and that is why the ceiling in the cave behind the waterfall seemed particularly low.

Still, I'm certain that the "camera" is much lower in the PlayStation games, or if their FOV is really crazy, that might contribute to the sense of crawling along the ground. High FOV on a flat projection is very distorted, but if visibility is very clipped, distortion is less noticeable. I really think VR is the future, because it doesn't seem to suffer from a lot of problems like field-of-view, projection or line-of-sight even in its infancy.

Quote
Just a thought, but does level streaming work in SoM or have you not implemented it yet? I know it used to use some sort of teleport or transition system to move from level to level.

It will be added for KF2. The original has only enough features to implement its KF1 remake/sample. I'm not going to work on it until the doors are in place. If you've looked at the level data, you know there are holes where the doors go. In SOM they must be jumped over, or flown over. I want to get more objects into it ASAP. So far it's been a little underwhelming to see it dressed down. I would prefer it to be ecxiting. It's getting there, with BGM and both layers of level data. I don't want Melanat to lose its magic for me, after spending too long inside it while in an unfinished state.

P.S. It seems to me that programming for a PlayStation architecture must have revolved singularly around the limited texture memory. I mean, that it seems to have a lot of parameters for addressing this tiny cramped space of memory. That suggests to me that it was far from trivial to just swap out textures casually. This means that the focus of any game would be choreographing use of this paltry space. In which case I would not be surprised if a lot of the data is really hand-tuned instructions to the game to ready the memory for this-and-that. There is a lot of redundancy in the textures, suggesting that a top-down, static approach to texture memory management was first priority...

At the end of the day, my take away from this would be to just forget about it, and piece it together by hand, like a puzzle... but at the same time, there isn't a lot of data on the disc really, and the textures are so small that in many or most cases they are not enough to go on, as individual puzzle pieces. And so I worry that doing it by hand might be frustrating or prone to error. So I think neither approach has clear merit over the other.
« Last Edit: August 23, 2018, 01:21:58 am by Holy_Diver »

Offline TheStolenBattenberg

  • Capricorn Crusher
  • **
  • Posts: 192
Re: Modding Expeditions (KF)
« Reply #69 on: August 23, 2018, 10:10:21 pm »
Turns out I was thinking of 'TSB', got it mixed up with 'CBA' but what I thought isn't the case, I just had my bitmask wrong (I had 4 bits, not 5 bits), which probably means it's possible to get the texture information without an issue. Getting them mixed up was kind of stupid of me since it's my names initials.

The texture coordinates and pages work fine:


These are starting areas, since those are the areas I can easily access without playing through the game.

The first is where you get the skull key, the second is hard to spot and I can't give any more information than the stair case going down to the first save point, in the area with the broken knight sword and 2 - 3 krakens.







Ashes to ashes, Dust to dust...
Honor to glory; And iron to rust.
Hate to bloodshed, From rise to fall.
If I never have to die; Am I alive at all?