UI Implementation - UQdeco2800/2022-studio-1 GitHub Wiki

1.0 The Approach

All UI components were developed using Pixilart, a free online pixelated art drawing tool, by starting off with a canvas size in proportion to standard full-screen resolution (w: 1920px, 1080px). The chosen canvas size was 480px by 270px as Pixilart limited its max canvas size to 700px by 700px. Additionally, starting off with a quarter of the game resolution meant that the UI components maintained their respective sizing in the game and that each component would get exported by 4 times, enforcing the pixelated style of the game. Consequently, they would not require to be manually scaled up as that would result in jeopardising their quality.

image Figure 1: Exporting procedure in Pixilart


2.0 Button Development

Following the principle stated in 1.0 The Approach, buttons were designed keeping into consideration the relative scale of the buttons to the screen. Buttons were designed with 1px thick black outline. Shading of the button was also done in a particular way, as detailed in 2.2.2 Button Colours & Shading below.

2.1 Button Sizing

Three different button sizes (pre-scaled) were chosen in development:

  1. 15px by 15px - Default/simple button size
  2. 29px by 15px - Rectangular button size for buttons with critical impact (i.e. exit game button)
  3. 64px by 20px - Unique to the Main Menu Screen

image

Figure 2: Button sizes (1-3) shown for comparison to one another

All other buttons were designed to fit this sizing guideline that was produced.

2.2 Button Style

2.2.1 Button Type

Buttons were designed as either:

  • Rounded rectangular (15px by 15px or 29px by 15px) (as in Button Size 1 and 2 in Figure 2, above)
  • Circular (15px by 15px) - Implemented for more concise buttons
  • Abstract (MAX: 64px by 20px) - For freestyle buttons (i.e. Start Button in Figure 2)

The three different buttons style enforced the pixelated design style of the game in three unique ways but by still maintaining consistency of UI Elements in general. Consistency was primarily maintained with the type of shading implemented (as detailed in 2.2.2 Button Colours & Shading below).

2.2.2 Button Colours & Shading

Since the game being developed is a detailed pixelated game, there was no restriction on colours as long as there was enough contract and clarity. For the development of buttons, four steps were taken to ensure consistency:

  1. Create button outline
  2. Add base colour
  3. Add shades and tints
  4. Create button icon
  5. Overlay button icon on button frame

image

Figure 3: Steps taken to ensure consistency in button development through shading

To create the correct shades and tints in Pixilart, the Lighten/Darken (D) tool was utilised. To create the darkest shade, a darkening of strength 0.3 (30% darker) was implemented. Similarly, the second darkest shade with strength 0.1 (10% darker); and the tint with lightening strength 0.2 (20% lighter) was implemented.

The button icon was developed separately and was overlaid on top of the button at the last step.

2.3 Button Icon

To ensure enough contrast was present between the button frame and icon, a black icon was added around the icon. This was only implemented in two scenarios:

  1. The base button colour and primary icon colour had the same brightness or similar hue
  2. The icon already implemented black in its detailing

In Scenario 2, the presence of black detailing without a black outline would result in an inconsistent button design. An example in shown below in Figure 4.

image

Figure 4: Shop button with outline (left) and without (right)

2.4 Button Clicked Effect

To achieve the clicked button effect [NOTE: functionally implemented in Sprint 2], each button was duplicated, with the duplicate buttons rendered slightly differently to achieve the clicked effect. This was achieved simply through using the Lighten/Darken (D) tool in Pixilart. A darken effect of 0.4 (40% darker) was used. This shades all colours, leaving the black outline the same (Refer to Figure 5 below to see the difference)

image

Figure 5: Button (left) with its associated clicked effect rendered version (right)

2.5 Button Revision

Through user feedback, some of buttons underwent revisions as detailed in User Testing One: Simple Button Design.


3.0 Background & Title

The background and title were inspired by the concept of Atlantis Sinks with ties to the sunken city, ocean and prized crystal.

3.1 Background

