The challenges are setup up so that the player is given a 10 minute time frame to complete as many challenges as they can. During this period they can select easy, medium or hard challenges which score different amounts accordingly. They start the challenge by pulling the lever after pressing the difficulty button of the challenge they would like to do. They will then get a random challenge of that difficulty.
During the challenge they then have to stack as many boxes on the pallet as they can and then pull the lever to deliver the pallet. They will incur penalties for any unstacked boxes or any boxes that have been crushed. Crushed boxes also incur a time penalty.
The challenges are split into 3 difficulties, the easy challenges are challenges that only use the basic types of block: heavy, standard and light, plus the variations in size of those blocks. They also make minimal use of the waves system only delivering a few new blocks a most. The medium challenges introduce the fragile heavy blocks and start to make much more use of the wave system. Finally the hard challenges introduce blocks starting on the pallet. Each step up in difficulty is designed to make the player think more about the placement of the blocks by constraining the number of solutions possible. It is hard to quantify the exact number of solutions for any given challenge as there are a large number of configurations of the blocks on the pallet however by introducing these constraints we remove options reducing the available solution space.
Each of the challenges are intended to take approximately 2-3 minutes to complete allowing a player to complete 3-5 challenges in the allotted 10 minutes. The player is allowed to choose the difficulty of the challenges as they play them so that they can adjust their play for maximizing points or take on easier challenges to learn and improve.
Challenge Technical Setup
When setting up a challenge you can select which boxes you want to spawn by selecting them from the drop down (you can select any of the variations in size and weight that have a blueprint created for them) and you can set them up to spawn in waves. A new wave is spawned when the number of boxes stacked on the pallet reaches the number specified in the wave.
You can also choose to have boxes spawn already on the pallet by adding them to the array ‘ObjectsStaringOnPallet’ and setting a starting offset corresponding to the position on the pallet where you would like them to spawn, these boxes can’t be moved by the player. The final thing that can be specified is the size of the pallet by inputting 2×2 or 3×3 in the PalletType field. To add different pallets a new pallet blueprint child would need to be created.
The challenges are all set up in a data table so it’s straight forward to add and adjust challenges.
The code for starting and stopping the challenges as well as tracking the score etc can be found in the PalletStackerGameMode.
When a challenge is started I un-pause the timer and then get a random challenge of the selected difficulty from the data table. I then create the pallet and spawn in the boxes defined by the challenge. When stopping a challenge I do the opposite; clear the pallet and cash in the boxes updating the player score, the code here is very straight forward and just steps through the process as you would expect.
When spawning the boxes I retrieve the soft class references from the data table and the compare them to a list of box types stored in the gamemode to then spawn the appropriate box from that class.