Coder Social home page Coder Social logo

nvmeditor's Introduction

"#A try at a navmesh editor for Silkroad Online"

In order to read and write Silkroad Online (hereafter named SRO), it was required to reverse engineer the binary structure of the .nvm files.

A Navmesh file consists of different parts:

#Navmesh Metadata

The navmesh metadata contains information about how many entries of each element exists inside of the navmesh.

The structure of metadata is the following:

struct NavMeshMetadata 
{
	char header[12]; // 12 bytes
	ushort nav_entries;
	uint cell_entries;
	uint cell_extra_entries;
	uint region_link_entries;
	uint cell_link_entries;

};

As we can see, there is a header (a string of 12 chars) and the number of entries for each type.

#Navigation Entry A navigation entry contains the position, as a vector, of the spot a yaw value that indicates the orientation of the box. It also contains a collision flag, an unique_id and some other information pertaining to the way that SRO maps are defined.

The structure is the following:

struct NavigationEntry {
	uint id;
	Vector3 position;
	ushort collision;
	float yaw;
	ushort unique_id;
	ushort unknown_0;
	ushort event_zone; // 0 = no collision while using CTF suit, 255 = collision when using CTF suit
	ushort region_id;
	ushort mount_point_entries;
	std::vector<MountPoint> mount_points;
}

Other structures can be found below:

struct MountPoint{
	BYTE mount_point[6];
}

struct NavigationCell {
	Vector2 min;
	Vector2 max;
	BYTE entry_count;
	std::vector<ushort> entry_index;
}

struct RegionLink {
	Vector2 min;
	Vector2 max;
	BYTE line_flag;
	BYTE line_source;
	BYTE line_destination;
	ushort source_cell;
	ushort destination_cell;
	ushort source_region;
	ushort destination_region;
}

struct NavigationCellLink {
	Vector2 min;
	Vector2 max;

	BYTE line_flag;
	BYTE line_source;
	BYTE line_destination;

	ushort source_cell;
	ushort destination_cell;
}

struct TextureMap {
	
	ushort w1;
	ushort w2;
	ushort w3;
	ushort w4;
};

struct HeightMap {
	float Height;
};

And finally the navmesh struct:

struct NavMesh {
	NavMeshMetadata metadata;//std::unique_ptr<NavMeshMetadata> metadata;
	std::map<uint, NavigationEntry> nav_entries;
	std::vector<NavigationCell> nav_cells;
	std::vector<RegionLink> region_links;
	std::vector<NavigationCellLink> nav_cell_links;
	std::vector<TextureMap> texture_maps;
	std::vector<HeightMap> height_maps;
};

nvmeditor's People

Contributors

harukananase avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.