The background was developed by creating a canvas scaled down 24 times from full-screen resolution. This ensures that pixelated theme of the game was maintained and that a scale up would enforce the style with defined pixel boundaries. The inspiration was taken from a sunken depiction of The City of Atlantis, showing ruins of temples and the lost city's building rubble of the rocky sea floor.

The background was developed using a base colour of #2DB7B9 and applying a darker shade to depict the sea floor. The underwater terrain was made by creating larger rocks on the sides and adding tints and white where the light would reach. A vague (almost blurry) sunken City of Atlantis was drawn on by creating pillar like structures.

The final artwork was exported and up-scaled by a factor of 24.

image

Figure 6: Sunken (A Depiction of The City of Atlantis)

3.2 Title

The title employed the colour scheme outlined in the design guidelines, namely the HEX codes #2A9D8F, #264653 and #E0B0FF. This was a combination of the crystal and buttons' colour schemes. The title was created using pixel art software on a canvas that is considered a standard full-screen resolution (outlined above). The following are the steps broken down to construct this logo...

  1. For the text select the 'Newspaper' font found in the built-in text tool and change the text colour code #264653.
  2. Type the entire word 'Atlantis Sinks'.
  3. Use the gradient tool and select the colour #2A9D8F to apply the gradient over the text, and have the following gradient settings ticked: transparent secondary and bucket all colours.
  4. Then use the lasso tool, select 'Sinks' and move this beneath 'Atlantis'.
  5. Create the crystal by drawing the gem shape and using shades darker than #E0B0FF to create a shadowing effect.
  6. Repeat the same process in step 3 for the word 'Atlantis' but use the colour code #E0B0FF for the mauve gradient.
  7. Then lighten and brighten the entire word 'Atlantis Sinks' by 80% using the lighten/darken (D) tool.

image

4.0 Code

The main aspects of implementation, in this case, is adding the background and adding images into the game. The method used below is purely for placeholder purposes and will not be the final implementation for this code. In future an atlas will be used with a JSON file, so skins will just be called.

4.1 Implementing the background

// Background Colour
Texture colour = new Texture(Gdx.files.internal("images/uiElements/exports/background.png"));
Drawable backgroundColour = new TextureRegionDrawable(colour);
rootTable.setBackground(backgroundColour);

The code above is how we added the background elements, in this case, it is for the settings page, but the same processes was used for the main menu page.

This code makes the PNG file a texture and then makes it a drawable element, this is essential as the .setBackGround() call that was already established in the game only takes drawable textures. In this case, we set the background of the table in the page to the PNG. This works well as there is only one table in the page.

4.2 Implementing the PNG placeholder as buttons

Step one: Inserting an image in as a texture:

Texture achievementsTexture = new Texture(Gdx.files.internal("images/Achievements.png"));
TextureRegionDrawable upAchievements = new TextureRegionDrawable(achievementsTexture);
TextureRegionDrawable downAchievements = new TextureRegionDrawable(achievementsTexture);
ImageButton achievementsButton = new ImageButton(upAchievements, downAchievements);

Step two: Adding PNG placeholder to table, that has been established

leftSideTable.add(achievementsButton).left().bottom().size(100f, 100f);

In this example, there are placement calls for the table element such as .left(), .bottom() and .size() is used to scale down the element.

Step one and two were performed on the MainGameInterface, PlayerStatsDisplay, MainGameExitDisplay and MainGameDisplay.

All images also must be loaded into the game. This is done by adding the file path to MainGameScreen or MainMenuScreen, depending on where you would like to add the image. Below is a section from MainGameScreen, and the Textures that were loaded in.

 private static final String[] mainGameTextures = {
     "images/uiElements/exports/heart.png",
     "images/uiElements/exports/coin.png",
     "images/healthBar.png",
     "images/uiElements/exports/crystal.png",
     "images/uiElements/exports/stone.png",
     "atlantisBasicBackground.png"
};

Classes

Below is a UML diagram of all UI classes and how they are linked: Untitled Diagram

Please note that each Screen is inherits a different part of the game but this section was not mapped out.