Welcome to my blog!

Me

Radiant Able Jesting Authentic Regular Attentive Motivated Student

Creativity

"Creativity doesn't wait for that perfect moment. It fashions its own perfect moments out of ordinary ones." -- Bruce Garrabrandt

Kathmandu University

Kathmandu University is the first private university in Nepal. It is the third oldest university in Nepal, located in Dhulikhel of Kavrepalanchok District, about 30 km east of Kathmandu. It was established in 1991 with the motto "Quality Education for Leadership." with great environment and facilities.

Education

Education is the passport to the future, for future belongs to those who prepare for it today.

Origin of Blog

Initially started as an alternative form of assignment for ENGT 102 during the pandemic of 2020 for online classes. Given by our Professor Eak Prasasd Duwadi (Arts,L)

Showing posts with label GameDev. Show all posts
Showing posts with label GameDev. Show all posts

Thursday, August 3, 2023

Cricket in Unity with Game Creator #2

 Yay!! finally decided to write a second part. Well, you thought it would die in the first part? He he he, I am here to prove you wrong.

So after the first, I did a lot, but most were about figuring things out and trying out new functions for the game. It includes new animations, a power progress bar, action UI, etc. Most of my time was spent figuring out how to implement the slider bar to act as a power function. 

So first let's get how the slider works. Basically while holding a button for a trigger, the slider keeps charging and once we stop holding then we get the required power. This will be later implemented to determine how far/hard we hit the ball.


For debugging purposes right now, I have also added a little text to show the corresponding power level. The min is 0 and the max is 1


To implement this simple function I had to go through a lot of trials and errors before finally arriving on one implementation. So basically what I did is first create the UI slider which is really not that hard. I just put a few circular sprites on the built-in slider and played with it a little. Then I have a trigger that basically sets the UI active once it is pressed. And as for the charging part, don't judge me, but this was all I could find using the Game Creator and I was too lazy to write an independent script just for this.


Yes, I literally created a for loop but with individual statements :/

I also have restarted the actions once it is all finished so the loop and go on forever. The loop only executes once the trigger is pressed, and every time the trigger is pressed, the SliderValue is set to 0 first. The SliderValue is a variable that stores the value of the slider. It is given by Game Creator's Slider UI itself. 

And to make sure that the slider stops when we release the button, we have another trigger as well. The overview of the trigger is


And in the power reset, I hide the slider first and also cancel the actions for the loop so that it doesn't just keep on going forever. (This was pretty smart of me :))


As you noticed, I also set the ActionSelect active as well after setting the Slider inactive. The action selected is literally a UI that shows us the possible actions that can be done. It literally has five buttons (which can be made prettier later but it's working for now) and each button is a trigger for an action that initiates a state for each of the actions.


This UI literally appears after the power level has been selected and we can call the corresponding action. 

And yes, I have already created four animations for four different types of shots in cricket (I just looked it up on youtube and tried to replicate it in Blender, which was really hard and time-consuming T_T . I really hope Mixamo becomes so big someday that it implements AI to convert videos into 3D animations. All Hail Mixamo). Yeah so let's not get into every little animation (As it is not that great either). Here is a quick look at how everything performs for now.



And in upcoming blogs, I don't want to get too much into the technical stuff but just explain how are things going and how I accomplished certain stuff or functionality. This will just be personal for me and help me focus on game development.


For now, here is how my hierarchy looks



Share:

Sunday, July 30, 2023

Cricket In Unity with Game Creator #1

This is the first actual project that I am carrying out in my Unity Game Dev internship. And I hope Game Creator makes it pretty smooth.

First the task at hand: Create mechanics for batsmen in Cricket
- Create at least 5 different types of strikes

If you don't know what cricket is, why even are you here :/


So let's dive into it. What did I complete today you ask?

1. Setting up the character & scene: The first thing to get started was obviously to build up the scene and the character. For the scene, I took a simple stadium model for playing Cricket that can be found here. This also provided me extra work as the creator did not provide any textures that it contained. So being the lazy one that I am, I deleted all the unwanted stuff, added appropriate colors and just put the field only which looked like this:


Then setting up the character was really easy with Game Creator, with just a click of a button. Then I found a 3D model from Mixamo and made the character feel more human. This also gave me some extra work as the textures didn't appear :( . And finally beholdd my mighty character:


Since I have Game Creator I was happy I did not have to work on movements and controls here and there. But oh boy, so wrong I was. I will have to change all the animations phew!!
As for the camera, I kept a camera motor fixed behind the player since for now I am only focusing on the batsmen. 

I also added a second camera motor so that I can look around. I made a key down trigger that swaps the camera to another adventure camera.




2. Animation: Now I needed the player to sit in an idle position where cricket batsmen usually sit. Since T-pose wouldn't cut out for it. I went straight to Blender with what little knowledge I had and got to work. After a while, I got something that satisfied me :) 
 
(I'm really proud of this btw)
I also tried some left-right movements, but let's leave it for another day.


3. Attaching Bat 🤔: This is where it all got a bit tricky. I thought of three individual ways for attaching the bat to the player.
  1. Directly placing the bat on the hand of the player under the root bone with the right transformation and the bat would move along with the hand.
  2. Using player attachment provided by Game Creator to attach the bat on the hand of the player with some trigger. (Lots of trial and error to get the rotation and position right)


  3. Then the last one was to directly attach the bat to the model itself in blender. This would be really smooth and perfect. But I really don't want to use blender T_T
So what did I do? 
For now, I am still trying to figure it out. But I have placed the bat under the right-hand bone of the character with proper position and rotation.

Looking back at it, I think this is all I did today. Doesn't feel like much when you write like this. Especially since I didn't have to do any coding either (Thanks Game Creator I guess). It ain't much but its honest work. I also tried to add a little hitting animation with a trigger but the bat's location is really messed up I guess



Share:

Labels

About Me

My photo
Kathmandu, Central Development Region, Nepal