IvanDSM / KingsFieldRE

King's Field (II) Reverse Engineering Tools and Documentation
MIT License
37 stars 1 forks source link

3D map format #5

Closed ijacquez closed 3 years ago

ijacquez commented 3 years ago

Thank you for working on this.

Will there be plans on reverse engineering how KF builds its 3D levels? I've looked through the wiki and it's not exactly clear.

IvanDSM commented 3 years ago

Hello there! I'm glad you liked the efforts :)

I do apologise for the wiki not being up to date. I have to take some time and do some work there...

So, the map is built using the file 1 tilemaps against 3D model files that are stored on the RTMD.T T file and work as tilesets. These 3D models use a slightly modified TMD format (kinda like RTIM vs TIM). We have a proof-of-concept loader on the kfmt-moview branch. You can find the specific bit of code that does the loading here. The KFModTool version on the kfmt-moview is able to display those files as well as MO and TMD 3D files, though there are some glitches when viewing RTMDs.

ijacquez commented 3 years ago

Excellent, thank you. I haven't been successful in building the tool myself. Will there be builds in the Actions tab for this branch? I only see master.

IvanDSM commented 3 years ago

I just added support for building the kfmt-moview branch. Windows builds are working, but the Linux build of KFModTool is failing because linuxdeployqt forces me to use Ubuntu 16.04, and GCC 5 doesn't support some of the constexpr stuff very well.

ijacquez commented 3 years ago

Thanks!

Luckily I'm running Windows, but I see: image

Edit: I just checked out the newest build. Amazing work! I see what you mean by tiled. I wasn't expecting it to work like this, but this is great!

IvanDSM commented 3 years ago

Yeah, sorry for the issues with the build, glad you could get it to work though! :D Yeah, I was surprised by the fact that KF used tiles too, but it's a pretty smart choice for the size of the world. I'm happy to hear you liked KFModTool! Hope you have fun, and feel free to ask or suggest anything! :)

IvanDSM commented 3 years ago

I'll take the opportunity and say that after hours of attempts at fixing it, the Linux builds are working again :)

ijacquez commented 3 years ago

I've been playing around, and everything makes a lot more sense. I don't fully understand what "collision thing" is, and the elevation values seem to be inconsistent to what I think they are in the game (take the tower at the very start of the game).

Will collision geometry be displayed as well?

I'll be closing this issue, as this is unrelated, but is there a Discord available?

Also, is there information regarding the texture mapping? That is, what textures are mapped to what level object? If so, are there plans to add that?

Again, amazing work.

IvanDSM commented 3 years ago

Ah, I hadn't seen your comment before you joined the Discord! My bad.

We're a bit uncertain on what "Collision Thing" really is, but it seems to be some sort of collision data for the map. As for the elevation values, they are indeed a bit strange but I believe that the impact of the elevation value varies between different tile types.

As for collision geometry, the game doesn't store any collision geometry for entities or objects. Given what we know about some of the structures having a collision radius variable, it's likely King's Field uses simple box or sphere collision methods that don't need an additional mesh.

Regarding texture mapping, we're looking into displaying textures for the models, though with the way that KFMT is currently built some heavy refactoring will be in order.

Thank you for using KFMT, I'm glad you enjoy it! :)