Raised This Month: $305 Target: $400
 76%   Almost there!

Read .Nav File via Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 10-17-2013 , 11:37   Read .Nav File via Plugin
Reply With Quote #1

Anyway we can read up .nav file and use it up in plugins to display locations ?
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-17-2013 , 12:16   Re: Read .Nav File via Plugin
Reply With Quote #2

The .nav files you are referring are binary files used by CS:CZ to mark bot navigation.

Is this?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 10-17-2013 , 13:47   Re: Read .Nav File via Plugin
Reply With Quote #3

Quote:
Originally Posted by ^SmileY View Post
The .nav files you are referring are binary files used by CS:CZ to mark bot navigation.

Is this?

Yes exactly .. Most of the good mappers provide .Nav file as well for use as bots waypoints .. Dont know how they work but if we can read them some way .. We can use that in a lot of things ..
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-17-2013 , 16:12   Re: Read .Nav File via Plugin
Reply With Quote #4

Quote:
Originally Posted by devilicioux View Post
Yes exactly .. Most of the good mappers provide .Nav file as well for use as bots waypoints .. Dont know how they work but if we can read them some way .. We can use that in a lot of things ..
Not, the .nav files is generated by CZ bots when create a new map andd added bots without a nav file.

I assume it is for CZ not CS 1.6 right? If yes it is possible to create a module to manager this.
If it for CS it is illegal, and for CS you may use PodBots.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 10-17-2013 , 21:18   Re: Read .Nav File via Plugin
Reply With Quote #5

Reading up .nav files via amxx plugin is illegal ?
AFAIK using them directly in CS is illegal .. Mind clearing my doubt ?
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 10-18-2013 , 01:11   Re: Read .Nav File via Plugin
Reply With Quote #6

Quote:
Originally Posted by devilicioux View Post
Reading up .nav files via amxx plugin is illegal ?
AFAIK using them directly in CS is illegal .. Mind clearing my doubt ?
.nav files is a party of CZ Bots, in CS it is illegal anyway.

explain you are trying to do using .nav files?

Ps. if you are trying to use to show the locations in map, like bomb sites and buyzones i think it have an plugin in this forum.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 10-18-2013 at 01:12.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 10-18-2013 , 12:17   Re: Read .Nav File via Plugin
Reply With Quote #7

Okay i understand .. yes i was trying to use up info in those .nav files by reading them somehow by amxx .. so basically idea is now dumped..

Info zone is too hard to use .. I tried using it but it is too complicated and sometimes make the server not responding .. i dont remember the error that comes in console.. Point is making the areas perfectly using Info zone is too hard and takes time.
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then
devilicioux is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 08-23-2021 , 05:19   Re: Read .Nav File via Plugin
Reply With Quote #8

Sorry for digging this up.
I wanna try to abuse this .nav files for NPC pathing but I did couldn't find any info on how to use get those zone info into amxx.
It been 8 years so idk if is there any info on this stuff?

