This is a
BETA release of my entire project. Please
read everything first!
That means:
- There are still bugs
- The code is not optimized
- You still have to do a bit of work yourself to make use of this data properly
I no longer have any intentions of continuing immediate work on the NVM files because I am changing my Silkroad development focus now (going into design related tasks). I will eventually revisit this project, but it is no longer a project of any priority to me. That means this project will remain in a
BETA state for a while. There are plenty of opportunities to make the code better or customize how you use it in your applications though.
Here's a brief overview of the project. You will need Visual Studio 2008 to be able to compile and run out of the box. All of the required 3rd party dependencies are included.
Blowfish.cpp/Blowfish.h - Blowfish library that I've been using in all my project for the PK2 api.
glm.cpp/glm.h - Not actually used now, but a good simple OBJ model loading library.
nvm.cpp/nvm.h - My new NVM library that will load NVM files from memory or from file. As you will see, there is not that much code to it and it's pretty simple. The tricky part was reversing it all though, so that's expected.
pk2reader.cpp/pk2reader.h - My new updated PK2 reader class that allows for reading PK2 files from "memory" rather than having to extract them to a file first. Very useful for this project.
pk2writer.cpp/pk2writer.h - My original PK2 writing class. I don't think I made any changes here.
SOIL.h - Simple OpenGL Image Library used for the DDS loading and rendering via OpenGL
Utility.cpp/Utility.h - Just some common functions I use.
edxNVMViewer.cpp - The actual program. It utilizes SFML for OpenGL setup and rendering. It's a bit of code, so it might take a while to follow through it.
Camera.cpp/Camera.h - Someone else's Camera library from a game programming site.
Now for some
important notes:
- The NVM code is almost 100% complete. There's still some fields I don't know what they are used for, but the bulk of the stuff is known.
- The NVM rendering code is NOT complete. You have to do some data manipulation to render the terrain correctly as you will see in the code.
- You need a BSR/BMS loader to get the entities rendered into the world. For now I have written a small function called GetAABBFromBSR which will return an AABB of the BSR being loaded.
- The whole "logic" to loading the NVMs and the BSR data is really inefficient! This means it will probably run slow on some machines until it is optimized. The offending function is GetAABBFromBSR.
- Having some game programming / OpenGL knowledge will help a lot with getting the NVM files rendered properly. My approach is "good enough" to show the main idea but it's not perfect.
There are two important paths to set for the project file that are set already, but in case you lose settings:
Finally, some last words about the project. First, make sure you read my 4 previous replies in this thread as they contain some good information.

,

,

,
Now, with NVMs, you should be able to easily setup terrain height collisions on a server. You can use the rendering logic to make a mini client(less) as well since you can draw your character based on the current position it's at. You will need to understand the Silkroad coordinate system first.
The entities in the regions are a problem though. You know where everything is and have an AABB of the entity, which is nice additional information to have access to, but a BMS/BSR parser is really needed for a "complete" picture of the game. While most of the rotations seem to work right, some are wrong which means there are either flags that also affect how something is positioned or there is more data in the BSR that should be utilized.
Writing a NVM compiler should not be terribly hard if you base the code on the reader. I've not bothered with that aspect of the files yet, but one day I might if no one does it in the mean time. Right now simply understanding the files is what's really needed.
There's a lot of code and logic here, so expect to spend some time learning what is going on and studying the classes. Most people won't have a use for this stuff or data, but it's still interesting to know.
Here are the final screenshots:
Enjoy