1
0

9 Коммитууд a521c04abe ... 9fa8613e90

Эзэн SHA1 Мессеж Огноо
  Kajetan Johannes Hammerle 9fa8613e90 javadoc 4 жил өмнө
  Kajetan Johannes Hammerle c02ca52124 more generated water frames, water borders, new swamp tile 4 жил өмнө
  Leon Palluch 2c16d0b17d really fixed boat paths 4 жил өмнө
  SlightlyObscure c87dff010b added swimming animation 4 жил өмнө
  SlightlyObscure 091cf61dc5 added character skins 4 жил өмнө
  Ententerminator 2861ee740a added another swamp 4 жил өмнө
  Ententerminator 628680187c water edges and vertices 4 жил өмнө
  Leon Palluch 231901e716 Merge branch 'algorithm' 4 жил өмнө
  Leon Palluch 5076837b87 falschen 0er ausgebessert 4 жил өмнө
81 өөрчлөгдсөн 300 нэмэгдсэн , 26 устгасан
  1. BIN
      resources/character.png
  2. BIN
      resources/hiker.png
  3. BIN
      resources/hunter.png
  4. BIN
      resources/sailor.png
  5. BIN
      resources/swimmer.png
  6. BIN
      resources/tiles.png
  7. BIN
      resources/waves/wave10.png
  8. BIN
      resources/waves/wave11.png
  9. BIN
      resources/waves/wave12.png
  10. BIN
      resources/waves/wave13.png
  11. BIN
      resources/waves/wave14.png
  12. BIN
      resources/waves/wave15.png
  13. BIN
      resources/waves/wave16.png
  14. BIN
      resources/waves/wave17.png
  15. BIN
      resources/waves/wave18.png
  16. BIN
      resources/waves/wave19.png
  17. BIN
      resources/waves/wave2.png
  18. BIN
      resources/waves/wave20.png
  19. BIN
      resources/waves/wave21.png
  20. BIN
      resources/waves/wave22.png
  21. BIN
      resources/waves/wave23.png
  22. BIN
      resources/waves/wave24.png
  23. BIN
      resources/waves/wave25.png
  24. BIN
      resources/waves/wave26.png
  25. BIN
      resources/waves/wave27.png
  26. BIN
      resources/waves/wave28.png
  27. BIN
      resources/waves/wave29.png
  28. BIN
      resources/waves/wave3.png
  29. BIN
      resources/waves/wave30.png
  30. BIN
      resources/waves/wave31.png
  31. BIN
      resources/waves/wave32.png
  32. BIN
      resources/waves/wave33.png
  33. BIN
      resources/waves/wave34.png
  34. BIN
      resources/waves/wave35.png
  35. BIN
      resources/waves/wave36.png
  36. BIN
      resources/waves/wave37.png
  37. BIN
      resources/waves/wave38.png
  38. BIN
      resources/waves/wave39.png
  39. BIN
      resources/waves/wave4.png
  40. BIN
      resources/waves/wave40.png
  41. BIN
      resources/waves/wave41.png
  42. BIN
      resources/waves/wave42.png
  43. BIN
      resources/waves/wave43.png
  44. BIN
      resources/waves/wave44.png
  45. BIN
      resources/waves/wave45.png
  46. BIN
      resources/waves/wave46.png
  47. BIN
      resources/waves/wave47.png
  48. BIN
      resources/waves/wave48.png
  49. BIN
      resources/waves/wave49.png
  50. BIN
      resources/waves/wave5.png
  51. BIN
      resources/waves/wave50.png
  52. BIN
      resources/waves/wave51.png
  53. BIN
      resources/waves/wave52.png
  54. BIN
      resources/waves/wave53.png
  55. BIN
      resources/waves/wave54.png
  56. BIN
      resources/waves/wave55.png
  57. BIN
      resources/waves/wave56.png
  58. BIN
      resources/waves/wave57.png
  59. BIN
      resources/waves/wave58.png
  60. BIN
      resources/waves/wave59.png
  61. BIN
      resources/waves/wave6.png
  62. BIN
      resources/waves/wave60.png
  63. BIN
      resources/waves/wave7.png
  64. BIN
      resources/waves/wave8.png
  65. BIN
      resources/waves/wave9.png
  66. 15 0
      src/pathgame/algorithm/Coord.java
  67. 83 7
      src/pathgame/algorithm/DijkstraMagic.java
  68. 6 2
      src/pathgame/rendering/Camera.java
  69. 0 1
      src/pathgame/rendering/LevelRenderer.java
  70. 54 4
      src/pathgame/rendering/TileMapRenderer.java
  71. 13 0
      src/pathgame/rendering/TileRenderer.java
  72. 17 0
      src/pathgame/tilemap/HighMap.java
  73. 58 0
      src/pathgame/tilemap/Tile.java
  74. 4 0
      src/pathgame/tilemap/TileHomeTown.java
  75. 4 1
      src/pathgame/tilemap/TileMap.java
  76. 12 7
      src/pathgame/tilemap/TileMapGenerator.java
  77. 4 0
      src/pathgame/tilemap/TilePort.java
  78. 4 0
      src/pathgame/tilemap/TileRenderType.java
  79. 4 0
      src/pathgame/tilemap/TileTown.java
  80. 5 0
      src/pathgame/tilemap/TileType.java
  81. 17 4
      src/pathgame/tilemap/Tiles.java

BIN
resources/character.png


BIN
resources/hiker.png


BIN
resources/hunter.png


BIN
resources/sailor.png


BIN
resources/swimmer.png


BIN
resources/tiles.png


BIN
resources/waves/wave10.png


BIN
resources/waves/wave11.png


BIN
resources/waves/wave12.png


BIN
resources/waves/wave13.png


BIN
resources/waves/wave14.png


BIN
resources/waves/wave15.png


BIN
resources/waves/wave16.png


BIN
resources/waves/wave17.png


BIN
resources/waves/wave18.png


BIN
resources/waves/wave19.png


BIN
resources/waves/wave2.png


BIN
resources/waves/wave20.png


BIN
resources/waves/wave21.png


BIN
resources/waves/wave22.png


BIN
resources/waves/wave23.png


BIN
resources/waves/wave24.png


BIN
resources/waves/wave25.png


BIN
resources/waves/wave26.png


BIN
resources/waves/wave27.png


BIN
resources/waves/wave28.png


BIN
resources/waves/wave29.png


BIN
resources/waves/wave3.png


BIN
resources/waves/wave30.png


BIN
resources/waves/wave31.png


BIN
resources/waves/wave32.png


BIN
resources/waves/wave33.png


BIN
resources/waves/wave34.png


BIN
resources/waves/wave35.png


BIN
resources/waves/wave36.png


BIN
resources/waves/wave37.png


BIN
resources/waves/wave38.png


BIN
resources/waves/wave39.png


BIN
resources/waves/wave4.png


BIN
resources/waves/wave40.png


BIN
resources/waves/wave41.png


BIN
resources/waves/wave42.png


BIN
resources/waves/wave43.png


BIN
resources/waves/wave44.png


BIN
resources/waves/wave45.png


BIN
resources/waves/wave46.png


BIN
resources/waves/wave47.png


BIN
resources/waves/wave48.png


BIN
resources/waves/wave49.png


BIN
resources/waves/wave5.png


BIN
resources/waves/wave50.png


BIN
resources/waves/wave51.png


BIN
resources/waves/wave52.png


BIN
resources/waves/wave53.png


BIN
resources/waves/wave54.png


BIN
resources/waves/wave55.png


BIN
resources/waves/wave56.png


BIN
resources/waves/wave57.png


BIN
resources/waves/wave58.png


BIN
resources/waves/wave59.png


BIN
resources/waves/wave6.png


BIN
resources/waves/wave60.png


BIN
resources/waves/wave7.png


BIN
resources/waves/wave8.png


BIN
resources/waves/wave9.png


+ 15 - 0
src/pathgame/algorithm/Coord.java

@@ -2,12 +2,19 @@ package pathgame.algorithm;
 
 public class Coord {
     private int x, y;
+    private boolean boatTile = false;
 
     Coord(int x, int y) {
         this.x = x;
         this.y = y;
     }
 
+    Coord(int x, int y, boolean boatTile) {
+        this.x = x;
+        this.y = y;
+        this.boatTile = boatTile;
+    }
+
     int getX() {
         return x;
     }
@@ -28,4 +35,12 @@ public class Coord {
         this.x = x;
         this.y = y;
     }
+
+    public boolean isBoatTile() {
+        return boatTile;
+    }
+
+    public void setBoatTile(boolean boatTile) {
+        this.boatTile = boatTile;
+    }
 }

+ 83 - 7
src/pathgame/algorithm/DijkstraMagic.java

@@ -1,5 +1,6 @@
 package pathgame.algorithm;
 
+import org.w3c.dom.Node;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.TileType;
 import pathgame.tilemap.Tiles;
@@ -85,6 +86,8 @@ public class DijkstraMagic {
             }
         }
         if(forTown) {
+            //printPathMap();
+            //printPorts();
             makeListForPitch(fromIndex);
         }
         else {
@@ -114,10 +117,21 @@ public class DijkstraMagic {
             if(weightMap[posX][posY].hasExtraPaths()) {
                 ArrayList<ExtraPath> extraPaths = weightMap[posX][posY].getExtraPaths();
 
-                for(int i = 0; i < extraPaths.size(); i++) {
-                    ExtraPath path = extraPaths.get(i);
+                for(int p = 0; p < extraPaths.size(); p++) {
+                    ExtraPath path = extraPaths.get(p);
 
-                    adjacent(path.getDestX(), path.getDestY(), prevCost, '\0', path, i, tileQ, forTown);
+                    ArrayList<ExtraPath> foreingPaths = weightMap[path.getDestX()][path.getDestY()].getExtraPaths();
+                    int extraInd = -1;
+
+                    for(int forP = 0; forP < foreingPaths.size(); forP++) {
+                        ExtraPath fPath = foreingPaths.get(forP);
+                        if(fPath.getDestX() == posX && fPath.getDestY() == posY) {
+                            extraInd = forP;
+                            break;
+                        }
+                    }
+
+                    adjacent(path.getDestX(), path.getDestY(), prevCost, '\0', path, extraInd, tileQ, forTown);
                 }
             }
         }
@@ -161,7 +175,7 @@ public class DijkstraMagic {
                 weightMap[posX][posY].setPrevOfPath(dir);
             }
             else {
-                weightMap[posX][posY].setPrevBoatPath(0);
+                weightMap[posX][posY].setPrevBoatPath(extraInd);
             }
         }
 
@@ -195,7 +209,12 @@ public class DijkstraMagic {
         while(true) {
             char dir = weightMap[curPos.getX()][curPos.getY()].getPrevOfPath();
             int extraInd = weightMap[curPos.getX()][curPos.getY()].getPrevBoatPath();
-            coordList.add(new Coord(curPos.getX(), curPos.getY()));
+            if(forTown) {
+                coordList.add(new Coord(curPos.getX(), curPos.getY()));
+            }
+            else {
+                coordList.add(new Coord(curPos.getX(), curPos.getY(), true));
+            }
 
             if(dir == 'n') {
                 curPos.changeY(-1);
@@ -283,6 +302,11 @@ public class DijkstraMagic {
     }
 
     private void printDijkstraMap() {
+        String ANSI_RESET = "\u001B[0m";
+        String ANSI_BLUE = "\u001B[34m";
+        String ANSI_PURPLE = "\u001B[35m";
+        String ANSI_RED = "\u001B[31m";
+
         for(int y = 0; y < weightMap[0].length; y++) {
             for(int x = 0; x < weightMap.length; x++) {
                 int cost = weightMap[x][y].getCostSoFar();
@@ -290,8 +314,19 @@ public class DijkstraMagic {
                     System.out.print("- ");
                 }
                 else {
+                    if(weightMap[x][y].getType() == TileType.PORT) {
+                        System.out.print(ANSI_RED + cost + " " + ANSI_RESET);
+                    }
+                    else if (weightMap[x][y].getType() == TileType.SHALLOW_WATER) {
+                        System.out.print(ANSI_BLUE + cost + " " + ANSI_RESET);
+                    }
+                    else if (weightMap[x][y].isTown()) {
+                        System.out.print(ANSI_PURPLE + cost + " " + ANSI_RESET);
+                    }
+                    else {
+                        System.out.print(cost + " ");
+                    }
 
-                    System.out.print(cost + " ");
                 }
 
             }
@@ -304,12 +339,21 @@ public class DijkstraMagic {
     private void printDijkstraResult() {
         System.out.println();
 
+        String ANSI_RESET  = "\u001B[0m";
+        String ANSI_BLUE = "\u001B[34m";
+
         for(int origNum = 0; origNum < salesPitch.size(); origNum++) {
             for (int lNum = 0; lNum < salesPitch.get(origNum).size(); lNum++) {
                 System.out.print("Total Cost: " + salesPitch.get(origNum).get(lNum).getTotalCost() + "   ");
 
                 for (int lInd = 0; lInd < salesPitch.get(origNum).get(lNum).getPath().size(); lInd++) {
-                    System.out.print(salesPitch.get(origNum).get(lNum).getPath().get(lInd).getX() + "/" + salesPitch.get(origNum).get(lNum).getPath().get(lInd).getY() + " ");
+                    Coord c = salesPitch.get(origNum).get(lNum).getPath().get(lInd);
+                    if(c.isBoatTile()) {
+                        System.out.print(ANSI_BLUE + c.getX() + "/" + c.getY() + " " + ANSI_RESET);
+                    }
+                    else {
+                        System.out.print(c.getX() + "/" + c.getY() + " ");
+                    }
                 }
                 System.out.println();
             }
@@ -320,6 +364,38 @@ public class DijkstraMagic {
         System.out.println();
     }
 
+    private void printPorts() {
+        for(int y = 0; y < weightMap[0].length; y++) {
+            for(int x = 0; x < weightMap.length; x++) {
+                if(weightMap[x][y].hasExtraPaths()) {
+                    ArrayList<ExtraPath> extraPaths = weightMap[x][y].getExtraPaths();
+
+                    System.out.println(x + "/" + y);
+                    for (int i = 0; i < extraPaths.size(); i++) {
+                        System.out.println("port id: " + i + ", " + extraPaths.get(i).getDestX() + "/" + extraPaths.get(i).getDestY());
+                    }
+                    System.out.println();
+                }
+            }
+        }
+    }
+
+    private void printPathMap() {
+        for(int y = 0; y < weightMap[0].length; y++) {
+            for(int x = 0; x < weightMap.length; x++) {
+                if(weightMap[x][y].hasExtraPaths()) {
+                    System.out.print(weightMap[x][y].getPrevBoatPath() + " ");
+                }
+                else {
+                    System.out.print(weightMap[x][y].getPrevOfPath() + " ");
+                }
+            }
+            System.out.println();
+        }
+
+        System.out.println();
+    }
+
     private void printWeightMap() {
         String ANSI_RESET = "\u001B[0m";
         String ANSI_BLUE = "\u001B[34m";

+ 6 - 2
src/pathgame/gameplay/Camera.java → src/pathgame/rendering/Camera.java

@@ -1,4 +1,9 @@
-package pathgame.gameplay;
+package pathgame.rendering;
+
+import pathgame.gameplay.Gamestate;
+import pathgame.gameplay.Gamestates;
+import pathgame.gameplay.Keys;
+import pathgame.gameplay.Level;
 
 /**
  * A container for all camera specific functions
@@ -64,7 +69,6 @@ public class Camera
      *
      * @param zoomRestriction the lower zoom factor restriction (zooming out
      * restriction)
-     * @return a tile texture constructed from a given texture id
      */
     public void limitScale(float zoomRestriction)
     {

+ 0 - 1
src/pathgame/rendering/LevelRenderer.java

@@ -1,7 +1,6 @@
 package pathgame.rendering;
 
 import me.hammerle.snuviengine.api.Renderer;
-import pathgame.gameplay.Camera;
 import pathgame.gameplay.Gamestate;
 import pathgame.gameplay.Gamestates;
 import pathgame.gameplay.Level;

+ 54 - 4
src/pathgame/rendering/TileMapRenderer.java

@@ -9,6 +9,7 @@ import pathgame.gameplay.Player;
 import pathgame.tilemap.Tile;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.TileRenderType;
+import pathgame.tilemap.TileType;
 
 /**
  * A renderer for tile maps.
@@ -24,8 +25,9 @@ public class TileMapRenderer
 
     private final Texture tileTexture = new Texture("resources/tiles.png");
     private final TextureRenderer textureRenderer = new TextureRenderer(20 * 20 * 2); // default to 20x20 map
-    private final TextureRenderer swampWaterOverlayRenderer = new TextureRenderer(20 * 20 * 2); // default to 20x20 map
+    private final TextureRenderer waterOverlayRenderer = new TextureRenderer(20 * 20 * 2); // default to 20x20 map
     private final TextureRenderer waveRenderer = new TextureRenderer(20 * 20 * 2); // default to 20x20 map
+    private final TextureRenderer swampWaterOverlayRenderer = new TextureRenderer(20 * 20 * 2); // default to 20x20 map
     private final TextureRenderer grassOverlayRenderer = new TextureRenderer(20 * 20 * 2); // default to 20x20 map
     private float scale = 1.0f;
     
@@ -36,7 +38,7 @@ public class TileMapRenderer
     
     private static String[] getWavePath()
     {
-        String[] path = new String[20];
+        String[] path = new String[60];
         for(int i = 0; i < path.length; i++)
         {
             path[i] = "resources/waves/wave" + (i + 1) + ".png";
@@ -120,6 +122,11 @@ public class TileMapRenderer
     {
         return x >= 0 && y >= 0 && x < map.getWidth() && y < map.getHeight();
     }
+    
+    private boolean isShallowWater(TileMap map, int x, int y)
+    {
+        return isInRange(map, x, y) && map.getTile(x, y).getType() == TileType.SHALLOW_WATER;
+    }
 
     private boolean isSwamp(TileMap map, int x, int y)
     {
@@ -171,6 +178,42 @@ public class TileMapRenderer
         }
         addTileOverlay(swampWaterOverlayRenderer, x, y, index, 15);
     }
+    
+    private void addDeepWaterOverlay(TileMap map, int x, int y)
+    {
+        boolean n = isShallowWater(map, x, y - 1);
+        boolean e = isShallowWater(map, x + 1, y);
+        boolean s = isShallowWater(map, x, y + 1);
+        boolean w = isShallowWater(map, x - 1, y);
+
+        if(!n && !w && isShallowWater(map, x - 1, y - 1)) // upper, left corner
+        {
+            addTileOverlay(waterOverlayRenderer, x, y, 11, 13);
+        }
+        if(!n && !e && isShallowWater(map, x + 1, y - 1)) // upper, right corner
+        {
+            addTileOverlay(waterOverlayRenderer, x, y, 10, 13);
+        }
+        if(!s && !w && isShallowWater(map, x - 1, y + 1)) // lower, left corner
+        {
+            addTileOverlay(waterOverlayRenderer, x, y, 9, 13);
+        }
+        if(!s && !e && isShallowWater(map, x + 1, y + 1)) // lower, right corner
+        {
+            addTileOverlay(waterOverlayRenderer, x, y, 8, 13);
+        }
+
+        int index = 0;
+        index += n ? 0 : 8;
+        index += e ? 0 : 4;
+        index += s ? 0 : 2;
+        index += w ? 0 : 1;
+        if(index == 15)
+        {
+            return;
+        }
+        addTileOverlay(waterOverlayRenderer, x, y, index, 12);
+    }
 
     private void addGrassOverlay(TileMap map, int x, int y)
     {
@@ -212,8 +255,9 @@ public class TileMapRenderer
     private void updateData(TileMap map)
     {
         textureRenderer.clear();
-        swampWaterOverlayRenderer.clear();
+        waterOverlayRenderer.clear();
         waveRenderer.clear();
+        swampWaterOverlayRenderer.clear();    
         grassOverlayRenderer.clear();
         for(int x = 0; x < map.getWidth(); x++)
         {
@@ -227,6 +271,10 @@ public class TileMapRenderer
                 }
                 if(t.getRenderType() == TileRenderType.WATER)
                 {
+                    if(t.getType() == TileType.DEEP_WATER)
+                    {
+                        addDeepWaterOverlay(map, x, y);
+                    }
                     addWaterSwampOverlay(map, x, y);
                     addGrassOverlay(map, x, y);
                     addTileOverlay(waveRenderer, x, y, 8, 2);
@@ -239,8 +287,9 @@ public class TileMapRenderer
             }
         }
         textureRenderer.build();
-        swampWaterOverlayRenderer.build();
+        waterOverlayRenderer.build();
         waveRenderer.build();
+        swampWaterOverlayRenderer.build();
         grassOverlayRenderer.build();
     }
 
@@ -291,6 +340,7 @@ public class TileMapRenderer
         r.scale(scale, scale);
         r.updateMatrix();
         textureRenderer.draw();
+        waterOverlayRenderer.draw();
         waveRenderer.draw();
         swampWaterOverlayRenderer.draw();
         grassOverlayRenderer.draw();

+ 13 - 0
src/pathgame/rendering/TileRenderer.java

@@ -4,6 +4,10 @@ import pathgame.tilemap.Tile;
 import pathgame.tilemap.TileMap;
 import pathgame.tilemap.Tiles;
 
+/** Registry for rendering all possible tiles.
+ *
+ * @author kajetan
+ */
 public class TileRenderer
 {
     /** The unscaled render size of a map tile. */
@@ -42,6 +46,7 @@ public class TileRenderer
         register(Tiles.SWAMP, new StaticTextureProvider(TileTexture.fromTextureId(12)));
         register(Tiles.SWAMP_DECO, new StaticTextureProvider(TileTexture.fromTextureId(13)));
         register(Tiles.SWAMP_TREE, new StaticTextureProvider(TileTexture.fromTextureId(14)));
+        register(Tiles.SWAMP_BONES, new StaticTextureProvider(TileTexture.fromTextureId(41)));
         register(Tiles.TOWN, new StaticTextureProvider(TileTexture.fromTextureId(16)));
         register(Tiles.TOWN_BLOCKED_1, new StaticTextureProvider(TileTexture.fromTextureId(17)));
         register(Tiles.TOWN_BLOCKED_2, new StaticTextureProvider(TileTexture.fromTextureId(18)));
@@ -67,6 +72,14 @@ public class TileRenderer
         register(Tiles.PATH_N_E_S_W, new StaticTextureProvider(TileTexture.fromTextureId(38)));
     }
     
+    /** Returns a tile texture of a given map tile.
+     *
+     * @param map a map
+     * @param t a tile
+     * @param x the x coordinate of the given tile
+     * @param y the y coordinate of the given tile
+     * @return a tile texture of a given map tile
+     */
     public static TileTexture getTileTexture(TileMap map, Tile t, int x, int y)
     {
         if(t == null)

+ 17 - 0
src/pathgame/tilemap/HighMap.java

@@ -2,11 +2,22 @@ package pathgame.tilemap;
 
 import java.util.Random;
 
+/** Class for generating two dimensional highmaps of arbitrary size.
+ *
+ * @author kajetan
+ */
 public class HighMap
 {
     private static final float LOW_FREQUENCY = 8.0f;
     private static final float HIGH_FREQUENCY = 7.0f;
     
+    /** Returns a generated highmap.
+     *
+     * @param seed the seed for the highmap
+     * @param width the width of the highmap
+     * @param height the height of the highmap
+     * @return a generated highmap
+     */
     public static HighMap generate(long seed, int width, int height)
     {
         HighMap map = new HighMap(seed, width, height);
@@ -27,6 +38,12 @@ public class HighMap
         this.data = new float[width][height];
     }
     
+    /** Returns the value at the given position.
+     *
+     * @param x the x coordinate of a position
+     * @param y the y coordinate of a position
+     * @return the value at the given position
+     */
     public float get(int x, int y)
     {
         return data[x][y];

+ 58 - 0
src/pathgame/tilemap/Tile.java

@@ -9,6 +9,10 @@ import pathgame.gameplay.Player;
  */
 public class Tile
 {
+
+    /** A builder for tiles.
+     *
+     */
     public static class TileBuilder
     {
         private int energyCost = 2;
@@ -25,65 +29,114 @@ public class Tile
         {
         }
         
+        /** Returns a new tile builder;
+         *
+         * @return a new tile builder
+         */
         public static TileBuilder create()
         {
             return new TileBuilder();
         }
 
+        /** Sets the base energy cost of the tile.
+         *
+         * @param energyCost the base energy cost of the tile.
+         * @return the tile builder
+         */
         public TileBuilder setEnergyCost(int energyCost)
         {
             this.energyCost = energyCost;
             return this;
         }
 
+        /** Sets the chance that the tile can be replaced by forest.
+         *
+         * @param forestReplaceChance the chance that the tile can be replaced by forest.
+         * @return the tile builder
+         */
         public TileBuilder setForestReplaceChance(float forestReplaceChance)
         {
             this.forestReplaceChance = forestReplaceChance;
             return this;
         }
 
+        /** Sets the function for handling speed ups.
+         *
+         * @param speedUp a function.
+         * @return the tile builder
+         */
         public TileBuilder setSpeedUp(Function<Player, Integer> speedUp)
         {
             this.speedUp = speedUp;
             return this;
         }
 
+        /** Marks the tile as non host for towns.
+         *
+         * @return the tile builder
+         */
         public TileBuilder noTown()
         {
             this.canHostTown = false;
             return this;
         }
         
+        /** Marks the tile as blocked for every movement.
+         *
+         * @return the tile builder
+         */
         public TileBuilder noMovement()
         {
             this.blocksMovement = true;
             return this;
         }
         
+        /** Sets the type of the tile.
+         *
+         * @param type a tile type
+         * @return the tile builder
+         */
         public TileBuilder setType(TileType type)
         {
             this.type = type;
             return this;
         }
         
+        /** Marks the tile as host for paths.
+         *
+         * @return the tile builder
+         */
         public TileBuilder pathHost()
         {
             this.canHostPath = true;
             return this;
         }
         
+        /** Marks the tile as path.
+         *
+         * @return the tile builder
+         */
         public TileBuilder path()
         {
             this.path = true;
             return this;
         }
         
+        /** Sets the render type of the tile.
+         *
+         * @param type a render type
+         * @return the tile builder
+         */
         public TileBuilder setRenderType(TileRenderType type)
         {
             this.renderType = type;
             return this;
         }
         
+        /** Returns the built tile.
+         *
+         * @return the built tile.
+         */
         public Tile build()
         {
             return new Tile(energyCost, forestReplaceChance, speedUp, canHostTown, blocksMovement, type, canHostPath, path, renderType);
@@ -155,6 +208,11 @@ public class Tile
         return id;
     }
     
+    /** Returns the energy cost of a player on this tile.
+     *
+     * @param p a player
+     * @return the energy cost of a player on this tile
+     */
     public int getEnergyCost(Player p)
     {
         return energyCost - speedUp.apply(p);

+ 4 - 0
src/pathgame/tilemap/TileHomeTown.java

@@ -2,6 +2,10 @@ package pathgame.tilemap;
 
 import pathgame.gameplay.Player;
 
+/** Class for home towns to have special behaviour.
+ *
+ * @author kajetan
+ */
 public class TileHomeTown extends Tile
 {
     public TileHomeTown()

+ 4 - 1
src/pathgame/tilemap/TileMap.java

@@ -106,6 +106,9 @@ public class TileMap
         dirty = false;
     }
     
+    /** Ticks the tilemap.
+     *
+     */
     public void tick()
     {
         Iterator<TownConverter> iter = townConverters.iterator();
@@ -126,7 +129,7 @@ public class TileMap
         }
     }
     
-    /** Slowly Converts a tile into blocked town.
+    /** Slowly converts a tile into blocked town.
      *
      * @param x the x coordinate of the tile
      * @param y the y coordinate of the tile

+ 12 - 7
src/pathgame/tilemap/TileMapGenerator.java

@@ -3,6 +3,10 @@ package pathgame.tilemap;
 import java.util.ArrayList;
 import java.util.Random;
 
+/** Static class to generate tile maps.
+ *
+ * @author kajetan
+ */
 public class TileMapGenerator
 {
     private static long seed = 1;
@@ -66,7 +70,7 @@ public class TileMapGenerator
         int forestSize = ((width + height) / 2) / 10;
         forestSize *= forestSize;
         generateForest(map, r, forestSize, 10, 2, Tiles.FOREST);
-        generateForest(map, r, forestSize, 5, 2, Tiles.SWAMP, Tiles.SWAMP, Tiles.SWAMP_DECO, Tiles.SWAMP_TREE);
+        generateForest(map, r, forestSize, 5, 2, Tiles.SWAMP, Tiles.SWAMP, Tiles.SWAMP_DECO, Tiles.SWAMP_TREE, Tiles.SWAMP_BONES);
         
         generateTowns(map, r, towns);
         generatePorts(map, r);
@@ -130,12 +134,13 @@ public class TileMapGenerator
         {
             for(int y = 0; y < map.getHeight(); y++)
             {
-               if(map.getTile(x, y) == Tiles.SWAMP_TREE && 
-                       ((x > 0 && map.getTile(x - 1, y).getRenderType() != TileRenderType.SWAMP) || 
-                       (y > 0 && map.getTile(x, y - 1).getRenderType() != TileRenderType.SWAMP)))
-               {
-                   map.setTile(x, y, Tiles.SWAMP);
-               }
+                Tile t = map.getTile(x, y);
+                if((t == Tiles.SWAMP_TREE || t == Tiles.SWAMP_BONES) && 
+                        ((x > 0 && map.getTile(x - 1, y).getRenderType() != TileRenderType.SWAMP) || 
+                        (y > 0 && map.getTile(x, y - 1).getRenderType() != TileRenderType.SWAMP)))
+                {
+                    map.setTile(x, y, Tiles.SWAMP);
+                }
             }
         }
     }

+ 4 - 0
src/pathgame/tilemap/TilePort.java

@@ -3,6 +3,10 @@ package pathgame.tilemap;
 import pathgame.gameplay.Keys;
 import pathgame.gameplay.Player;
 
+/** Class for ports to have special behaviour.
+ *
+ * @author kajetan
+ */
 public class TilePort extends Tile
 {
     public TilePort()

+ 4 - 0
src/pathgame/tilemap/TileRenderType.java

@@ -1,5 +1,9 @@
 package pathgame.tilemap;
 
+/** Rendering types of tiles used for deciding which overlay should be used.
+ *
+ * @author kajetan
+ */
 public enum TileRenderType
 {
     WATER, SWAMP, NORMAL

+ 4 - 0
src/pathgame/tilemap/TileTown.java

@@ -2,6 +2,10 @@ package pathgame.tilemap;
 
 import pathgame.gameplay.Player;
 
+/** Class for towns to have special behaviour.
+ *
+ * @author kajetan
+ */
 public class TileTown extends Tile
 {
     public TileTown()

+ 5 - 0
src/pathgame/tilemap/TileType.java

@@ -1,5 +1,10 @@
 package pathgame.tilemap;
 
+/** Types of tiles used for deciding if a player can enter this tile in their
+ * current state.
+ *
+ * @author kajetan
+ */
 public enum TileType
 {
     PORT, LAND, SHALLOW_WATER, DEEP_WATER

+ 17 - 4
src/pathgame/tilemap/Tiles.java

@@ -2,6 +2,10 @@ package pathgame.tilemap;
 
 import pathgame.gameplay.PlayerAbilities;
 
+/** Static class for all existing tiles.
+ *
+ * @author kajetan
+ */
 public class Tiles
 {
 
@@ -32,6 +36,7 @@ public class Tiles
     public final static Tile SWAMP = buildSwamp();
     public final static Tile SWAMP_DECO = buildSwamp();
     public final static Tile SWAMP_TREE = buildSwamp();
+    public final static Tile SWAMP_BONES = buildSwamp();
     public final static Tile SHALLOW_WATER = Tile.TileBuilder.create()
             .setEnergyCost(6)
             .setForestReplaceChance(0.0f)
@@ -85,7 +90,7 @@ public class Tiles
 
     public final static Tile PORT = new TilePort();
 
-    public final static Tile buildGrass()
+    private final static Tile buildGrass()
     {
         return Tile.TileBuilder.create()
                 .setSpeedUp((p) -> p.getAbilities().getFasterGrass())
@@ -94,7 +99,7 @@ public class Tiles
                 .build();
     }
 
-    public final static Tile buildSwamp()
+    private final static Tile buildSwamp()
     {
         return Tile.TileBuilder.create()
                 .setEnergyCost(5)
@@ -104,7 +109,7 @@ public class Tiles
                 .build();
     }
 
-    public final static Tile buildBlockedTown()
+    private final static Tile buildBlockedTown()
     {
         return Tile.TileBuilder.create()
                 .setForestReplaceChance(0.0f)
@@ -114,7 +119,7 @@ public class Tiles
 
     public final static Tile HOME_TOWN = new TileHomeTown();
 
-    public final static Tile buildPath()
+    private final static Tile buildPath()
     {
         return Tile.TileBuilder.create()
                 .setForestReplaceChance(0.0f)
@@ -146,6 +151,14 @@ public class Tiles
         PATH_S_W, PATH_S, PATH_W, GRASS
     };
 
+    /** Returns a path with the given blocked directions.
+     *
+     * @param north true if there is a connection to the north tile
+     * @param east true if there is a connection to the east tile
+     * @param south true if there is a connection to the south tile
+     * @param west true if there is a connection to the west tile
+     * @return a path with the given blocked directions
+     */
     public static Tile getPath(boolean north, boolean east, boolean south, boolean west)
     {
         return PATH[(north ? 0 : 8) + (east ? 0 : 4) + (south ? 0 : 2) + (west ? 0 : 1)];