Grid Movement and Launching the Game Instance


Overview:
Hello, everybody and welcome to another week's blog post. This week I tackled the few things starting with the movement for a player on the grid which was easy yet painfully memorable. Then to finish off the week, I attacked the game instance and learning how to save information from between levels. Which is not is easy as I thought. Lets get started....

Problem 1
So the first problem I had this week. Start a with the players movement on the grid. What happened was originally the user would just click on the screen or on the tile causing they're character to just appear at that clicked location. However, we wanted the player to be able to traverse the tiles and walk on them. So it showed that the characters would take the most optimal path to that location. This is where my problem starts. The goal was to loop through the solution path to get the player to walk or animate on each of those tiles. NOT to make a B-line directly to the final destination. I realized that the player was trying to follow the path however the foreach loop was looping too fast resulting in the character walking straight to its destination. Instead of walking through each specific tile in the array. What made this so memorable was having to do it 3 times... because Unreal Engine crashed at random [ this is just a side note haha]. Nevertheless, I had to figure out a way around this problem. Which was quite unique...

Solution 1
 The way I solved this problem was fairly intriguing to say to least. So I knowing that the for each loop was going too fast causing the player just walked to the finished location instead of taking the desired path. So I thought hey let's add a DELAY call. Nope... can't do that when you call the foreach loop.... But you can create a Macro with the foreach loop logic and add the delay in there. Boom it worked. Now the reason you can't adjust the current for each loop is because the entire system [ Unreal Engine ] uses the commonly used for each loop. And Unreal Engine has comments all over that loop saying not to change. So that was cool and funny. Hahaha.

Problem 2 
So the next thing I had to work on was the game instance and I was asked by another teammate who was in charge of this. To take over the saving of the game. Well, it's not saving of the game. It's more like saving the game between levels. For example, the problem we had was, how can we save the stats of the player from the dungeon level to the combat level... because every time I would transfer the stats it would say zero or it would crash [which is a big no no (P.S. I learned my lesson from the Problem 1: I saved it so when it would crash I didn't have to redo everything) ]. Meaning the original stat isn't being updated.

Solution 2
When I first took over the game instance. The first thing I did was to requested from another one of my teammates. If they could implement their status, screen that is in the dungeon level to be also be placed in the combat level the reason why it's because I wanted to be able to see the stats. Also, see if the stats that were being upgraded would also transfer over to the combat level. In doing so, it allowed me to get a visual representation basically to see if I was doing it right. I realized that when making the game instance objects. You always have to call the event correspondent to what you need. But since I couldn't get the information from one level to the next. I realized that I need to make a call elsewhere. And that 1 place I need to make that call was right before we transferred to the other level. Boom now we can transfer stats from one level to the next.

Thanks everybody for following my journey please leave a comment down below on your thoughts or if you have questions.

Get Quest for Dominion

Leave a comment

Log in with itch.io to leave a comment.