Categories
Uncategorised

Resubmission Devlog BSC2A

11/07/22:

I have been tasked with completing the work that I had failed to finish during term 2. This includes;

The hypercasual game, the 3000 word essay, 4 of the CPP UE4 tasks, the personal planning folder,

a dev diary and the reflective learning summary, I also need to create a level for the collaborative

game made during the third term

I plan to create an endless runner with 3 lanes and obstacles that force the player to jump or crouch, in the style of Temple run 2 (reference) or Subway surfers (reference), The inputs will be sliding which I will handle by taking where they start the motion and then getting the direction to perform one of four actions moving left, moving right, jumping or crouching

17/07/22:

note version: UE4 default scene root causing issues in character blueprint, not being overriden by my own root component, fixed by remaking the player blueprint.

Installed Android studio and the UE4 Android SDK stuff to be able to test it on my phone.

UE4’s Android setup bat wasnt working due to an incorrect (presumably older) folder path, once fixed worked fine

Touch inputs set up, didnt define a function correctly leading to an error when constructing it, missed the “AMyClass::” before the function name

To create a sliding input system I will take the location that the player starts their touch and compare it to where they end their touch, using this to understand if they want to jump, duck or move left and right

PYTHAGORUS ADDING VECTOR A’s sq(X^2 + Y^2) THEN COMPARING TO VECTOR B’s sq(X^2 + Y^2)

UP EXAMPLE: (.5, .5) – (.6, .2) -> sq(5) sq(4) -> 2.23 – 2
LEFT EXAMPLE: (.5, .5) – (.3, .4) -> sq(5) sq(2.7) -> 2.23 – 1.64 (POOR MATHS IGNORE, DOESNT WORK ANYWAY)

PYTHAGORUS ADDING VECTOR A’s X AND VECTOR B’s X

UP EXAMPLE: (.5, .5) – (.6, .2) -> sq(.25 + .36) sq (.25 + .04) -> sq(.61) sq(.29) -> (.78, .53)

New plan: minus vector A and B X’s and Y’s, use that to make new vector and see if the hypotenuse of that is helpful

UP EXAMPLE: (.5, .5) – (.6, .2) -> (-.1, .3)

Newer plan, subtracted the two vectors from each other and then do two seperate comparisons, one for positive increase (gets the bigger positive for downward or right swipes)
and one for negative increases (for up or left swipes)

RIGHT EXAMPLE (.5, .5) – (.8, .4) -> (-.3, .1)

going to create four if statements one for each direction, it’ll check that the x / y is greater / less than a target number (0.1)

First we’ll check to see if X and or Y is positive so that we can do more accurate checks
if (X > 0)
//Positive (Left)
keep track of with bool xPositive
else
//Negative (Right)
if (Y > 0)
//Positive (Up)
else
//Negative (Down)

Added a preliminary check to make sure that neither value is within the dead zone (if either x or y is less than 0.1 and greater than -0.1 then we can skip checking)
otherwise we can just check if they’re negative and if they are times them by negative 1 to make them positive and then compare that, add something that keeps track of if
it was originally negative so we know direction and it should work

Moving down needs to both scale and move the player, an if statement handles slowly moving the player up the 25 units we move it down by so i should be able to use how
much its moving / how much it needs to move in order to know what scale it needs to be at from 0.5 to 1 so thats a ratio between 0.5 and 25 (0.02 in scale for each unit) so we’ll get the position per tick (the position will only be between 25 and 50 unless they move up which I’ll have a reset for) and times it by 0.02 to get what scale we should be at

This handles the touch input and saves where the player started touching and stopped touching for use later, it then shrinks the touch inputs to the actual viewport / screen size before getting the final float values which are the starting and end points subtracted
This first checks to see if either x or y from the previous step are negative and if they are they’re made positive but it is saved that they started out negative, the x and y is compared to see which is longer (and therefore the intended direction) before a last check to see if the longer value was originally negative. The outcome of this gives us one of four directions, Up Down Left or Right. The next section handles whichever one it was, if left or right then it checks that the player isnt too far left or right and then moves them by a set amount and increases the value that keeps track of them (its a 0 – 2 int which represents the 3 possible locations). For the up the cube is raised into the air and then an if statement brings it down at a fixed speed. For the down the cubes scale is reduced to half and the position is lowered, the scale is then risen proportionally with the position

28/07/22

Creating an object spawner:
trying to have an array of objects which will be randomly chosen from when an obstacle needs to be spawned, however the spawnactor function requires a class as the input and I do not know the class, I have a few options on how to deal with this, I can either create many different spawnactor calls behind a switch statement and check which is wanted or I can try to figure out how to use the array with the spawnactor call so that I only need one. I went for the latter as I want this to be scale-able even for a short project as I do not know how many obstacles I will make

After being unsuccessful in my attempts to spawn objects using the SpawnActor function I will instead create a blueprint of my C++ class and use the function in that as I have seen examples where this had worked

I moved most of my code over to blueprint but I kept a function to choose a spawn point for the obstacle at random as I do not know how to do this in Blueprint

I have added a second random range function to the timer as I want the obstacle spawning to feel random so the time needed can be half or double of the normal spawn timer

I’m going to use the gamemodebase c++ class in order to make a score counter that’ll increase with time, I hope to also use this score counter to either decrease the time between obstacle spawns or increase the speed of the obstacles, or both.

I have instead used the player class and kept the score in there as it doesnt change anything keeping it outside of the player class along with using the score to decrease the time before spawns and increase the speed of the obstacles