diff --git a/core/src/io/anuke/mindustry/ai/Pathfinder.java b/core/src/io/anuke/mindustry/ai/Pathfinder.java index 958911ccba..39502d2dbd 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfinder.java +++ b/core/src/io/anuke/mindustry/ai/Pathfinder.java @@ -109,7 +109,7 @@ public class Pathfinder{ //add all targets to the frontier for(Tile other : world.indexer.getEnemy(team, BlockFlag.target)){ path.weights[other.x][other.y] = 0; - path.searches[other.x][other.y] = path.search; + path.searches[other.x][other.y] = (short)path.search; path.frontier.addFirst(other); } } @@ -117,6 +117,8 @@ public class Pathfinder{ private void createFor(Team team){ PathData path = new PathData(); + path.weights = new float[world.width()][world.height()]; + path.searches = new short[world.width()][world.height()]; path.search++; path.frontier.ensureCapacity((world.width() + world.height()) * 3); @@ -130,7 +132,7 @@ public class Pathfinder{ && tile.block().flags.contains(BlockFlag.target)){ path.frontier.addFirst(tile); path.weights[x][y] = 0; - path.searches[x][y] = path.search; + path.searches[x][y] = (short)path.search; }else{ path.weights[x][y] = Float.MAX_VALUE; } @@ -159,7 +161,7 @@ public class Pathfinder{ && passable(other, team)){ path.frontier.addFirst(world.tile(dx, dy)); path.weights[dx][dy] = cost + other.cost; - path.searches[dx][dy] = path.search; + path.searches[dx][dy] = (short)path.search; } } } @@ -186,14 +188,9 @@ public class Pathfinder{ class PathData{ float[][] weights; - int[][] searches; + short[][] searches; int search = 0; long lastSearchTime; Queue frontier = new Queue<>(); - - PathData(){ - weights = new float[world.width()][world.height()]; - searches = new int[world.width()][world.height()]; - } } } diff --git a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java index 680c007cfa..0724f3b11f 100644 --- a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java @@ -21,6 +21,7 @@ import static io.anuke.mindustry.Vars.*; public class BlockRenderer{ private final static int initialRequests = 32 * 32; private final static int expandr = 6; + private final static boolean disableShadows = true; public final FloorRenderer floor = new FloorRenderer(); @@ -53,6 +54,8 @@ public class BlockRenderer{ } public void drawShadows(){ + if(disableShadows) return; + if(shadows.getWidth() != Core.graphics.getWidth() || shadows.getHeight() != Core.graphics.getHeight()){ shadows.resize(Core.graphics.getWidth(), Core.graphics.getHeight()); } @@ -107,7 +110,6 @@ public class BlockRenderer{ if(tile != null){ Block block = tile.block(); - Team team = tile.getTeam(); if(!expanded && block != Blocks.air && world.isAccessible(x, y)){ tile.block().drawShadow(tile); @@ -133,8 +135,6 @@ public class BlockRenderer{ } } - Draw.proj(camera.projection()); - Sort.instance().sort(requests.items, 0, requestidx); lastCamX = avgx; diff --git a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java index e37eeee4de..6f08fa9441 100644 --- a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java @@ -11,6 +11,7 @@ import io.anuke.arc.graphics.GL20; import io.anuke.arc.graphics.g2d.CacheBatch; import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.SpriteBatch; +import io.anuke.arc.graphics.g2d.SpriteCache; import io.anuke.arc.math.Mathf; import io.anuke.arc.util.Log; import io.anuke.arc.util.Structs; @@ -30,6 +31,7 @@ public class FloorRenderer{ private CacheBatch cbatch; private IntSet drawnLayerSet = new IntSet(); private IntArray drawnLayers = new IntArray(); + private ObjectSet used = new ObjectSet<>(); public FloorRenderer(){ Events.on(WorldLoadEvent.class, event -> clearTiles()); @@ -142,10 +144,9 @@ public class FloorRenderer{ } private void cacheChunk(int cx, int cy){ + used.clear(); Chunk chunk = cache[cx][cy]; - ObjectSet used = new ObjectSet<>(); - for(int tilex = cx * chunksize; tilex < (cx + 1) * chunksize; tilex++){ for(int tiley = cy * chunksize; tiley < (cy + 1) * chunksize; tiley++){ Tile tile = world.tile(tilex, tiley); @@ -195,7 +196,8 @@ public class FloorRenderer{ int chunksx = Mathf.ceil((float) (world.width()) / chunksize), chunksy = Mathf.ceil((float) (world.height()) / chunksize) ; cache = new Chunk[chunksx][chunksy]; - cbatch = new CacheBatch(world.width() * world.height()); + SpriteCache sprites = new SpriteCache(world.width() * world.height(), (world.width() / chunksize) * (world.height() / chunksize) * 2, false); + cbatch = new CacheBatch(sprites); Time.mark(); diff --git a/core/src/io/anuke/mindustry/maps/WorldGenerator.java b/core/src/io/anuke/mindustry/maps/WorldGenerator.java index c0a076f6cf..3c7666008a 100644 --- a/core/src/io/anuke/mindustry/maps/WorldGenerator.java +++ b/core/src/io/anuke/mindustry/maps/WorldGenerator.java @@ -141,8 +141,8 @@ public class WorldGenerator{ int sx = (short)Mathf.range(Short.MAX_VALUE/2); int sy = (short)Mathf.range(Short.MAX_VALUE/2); - int width = 380; - int height = 380; + int width = 512; + int height = 512; Array spawns = new Array<>(); Array ores = Item.getAllOres();