Skip to content

Collision Box Functional Testing Plan

Ethan Roderick edited this page Oct 20, 2021 · 4 revisions

Description

This page documents the testing taken to validate the Sprint 4 changes to the hitbox/collision boxes. As the code regarding this feature concerns visual alignments and gameplay elements it was not properly testable using JUnit tests. As such, functional testing was conducted.

Methods Tested

The ColliderComponent class had several methods that revolved around the collision boxes, but the interaction with these methods was concentrated on two PhysicsUtils methods. As such, these were the methods that were tested (for both hitbox and collision box). These methods were:

  • PhysicsUtils.setColliderShape()
  • PhysicsUtils.setColliderOffset()

Replacing Collider with Hitbox for the equivalents.

Testing plan

The tests were quite simple, involving comparing the result after calling the method to a baseline value. These tests can be performed on any entity, so for ease of conducting, the player was chosen as the focus.

Steps:

  1. Enter game with base player ColliderComponent and HitboxComponent sizes, for reference.
  2. Alter the ColliderComponent with sides 2, 1 to test a non-square shape.
    1. Enter the game to check.
  3. Alter the ColliderComponent with sides 2, 2 to test a square shape.
    1. Enter the game to check.
  4. Reset the ColliderComponent to a shape with sides 0.5, 0.5 and give it an offset of 0.5, 0.5.
    1. Enter the game to check.
  5. Repeat steps 2-4 with HitboxComponent.

Results

The following screenshots correspond to the steps taken during the testing plan. These tests focused on the shape of the (quite hard to see) grey wireframes surrounding the placer. First is the base reference.

ColliderComponent:

Non-square:

Square:

Offset:

Upon testing the offset value, it is was seen that the collider box had shrunk in size, by approximately a factor of two. This was unintended behaviour and led the the finding of a bug in the code regarding retrieval of box size values. After fixing this bug, the results matched expectations.

Offset Ammended:

HitboxComponent:

Non-square:

Square:

Offset:

Clone this wiki locally