I read ReGameDLL zBot but there is so much stuff I couldn't understand
Code:
void CNavArea::Load(SteamFile *file, unsigned int version)
{
	// load ID
	file->Read(&m_id, sizeof(unsigned int));

	// update nextID to avoid collisions
	if (m_id >= m_nextID)
		m_nextID = m_id + 1;

	// load attribute flags
	file->Read(&m_attributeFlags, sizeof(unsigned char));

	// load extent of area
	file->Read(&m_extent, 6 * sizeof(float));

	m_center.x = (m_extent.lo.x + m_extent.hi.x) / 2.0f;
	m_center.y = (m_extent.lo.y + m_extent.hi.y) / 2.0f;
	m_center.z = (m_extent.lo.z + m_extent.hi.z) / 2.0f;

	// load heights of implicit corners
	file->Read(&m_neZ, sizeof(float));
	file->Read(&m_swZ, sizeof(float));

	// load connections (IDs) to adjacent areas
	// in the enum order NORTH, EAST, SOUTH, WEST
	for (int d = 0; d < NUM_DIRECTIONS; d++)
	{
		// load number of connections for this direction
		unsigned int count;
		file->Read(&count, sizeof(unsigned int));

		for (unsigned int i = 0; i < count; i++)
		{
			NavConnect connect;
			file->Read(&connect.id, sizeof(unsigned int));

			m_connect[d].push_back(connect);
		}
	}

	// Load hiding spots
	// load number of hiding spots
	unsigned char hidingSpotCount = 0;
	file->Read(&hidingSpotCount, sizeof(unsigned char));

	if (version == 1)
	{
		// load simple vector array
		Vector pos;
		for (int h = 0; h < hidingSpotCount; h++)
		{
			file->Read(&pos, 3 * sizeof(float));

			// create new hiding spot and put on master list
			HidingSpot *spot = new HidingSpot(&pos, HidingSpot::IN_COVER);

			m_hidingSpotList.push_back(spot);
		}
	}
	else
	{
		// load HidingSpot objects for this area
		for (int h = 0; h < hidingSpotCount; h++)
		{
			// create new hiding spot and put on master list
			HidingSpot *spot = new HidingSpot;

			spot->Load(file, version);

			m_hidingSpotList.push_back(spot);
		}
	}

	// Load number of approach areas
	file->Read(&m_approachCount, sizeof(unsigned char));

	// load approach area info (IDs)
	unsigned char type = 0;
	for (int a = 0; a < m_approachCount; a++)
	{
		file->Read(&m_approach[a].here.id, sizeof(unsigned int));

		file->Read(&m_approach[a].prev.id, sizeof(unsigned int));
		file->Read(&type, sizeof(unsigned char));
		m_approach[a].prevToHereHow = (NavTraverseType)type;

		file->Read(&m_approach[a].next.id, sizeof(unsigned int));
		file->Read(&type, sizeof(unsigned char));
		m_approach[a].hereToNextHow = (NavTraverseType)type;
	}

	// Load encounter paths for this area
	unsigned int count;
	file->Read(&count, sizeof(unsigned int));

	if (version < 3)
	{
		// old data, read and discard
		for (unsigned int e = 0; e < count; e++)
		{
			SpotEncounter encounter;

			file->Read(&encounter.from.id, sizeof(unsigned int));
			file->Read(&encounter.to.id, sizeof(unsigned int));

			file->Read(&encounter.path.from.x, 3 * sizeof(float));
			file->Read(&encounter.path.to.x, 3 * sizeof(float));

			// read list of spots along this path
			unsigned char spotCount = 0;
			file->Read(&spotCount, sizeof(unsigned char));

			for (int s = 0; s < spotCount; s++)
			{
				Vector pos;
				file->Read(&pos, 3 * sizeof(float));
				file->Read(&pos, sizeof(float));
			}
		}

		return;
	}

	for (unsigned int e = 0; e < count; e++)
	{
		SpotEncounter encounter;

		file->Read(&encounter.from.id, sizeof(unsigned int));

		unsigned char dir = 0;
		file->Read(&dir, sizeof(unsigned char));
		encounter.fromDir = static_cast<NavDirType>(dir);

		file->Read(&encounter.to.id, sizeof(unsigned int));

		file->Read(&dir, sizeof(unsigned char));
		encounter.toDir = static_cast<NavDirType>(dir);

		// read list of spots along this path
		unsigned char spotCount = 0;
		file->Read(&spotCount, sizeof(unsigned char));

		SpotOrder order;
		for (int s = 0; s < spotCount; s++)
		{
			file->Read(&order.id, sizeof(unsigned int));

			unsigned char t = 0;
			file->Read(&t, sizeof(unsigned char));

			order.t = float(t) / 255.0f;

			encounter.spotList.push_back(order);
		}

		m_spotEncounterList.push_back(encounter);
	}

	if (version >= NAV_VERSION)
	{
		// Load Place data
		PlaceDirectory::EntryType entry;
		file->Read(&entry, sizeof(entry));

		// convert entry to actual Place
		SetPlace(placeDirectory.EntryToPlace(entry));
	}
}

