Abstraction Layer GeoEngine.
This commit is contained in:
		| @@ -299,7 +299,6 @@ CorrectPrices = True | ||||
| # --------------------------------------------------------------------------- | ||||
|  | ||||
| # Allow characters to receive damage from falling. | ||||
| # CoordSynchronize = 2 is recommended. | ||||
| # Default: True | ||||
| EnableFallingDamage = True | ||||
|  | ||||
|   | ||||
| @@ -2,48 +2,47 @@ | ||||
| #                             Geodata | ||||
| # ================================================================= | ||||
|  | ||||
| # Specifies the path to geodata files. For example, when using geodata files located | ||||
| # at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/ | ||||
| # Pathfinding options: | ||||
| # 0 = Disabled | ||||
| # 1 = Enabled using path node files. | ||||
| # 2 = Enabled using geodata cells at runtime. | ||||
| # Default: 0 | ||||
| PathFinding = 2 | ||||
|  | ||||
| # Geodata file directory. | ||||
| GeoDataPath = ./data/geodata/ | ||||
|  | ||||
| # Specifies the geodata files type. Default: L2J | ||||
| # L2J: Using L2J geodata files (filename e.g. 22_16.l2j) | ||||
| # L2OFF: Using L2OFF geodata files (filename e.g. 22_16_conv.dat) | ||||
| GeoDataType = L2J | ||||
| # Pathnode file directory. | ||||
| # Default: pathnode | ||||
| PathnodePath = ./data/pathnode/ | ||||
|  | ||||
| # ================================================================= | ||||
| #                           Pathfinding | ||||
| # ================================================================= | ||||
| # Pathfinding array buffers configuration. | ||||
| PathFindBuffers = 100x6;128x6;192x6;256x4;320x4;384x4;500x2 | ||||
|  | ||||
| # When line of movement check fails, the pathfinding algoritm is performed to look for | ||||
| # an alternative path (e.g. walk around obstacle), default: True | ||||
| PathFinding = True | ||||
| # Weight for nodes without obstacles far from walls. | ||||
| LowWeight = 0.5 | ||||
|  | ||||
| # Pathfinding array buffers configuration, default: 1200x10;2000x10;3000x5;5000x3;10000x3 | ||||
| PathFindBuffers = 1200x10;2000x10;3000x5;5000x3;10000x3 | ||||
| # Weight for nodes near walls. | ||||
| MediumWeight = 2 | ||||
|  | ||||
| # Movement weight, when moving from one to another axially and diagonally, default: 10 and 14 | ||||
| MoveWeight = 10 | ||||
| MoveWeightDiag = 14 | ||||
| # Weight for nodes with obstacles. | ||||
| HighWeight = 3 | ||||
|  | ||||
| # When movement flags of target node is blocked to any direction, use this weight instead of MoveWeight or MoveWeightDiag. | ||||
| # This causes pathfinding algorithm to avoid path construction exactly near an obstacle, default: 30 | ||||
| ObstacleWeight = 30 | ||||
| # Angle paths will be more "smart", but in cost of higher CPU utilization. | ||||
| AdvancedDiagonalStrategy = True | ||||
|  | ||||
| # Weight of the heuristic algorithm, which is giving estimated cost from node to target, default: 12 and 18 | ||||
| # For proper function must be higher than MoveWeight. | ||||
| HeuristicWeight = 12 | ||||
| HeuristicWeightDiag = 18 | ||||
| # Weight for diagonal movement. Used only with AdvancedDiagonalStrategy = True | ||||
| # Default: LowWeight * sqrt(2)  | ||||
| DiagonalWeight = 0.707 | ||||
|  | ||||
| # Maximum number of generated nodes per one path-finding process, default 3500 | ||||
| MaxIterations = 3500 | ||||
| # Maximum number of LOS postfilter passes, 0 will disable postfilter. | ||||
| # Default: 3 | ||||
| MaxPostfilterPasses = 3 | ||||
|  | ||||
| # ================================================================= | ||||
| #                           Line of Sight | ||||
| # ================================================================= | ||||
|  | ||||
| # Line of sight start at X percent of the character height, default: 75 | ||||
| PartOfCharacterHeight = 75 | ||||
|  | ||||
| # Maximum height of an obstacle, which can exceed the line of sight, default: 32 | ||||
| MaxObstacleHeight = 32 | ||||
| # Path debug function. | ||||
| # Nodes known to pathfinder will be displayed as adena, constructed path as antidots. | ||||
| # Number of the items show node cost * 10 | ||||
| # Potions display path after first stage filter | ||||
| # Red potions - actual waypoints. Green potions - nodes removed by LOS postfilter | ||||
| # This function FOR DEBUG PURPOSES ONLY, never use it on the live server! | ||||
| DebugPath = False | ||||
|   | ||||
| @@ -25,6 +25,3 @@ b - Make it work | ||||
|  | ||||
| To make geodata work: | ||||
| * unpack your geodata files into "/data/geodata" folder (or any other folder) | ||||
| * open "/config/GeoEngine.ini" with your favorite text editor and then edit following configs: | ||||
| - GeoDataPath = set path to your geodata, if elsewhere than "./data/geodata/" | ||||
| - GeoDataType = set the geodata format, which you are using. | ||||
|   | ||||
| @@ -55,8 +55,8 @@ public class AdminGeodata implements IAdminCommandHandler | ||||
| 				final int worldX = activeChar.getX(); | ||||
| 				final int worldY = activeChar.getY(); | ||||
| 				final int worldZ = activeChar.getZ(); | ||||
| 				final int geoX = GeoEngine.getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.getGeoY(worldY); | ||||
| 				final int geoX = GeoEngine.getInstance().getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.getInstance().getGeoY(worldY); | ||||
| 				 | ||||
| 				if (GeoEngine.getInstance().hasGeoPos(geoX, geoY)) | ||||
| 				{ | ||||
| @@ -73,8 +73,8 @@ public class AdminGeodata implements IAdminCommandHandler | ||||
| 				final int worldX = activeChar.getX(); | ||||
| 				final int worldY = activeChar.getY(); | ||||
| 				final int worldZ = activeChar.getZ(); | ||||
| 				final int geoX = GeoEngine.getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.getGeoY(worldY); | ||||
| 				final int geoX = GeoEngine.getInstance().getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.getInstance().getGeoY(worldY); | ||||
| 				 | ||||
| 				if (GeoEngine.getInstance().hasGeoPos(geoX, geoY)) | ||||
| 				{ | ||||
|   | ||||
| @@ -19,9 +19,9 @@ package handlers.admincommandhandlers; | ||||
| import java.util.List; | ||||
|  | ||||
| import org.l2jmobius.Config; | ||||
| import org.l2jmobius.gameserver.geoengine.GeoEngine; | ||||
| import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc; | ||||
| import org.l2jmobius.gameserver.geoengine.pathfinding.PathFinding; | ||||
| import org.l2jmobius.gameserver.handler.IAdminCommandHandler; | ||||
| import org.l2jmobius.gameserver.model.Location; | ||||
| import org.l2jmobius.gameserver.model.actor.Player; | ||||
| import org.l2jmobius.gameserver.util.BuilderUtil; | ||||
|  | ||||
| @@ -37,20 +37,21 @@ public class AdminPathNode implements IAdminCommandHandler | ||||
| 	{ | ||||
| 		if (command.equals("admin_path_find")) | ||||
| 		{ | ||||
| 			if (!Config.PATHFINDING) | ||||
| 			if (Config.PATHFINDING < 1) | ||||
| 			{ | ||||
| 				BuilderUtil.sendSysMessage(activeChar, "PathFinding is disabled."); | ||||
| 				return true; | ||||
| 			} | ||||
| 			 | ||||
| 			if (activeChar.getTarget() != null) | ||||
| 			{ | ||||
| 				final List<Location> path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld()); | ||||
| 				final List<AbstractNodeLoc> path = PathFinding.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld(), true); | ||||
| 				if (path == null) | ||||
| 				{ | ||||
| 					BuilderUtil.sendSysMessage(activeChar, "No Route!"); | ||||
| 					return true; | ||||
| 				} | ||||
| 				for (Location a : path) | ||||
| 				for (AbstractNodeLoc a : path) | ||||
| 				{ | ||||
| 					BuilderUtil.sendSysMessage(activeChar, "x:" + a.getX() + " y:" + a.getY() + " z:" + a.getZ()); | ||||
| 				} | ||||
|   | ||||
| @@ -72,7 +72,7 @@ public class AdminServerInfo implements IAdminCommandHandler | ||||
| 			html.replace("%slots%", getPlayersCount("ALL") + "/" + Config.MAXIMUM_ONLINE_USERS); | ||||
| 			html.replace("%gameTime%", GameTimeTaskManager.getInstance().getGameHour() + ":" + GameTimeTaskManager.getInstance().getGameMinute()); | ||||
| 			html.replace("%dayNight%", GameTimeTaskManager.getInstance().isNight() ? "Night" : "Day"); | ||||
| 			html.replace("%geodata%", Config.PATHFINDING ? "Enabled" : "Disabled"); | ||||
| 			html.replace("%geodata%", Config.PATHFINDING > 0 ? "Enabled" : "Disabled"); | ||||
| 			html.replace("%serverTime%", SDF.format(new Date(System.currentTimeMillis()))); | ||||
| 			html.replace("%serverUpTime%", getServerUpTime()); | ||||
| 			html.replace("%onlineAll%", getPlayersCount("ALL")); | ||||
|   | ||||
| @@ -52,7 +52,7 @@ public class Ground implements ITargetTypeHandler | ||||
| 					return null; | ||||
| 				} | ||||
| 				 | ||||
| 				if (!GeoEngine.getInstance().canSeeLocation(creature, worldPosition)) | ||||
| 				if (!GeoEngine.getInstance().canSeeTarget(creature, worldPosition)) | ||||
| 				{ | ||||
| 					if (sendMessage) | ||||
| 					{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment