New l2j geoengine rework.
This commit is contained in:
		| @@ -6,33 +6,44 @@ | ||||
| # at different folder/harddrive ("C:/Program Files/Lineage II/system/geodata/"), default: ./data/geodata/ | ||||
| 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 | ||||
|  | ||||
| # ================================================================= | ||||
| #                           Path finding | ||||
| #                           Pathfinding | ||||
| # ================================================================= | ||||
|  | ||||
| # 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 | ||||
| # an alternative path (e.g. walk around obstacle), default: True | ||||
| PathFinding = True | ||||
|  | ||||
| # Pathfinding array buffers configuration, default: 100x6;128x6;192x6;256x4;320x4;384x4;500x2 | ||||
| PathFindBuffers = 100x6;128x6;192x6;256x4;320x4;384x4;500x2 | ||||
| # Pathfinding array buffers configuration, default: 500x10;1000x10;3000x5;5000x3;10000x3 | ||||
| PathFindBuffers = 500x10;1000x10;3000x5;5000x3;10000x3 | ||||
|  | ||||
| # Weight for nodes without obstacles far from walls | ||||
| LowWeight = 0.5 | ||||
| # Movement weight, when moving from one to another axially and diagonally, default: 10 and 14 | ||||
| MoveWeight = 10 | ||||
| MoveWeightDiag = 14 | ||||
|  | ||||
| # Weight for nodes near walls | ||||
| MediumWeight = 2 | ||||
| # 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 | ||||
|  | ||||
| # Weight for nodes with obstacles | ||||
| HighWeight = 3 | ||||
| # 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. | ||||
| # Default: LowWeight * sqrt(2)  | ||||
| DiagonalWeight = 0.707 | ||||
| # Maximum number of generated nodes per one path-finding process, default 3500 | ||||
| MaxIterations = 3500 | ||||
|  | ||||
| # ================================================================= | ||||
| #                               Other | ||||
| #                           Line of Sight | ||||
| # ================================================================= | ||||
|  | ||||
| # Correct player Z after falling through the ground. | ||||
| CorrectPlayerZ = False | ||||
| # 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 | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -23,8 +23,8 @@ a - Prerequisites | ||||
| b - Make it work | ||||
| ---------------------------------------------- | ||||
|  | ||||
| To make geodata working: | ||||
| * unpack your geodata files into "/data/geodata" folder | ||||
| * open "/config/GeoEngine.ini" with your favorite text editor and then edit following config: | ||||
|   - CoordSynchronize = 2 | ||||
| * If you do not use any geodata files, the server will automatically change this setting to -1. | ||||
| 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. | ||||
|   | ||||
| @@ -270,7 +270,7 @@ public class PrimevalIsle extends AbstractNpcAI | ||||
| 					final double cos = Math.cos(radian); | ||||
| 					final int newX = (int) (npc.getX() + (cos * distance)); | ||||
| 					final int newY = (int) (npc.getY() + (sin * distance)); | ||||
| 					final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceId()); | ||||
| 					final Location loc = GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), newX, newY, npc.getZ(), npc.getInstanceId()); | ||||
| 					npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc, 0); | ||||
| 				} | ||||
| 				else if (ag_type == 1) | ||||
|   | ||||
| @@ -69,7 +69,7 @@ public class FleeMonsters extends AbstractNpcAI | ||||
| 		final int posX = (int) (npc.getX() + (FLEE_DISTANCE * Math.cos(radians))); | ||||
| 		final int posY = (int) (npc.getY() + (FLEE_DISTANCE * Math.sin(radians))); | ||||
| 		final int posZ = npc.getZ(); | ||||
| 		final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, attacker.getInstanceId()); | ||||
| 		final Location destination = GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceId()); | ||||
| 		npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination); | ||||
| 		return super.onAttack(npc, attacker, damage, isSummon); | ||||
| 	} | ||||
|   | ||||
| @@ -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.getInstance().getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.getInstance().getGeoY(worldY); | ||||
| 				final int geoX = GeoEngine.getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.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.getInstance().getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.getInstance().getGeoY(worldY); | ||||
| 				final int geoX = GeoEngine.getGeoX(worldX); | ||||
| 				final int geoY = GeoEngine.getGeoY(worldY); | ||||
| 				 | ||||
| 				if (GeoEngine.getInstance().hasGeoPos(geoX, geoY)) | ||||
| 				{ | ||||
| @@ -133,8 +133,8 @@ public class AdminGeodata implements IAdminCommandHandler | ||||
| 			} | ||||
| 			case "admin_geomap": | ||||
| 			{ | ||||
| 				final int x = ((activeChar.getX() - World.MAP_MIN_X) >> 15) + World.TILE_X_MIN; | ||||
| 				final int y = ((activeChar.getY() - World.MAP_MIN_Y) >> 15) + World.TILE_Y_MIN; | ||||
| 				final int x = ((activeChar.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; | ||||
| 				final int y = ((activeChar.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; | ||||
| 				BuilderUtil.sendSysMessage(activeChar, "GeoMap: " + x + "_" + y + " (" + ((x - World.TILE_ZERO_COORD_X) * World.TILE_SIZE) + "," + ((y - World.TILE_ZERO_COORD_Y) * World.TILE_SIZE) + " to " + ((((x - World.TILE_ZERO_COORD_X) * World.TILE_SIZE) + World.TILE_SIZE) - 1) + "," + ((((y - World.TILE_ZERO_COORD_Y) * World.TILE_SIZE) + World.TILE_SIZE) - 1) + ")"); | ||||
| 				break; | ||||
| 			} | ||||
|   | ||||
| @@ -19,9 +19,9 @@ package handlers.admincommandhandlers; | ||||
| import java.util.List; | ||||
|  | ||||
| import org.l2jmobius.Config; | ||||
| import org.l2jmobius.gameserver.geoengine.GeoEnginePathfinding; | ||||
| import org.l2jmobius.gameserver.geoengine.pathfinding.AbstractNodeLoc; | ||||
| import org.l2jmobius.gameserver.geoengine.GeoEngine; | ||||
| import org.l2jmobius.gameserver.handler.IAdminCommandHandler; | ||||
| import org.l2jmobius.gameserver.model.Location; | ||||
| import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; | ||||
| import org.l2jmobius.gameserver.util.BuilderUtil; | ||||
|  | ||||
| @@ -44,13 +44,13 @@ public class AdminPathNode implements IAdminCommandHandler | ||||
| 			} | ||||
| 			if (activeChar.getTarget() != null) | ||||
| 			{ | ||||
| 				final List<AbstractNodeLoc> path = GeoEnginePathfinding.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId()); | ||||
| 				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.getInstanceId()); | ||||
| 				if (path == null) | ||||
| 				{ | ||||
| 					BuilderUtil.sendSysMessage(activeChar, "No Route!"); | ||||
| 					return true; | ||||
| 				} | ||||
| 				for (AbstractNodeLoc a : path) | ||||
| 				for (Location a : path) | ||||
| 				{ | ||||
| 					BuilderUtil.sendSysMessage(activeChar, "x:" + a.getX() + " y:" + a.getY() + " z:" + a.getZ()); | ||||
| 				} | ||||
|   | ||||
| @@ -68,7 +68,7 @@ public class Blink extends AbstractEffect | ||||
| 		final int x = effected.getX() + x1; | ||||
| 		final int y = effected.getY() + y1; | ||||
| 		final int z = effected.getZ(); | ||||
| 		final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId()); | ||||
| 		final Location destination = GeoEngine.getInstance().getValidLocation(effected.getX(), effected.getY(), effected.getZ(), x, y, z, effected.getInstanceId()); | ||||
| 		effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); | ||||
| 		effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.DUMMY)); | ||||
| 		effected.abortAttack(); | ||||
|   | ||||
| @@ -90,7 +90,7 @@ public class EnemyCharge extends AbstractEffect | ||||
| 		final int x = curX + (int) ((distance - offset) * cos); | ||||
| 		final int y = curY + (int) ((distance - offset) * sin); | ||||
| 		final int z = info.getEffected().getZ(); | ||||
| 		final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId()); | ||||
| 		final Location destination = GeoEngine.getInstance().getValidLocation(info.getEffector().getX(), info.getEffector().getY(), info.getEffector().getZ(), x, y, z, info.getEffector().getInstanceId()); | ||||
| 		info.getEffector().broadcastPacket(new FlyToLocation(info.getEffector(), destination, FlyType.CHARGE)); | ||||
| 		 | ||||
| 		// maybe is need force set X,Y,Z | ||||
|   | ||||
| @@ -236,7 +236,7 @@ public class Fishing extends AbstractEffect | ||||
| 		 | ||||
| 		// always use water zone, fishing zone high z is high in the air... | ||||
| 		final int baitZ = waterZone.getWaterZ(); | ||||
| 		if (!GeoEngine.getInstance().canSeeTarget(player, new Location(baitX, baitY, baitZ))) | ||||
| 		if (!GeoEngine.getInstance().canSeeLocation(player, new Location(baitX, baitY, baitZ))) | ||||
| 		{ | ||||
| 			return Integer.MIN_VALUE; | ||||
| 		} | ||||
|   | ||||
| @@ -82,7 +82,7 @@ public class TeleportToTarget extends AbstractEffect | ||||
| 		final int x = (int) (px + (25 * Math.cos(ph))); | ||||
| 		final int y = (int) (py + (25 * Math.sin(ph))); | ||||
| 		final int z = target.getZ(); | ||||
| 		final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(creature.getX(), creature.getY(), creature.getZ(), x, y, z, creature.getInstanceId()); | ||||
| 		final Location loc = GeoEngine.getInstance().getValidLocation(creature.getX(), creature.getY(), creature.getZ(), x, y, z, creature.getInstanceId()); | ||||
| 		creature.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); | ||||
| 		creature.broadcastPacket(new FlyToLocation(creature, loc.getX(), loc.getY(), loc.getZ(), FlyType.DUMMY)); | ||||
| 		creature.abortAttack(); | ||||
|   | ||||
| @@ -93,7 +93,7 @@ public class ThrowUp extends AbstractEffect | ||||
| 		final int x = info.getEffector().getX() - (int) (offset * cos); | ||||
| 		final int y = info.getEffector().getY() - (int) (offset * sin); | ||||
| 		final int z = info.getEffected().getZ(); | ||||
| 		final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId()); | ||||
| 		final Location destination = GeoEngine.getInstance().getValidLocation(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), x, y, z, info.getEffected().getInstanceId()); | ||||
| 		info.getEffected().broadcastPacket(new FlyToLocation(info.getEffected(), destination, FlyType.THROW_UP)); | ||||
| 		// TODO: Review. | ||||
| 		info.getEffected().setXYZ(destination); | ||||
|   | ||||
| @@ -65,7 +65,7 @@ public class RollingDice implements IItemHandler | ||||
| 		final int x = player.getX() + x1; | ||||
| 		final int y = player.getY() + y1; | ||||
| 		final int z = player.getZ(); | ||||
| 		final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(player.getX(), player.getY(), player.getZ(), x, y, z, player.getInstanceId()); | ||||
| 		final Location destination = GeoEngine.getInstance().getValidLocation(player.getX(), player.getY(), player.getZ(), x, y, z, player.getInstanceId()); | ||||
| 		Broadcast.toSelfAndKnownPlayers(player, new Dice(player.getObjectId(), itemId, number, destination.getX(), destination.getY(), destination.getZ())); | ||||
| 		 | ||||
| 		final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_ROLLED_A_S2); | ||||
|   | ||||
| @@ -677,7 +677,7 @@ public class CrystalCaverns extends AbstractInstance | ||||
| 		final int _x = effector.getX() - (int) (offset * cos); | ||||
| 		final int _y = effector.getY() - (int) (offset * sin); | ||||
| 		final int _z = effected.getZ(); | ||||
| 		final Location destination = GeoEngine.getInstance().canMoveToTargetLoc(effected.getX(), effected.getY(), effected.getZ(), _x, _y, _z, effected.getInstanceId()); | ||||
| 		final Location destination = GeoEngine.getInstance().getValidLocation(effected.getX(), effected.getY(), effected.getZ(), _x, _y, _z, effected.getInstanceId()); | ||||
| 		effected.broadcastPacket(new FlyToLocation(effected, destination, FlyType.THROW_UP)); | ||||
| 		 | ||||
| 		// maybe is need force set X,Y,Z | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment