Skip to content

Map Design

chloemicah edited this page Oct 14, 2024 · 4 revisions

How The Map Was Designed

The map was created tile by tile using the following website https://www.piskelapp.com/. This allows the generation of .png files to create a custom map that suits the different kingdoms.

Map Graphics

The image below shows the 3 sections/themes of the Map (Land Kingdom first, Ocean Kingdom, then Air Kingdom). This image is also used for the Map Tab Feature.

Screenshot 2024-10-14 at 5 44 57 PM

For more information on the tiles used in the game, see https://github.com/UQcsse3200/2024-studio-2/wiki/Map-Tiles

Environmental Obstacles/Items

Several non-interactive items are strategically placed on the map to enhance the aesthetic appeal and create obstacles that players cannot traverse due to a Collider Function. This design choice adds complexity to player navigation, increasing the overall difficulty of the game.

Similar to the Map Tiles, these are also created on Piskel

image

Adding Obstacles/Items on Map

  1. Add image to textures.json file
  2. Specify number of spawns in entitySpawn.json file and initialise in EntitySpawnConfig.java
public int NUM_SEAWEED;
  1. Create Function to create Entity, adjust Collider function if needed.
  public static Entity createSeaweed() {
    Entity seaweed =
            new Entity()
                    .addComponent(new TextureRenderComponent("images/seaweed.png"))
                    .addComponent(new PhysicsComponent())
                    .addComponent(new ColliderComponent().setLayer(PhysicsLayer.OBSTACLE));
    seaweed.getComponent(PhysicsComponent.class).setBodyType(BodyType.StaticBody);
    seaweed.getComponent(TextureRenderComponent.class).scaleEntity();
    seaweed.scaleHeight(2.5f);
    PhysicsUtils.setScaledCollider(seaweed, 0.5f, 0.2f);
    return seaweed;
  }
  1. Create the function to Spawn the Entity in ForestGameArea.java and add function to create()
    public void create() {

        spawnSeaweed(2); // Specify zone in parameter: 1 - Land, 2 - Water, 3 - Air
} 

private void spawnSeaweed(int zone) {
        GridPoint2 minPos = new GridPoint2(0, AREA_SIZE.y * 16 * (zone - 1));
        GridPoint2 maxPos = new GridPoint2(AREA_SIZE.x * 16, AREA_SIZE.y * 16 * zone);

        for (int i = 0; i < ForestSpawnConfig.NUM_SEAWEED; i++) {
            GridPoint2 randomPos = RandomUtils.random(minPos, maxPos);
            Entity seaweed = ObstacleFactory.createSeaweed(); // Calling on the function created in step 3.
            spawnEntityAt(seaweed, randomPos, true, false);
        }
    }

Sketch

As seen in the sketch, the Map is composed of three sections with entities, minigames, and the games features spawned at specific areas. Initially, each section is separated by a door/gate but the final game, Kingdom's are separated by 'fog' which will disappear after the Final Boss is defeated. image

UML

In the image below, the UML diagram for the feature/map branch shows all the classes that the team members of the map team modified. The UML diagram also shows the new functions that were added in their respective classes. image

Sequence Diagram

image

Test Cases

 @Test
    void testSeaweedCreation() {
        assertNotNull(seaweed, "Seaweed should not be null");
    }
    
 @Test
    void testSeaweedEntityType() {
        assert(seaweed.getClass() == Entity.class);
    }

 @Test
    void testStarfishCreation() {
        assertNotNull(starfish, "Starfish should not be null");
    }
    
  @Test
    void testStarfishEntityType() {
        assert(starfish.getClass() == Entity.class);
    }

  @Test
    void testCloudCreation() {
        assertNotNull(cloud, "Cloud should not be null");
    }

  @Test
    void testCloudEntityType() {
        assert(cloud.getClass() == Entity.class);
    }

  @Test
    void testTreeCreation() {
        assertNotNull(tree, "Tree should not be null");
    }
  
  @Test
    void testTreeEntityType() {
        assert(tree.getClass() == Entity.class);
    }
Clone this wiki locally