NavErrorType CNavArea::PostLoad()
{
	NavErrorType error = NAV_OK;

	// connect areas together
	for (int d = 0; d < NUM_DIRECTIONS; d++)
	{
		for (auto& connect : m_connect[d])
		{
			auto id = connect.id;
			connect.area = TheNavAreaGrid.GetNavAreaByID(id);
			if (id && !connect.area)
			{
				CONSOLE_ECHO("ERROR: Corrupt navigation data. Cannot connect Navigation Areas.\n");
				error = NAV_CORRUPT_DATA;
			}
		}
	}

	// resolve approach area IDs
	for (int a = 0; a < m_approachCount; a++)
	{
		m_approach[a].here.area = TheNavAreaGrid.GetNavAreaByID(m_approach[a].here.id);
		if (m_approach[a].here.id && !m_approach[a].here.area)
		{
			CONSOLE_ECHO("ERROR: Corrupt navigation data. Missing Approach Area (here).\n");
			error = NAV_CORRUPT_DATA;
		}

		m_approach[a].prev.area = TheNavAreaGrid.GetNavAreaByID(m_approach[a].prev.id);
		if (m_approach[a].prev.id && !m_approach[a].prev.area)
		{
			CONSOLE_ECHO("ERROR: Corrupt navigation data. Missing Approach Area (prev).\n");
			error = NAV_CORRUPT_DATA;
		}

		m_approach[a].next.area = TheNavAreaGrid.GetNavAreaByID(m_approach[a].next.id);
		if (m_approach[a].next.id && !m_approach[a].next.area)
		{
			CONSOLE_ECHO("ERROR: Corrupt navigation data. Missing Approach Area (next).\n");
			error = NAV_CORRUPT_DATA;
		}
	}

	// resolve spot encounter IDs
	for (auto& spote : m_spotEncounterList)
	{
		spote.from.area = TheNavAreaGrid.GetNavAreaByID(spote.from.id);
		if (!spote.from.area)
		{
			CONSOLE_ECHO("ERROR: Corrupt navigation data. Missing \"from\" Navigation Area for Encounter Spot.\n");
			error = NAV_CORRUPT_DATA;
		}

		spote.to.area = TheNavAreaGrid.GetNavAreaByID(spote.to.id);
		if (!spote.to.area)
		{
			CONSOLE_ECHO("ERROR: Corrupt navigation data. Missing \"to\" Navigation Area for Encounter Spot.\n");
			error = NAV_CORRUPT_DATA;
		}

		if (spote.from.area && spote.to.area)
		{
			// compute path
			float halfWidth;
			ComputePortal(spote.to.area, spote.toDir, &spote.path.to, &halfWidth);
			ComputePortal(spote.from.area, spote.fromDir, &spote.path.from, &halfWidth);

			const float eyeHeight = HalfHumanHeight;
			spote.path.from.z = spote.from.area->GetZ(&spote.path.from) + eyeHeight;
			spote.path.to.z = spote.to.area->GetZ(&spote.path.to) + eyeHeight;
		}

		// resolve HidingSpot IDs
		for (auto& order : spote.spotList)
		{
			order.spot = GetHidingSpotByID(order.id);
			if (!order.spot)
			{
				CONSOLE_ECHO("ERROR: Corrupt navigation data. Missing Hiding Spot\n");
				error = NAV_CORRUPT_DATA;
			}
		}
	}

	// build overlap list
	// TODO: Optimize this
	for (auto area : TheNavAreaList)
	{
		if (area == this)
			continue;

		if (IsOverlapping(area))
			m_overlapList.push_back(area);
	}

	return error;
}
__________________
My plugin:

Last edited by Celena Luna; 08-23-2021 at 06:05.
Celena Luna is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-23-2021 , 11:49   Re: Read .Nav File via Plugin
Reply With Quote #9

Is the file structure documented anywhere? If so, I can likely read from the file. But do you really think you'd be able to use it?
__________________
Bugsy is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 08-23-2021 , 13:37   Re: Read .Nav File via Plugin
Reply With Quote #10

Quote:
Originally Posted by Bugsy View Post
Is the file structure documented anywhere? If so, I can likely read from the file. But do you really think you'd be able to use it?
https://github.com/s1lentq/ReGameDLL...ame_shared/bot

I found this on ReGameDLL's github.
I am not sure if I could use it but it is not hurt to try.
__________________
My plugin:
Celena Luna is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:25.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode