Agni, my first published game | My Gamedev Journey #4
Hey all, I know its been a while now since I last posted. I was busy with exams and some stuff at home. Lets talk about Agni. Agni in my head is this Jojo’s Bizarre Adventure/Link-esque character where for every story I want to tell I use the same protagonist, but with a different personality, a different generation, etc. I designed her (yes my Agni is female) to be the protagonist for the more story based games that I would make. I do enjoy the immersive design that a game like Half Life or Portal takes with the silent protagonist, but I feel like that takes away from the story telling since that is one less character for me to attach myself to. This isn't something I had thought of back then, but I knew intuitively. How I came to learn it a story for next time :)
For the first game in my new series, I wanted to try out a maze generation algorithm. Essentially, the idea was that the player would use swipe controls to tell Agni which direction to move in, and find some coins in a deep procedural maze. I wanted to make the entire game in a month, so my main focus was on two things. 1) Getting the player movement to feel awesome. 2) Getting the maze to feel random but also solvable.
For the player movement, I knew I was going to use a top down perspective, I feel like phone controls haven't reached the point where 3D controls are fun. They always essentially boil down to covering half the screen with a joystick control. I’ve been looking for a way to get rid of that. A way to have the player not cover the screen with their hands. My solution was the aforementioned swipe controls. I didn't really know how swipe controls worked back then, nor that Unity had a convenient implementation so I ended up designing my own system.
It was simple enough, I would mark the point where the player started their swipe, and the position where they lifted their finger.
Vector2 direction = start — end;
int xSign = Mathf.Sign(direction.x);
int ySign = Mathf.Sign(direction.y);
direction.x = (Mathf.Abs(direction.x) > threshold)?1:0;
direction.y = (Mathf.Abs(direction.y) > threshold)?1:0;
if(direction.x == direction.y)
direction.x = 0;
direction *= new Vector2(xSign, ySign);
player.moveDirection = direction;
So the code is simple enough, if the swipe reaches a certain threshold, the value of direction assigned accordingly. the only edge case that was becoming an issue was if the user somehow made a perfectly diagonal swipe. if both x and y exceed the threshold, then the player would start to move diagonally and not only that, the player would move faster than usual. My fix was a simple if statement, I made it so that it prioritizes the y value and not the x.
There are drawbacks to this definitely. For one, if the player swiped really slowly and in a ? pattern, that would register as a downward swipe. because the end position is below the start point.
As for the Maze, I used a simple Recursive BackTracker Algorithm. The explanation is that I would create a square grid of nodes which have a marker for their adjacent walls. I would place a node in a stack, and then destroy a wall adjacent to the node, and the add the adjacent node to my stack. Lather rinse repeat until every node is visited. It was always a closed maze, there would not be any open points or any closed points, but it added a level of randomness which I liked. I also made it so that if my node had 3 adjacent walls, i.e. if the node was a dead end, it would add a coin there, and there was a 20% chance that that coin would be a trap coin! The trap coins are supposed to glow red and explode when collected.
The game was simple enough, I learned a lot from it though. I had never made a game that I had to make from start to finish, and I refused to get assets from elsewhere. The Maze was in 3D but their colliders were in 2D, so I had a 2.5D system in that way. I drew all the art myself. I composed the music using The Legend Of Zelda’s Water level as reference. I used the exact same notes, but I played around with the instrument and the timing to create different vibes. The intro has a dark mystery vibe to it because its slow and methodical. The in level music is bouncy and the beat has a detective style vibe to it. The coin collect sound is the same note sped up! I really enjoyed how I was able to use the same notes to come up with different styles of music which is big considering how tone deaf I can be at times!
So that was Agni, from the next blog post I will be talking about Criminal Cleaners and Chasers co. it was a large project for PC with a lot of planning replanning, throwing away, which is why it took a while. I also really wanted to make it as scaleable as possible, and that's how I got into tools programming! See ya then!
P.S. I know I spelt it wrong, but its canon now, cant do anything about it! XD