Saturday, November 18, 2017

The Code of Inverse Kinematics

Disclaimer:

Most of the projects that I will be doing are for a game that I am developing on my own code named Project Ninjio. In short, the game is a story action driven role playing game (common referred to as an action RPG). It features 2 uniquely styled areas, one in which the cities are built to flow along with nature, and the other where the cites are hyper futuristic. The game is set in a futuristic China, where after a large war, the country is split into the two settings described above. The game is built in the Unity 3D game engine.

The Code of Inverse Kinematics

Introduction

In most modern video games, developers use a technique called inverse kinematics, commonly shortened to IK, to insure that various parts of characters are interacting with the world as they are meant to. This can be useful when a character has to touch an object at a point or for a character to plant their feet on an uneven surface. The best part about IK is that it can be coupled with normal animation to insure that the character will plant its feet on an uneven surface even when it is doing an animation like running or walking.
Image result for Ik in games
Before and after IK, notice how the character's feet are in the ground without using IK

How a computer sees the human body

IK in Unity3D

In the Unity game engine, the process of IK is fairly simple to set up. As long as the character fits a normal humanoid bone structure, Unity automatically sees and understands which bones are for what part of the body (left/right foot, head, left/right hand etc). Once Unity knows that the model is correctly set up, then it will go ahead and create an avatar for the model. An avatar is a simplified bone structure that is generated from the model's original bones for the game engine to understand how certain bones interact with each other (IE. hand is connected to the arm bone). Inside of the code, you can then tell these main bones, like the hand bones and the foot bones, to move to a position and Unity will position the connected bones to the correct position.

The Code

This is just a small thing that I put together, the actual IK script used by Ninjio has more things using IK. Hopefully the comments, in green, will help those with little programming knowledge understand the process that it takes in order to get IK on one bone inside of Unity. If you would like to learn more about this, here are some links:

Unity Documentation on IK
Unity documentation on the Animator class which has a whole lot more than just IK under its belt

But when none of those work then ask Google, it'll help for sure!

Gismo's thoughts

I am honestly surprised at how easy it was for me to set up IK for Bing Nu's model! Surprisingly, the hardest part of getting her IK correct was figuring out how and when to have her foot follow IK and when to follow the animation inside of the programing. I plan IK in Ninjio to allow the character's heads to turn and look at an object, pick up an object with their hand, and to make their feet actually touch the floor (no floaty feet here)!

This week's work log:

Monday November 13th:  Started modeling Iron Flurry, but had to start over
Tuesday November 14th: Started modeling the Iron Flurry again
Wednesday November 15th: Finished modeling the Iron Flurry
Thursday November 16th: Textured the Iron Flurry, but for some reason it was deleted

Friday November 17th: Finished texturing the Iron Flurry
. .--     -.. . . -.     .-     .-. --- .. ...- .- ...

Saturday, November 11, 2017

The Art of Character Association


Disclaimer:

Most of the projects that I will be doing are for a game that I am developing on my own code named Project Ninjio. In short, the game is a story action driven role playing game (common referred to as an action RPG). It features 2 uniquely styled areas, one in which the cities are built to flow along with nature, and the other where the cites are hyper futuristic. The game is set in a futuristic China, where after a large war, the country is split into the two settings described above. The game is built in the Unity 3D game engine.

The Art of Character Association

Introduction

One thing that I have been having issues with in Ninjio is how to have players memorize and associate the names of the characters to their personalities and such. This is hard because I am adamant in keeping the original Chinese names unaltered in the final game, even though they are fairly difficult to pronounce correctly. I have toyed around with some ideas and have came up with a few methods for getting the name to image association correct in players minds.

How to be memerible, the right way

Image result for borderlands character introduction
Borderland's style of character introduction
One thing that I found common in many video games, like Telltale Game's Borderlands series, is a way of quickly giving off some sort of information about the character along with some sort of memorable line that the character either says a lot or they center actions around. Borderlands does this in a very obtrusive way, with the game pausing, zooming in the character, the character saying some sort of silly voice line, and then the game displays their name along with a line that the character typically uses as their motto for their actions in the game.

Another method that I saw a lot in other video games to display character information is to have a screen that the players can access at any point in the game. Games that use this method typically just display factual information like the character's age, height, width, attack information, and any other information that the player may find useful. While this can display lots of factual information, I only know a few games that use this style of display to show character personality information, however I plan on using and displaying this information differently in Ninjio.

Character profiles in Ninjio

What I am planning for Ninjio's character profiles is a hybrid between the two methods that I outlined above. I plan on taking the memorable lines, the character portraits and the silly voice lines that Borderlands has and combining them with some other information about the character's personality or history (see sketch). These profiles will only be available for the player for the 7 main characters that the player will be interacting with throughout the story.

Image result for incentivizing player actions
Incentivizing? I think so!

Incentivizing the player to view these profiles

As the game is currently written, the player (playing as the main character of course) meets the villain early into the story and the main character's mentor very early into the storyline. I think that it would be appropriate for the player to then be prompted, hopefully in a manner that seems natural to the player, to open up the character profiles for the main character, the villain, and the main character's mentor. As for the rest of the cast, including Bing Nu, I have a scene where the main character is required to go around and introduce himself to the rest of the cast (minus one!). I think that when the players introduce themselves to these characters, their profiles unlock in the character profile menu. The last character, I will just wait until he hacks into his own profile to unlock it.

This week's work log:

Monday November 6th: Made a run cycle for Bing Nu
Tuesday November 7th: Made a valiant attempt to get the foot IK working, which ultimately failed
Wednesday November 8th: Worked more on foot IK and it seems to work well
Thursday November 9th: Started work on one of the weapons, the Omega Blaster

Friday November 10th: finished modeling the Omega Blaster, ultimately got rid of it for various reasons
--. -. .. --.. .. .-.. .- .. - .. -. ..     .-.. --- -.-. --- - --- .-. .--.     -. --- .. - ... .- -...

Friday, November 3, 2017

End of Marking Period 1 Blog Posts Peer Review

End of Marking Period 1 Blog Posts Peer Review

After reviewing some of my peer's end of marking period 1 blog posts, I have learned about many of my classmate's projects. Many of these projects interest me greatly.

My friend Keaton's project was the first to peak my interest. He is currently working on an environment for a virtual reality (VR) animation that he is doing, see the video that I have on this blog for more information about VR animations. The environment he is working on is strikingly similar to the flight deck of the Star Ship Enterprise found in the Star Trek series. This fact alone is enough for me to instantly fall in love with it, but Keaton is also putting a lot of time into making sure that every square inch of his space ship is filled to the brim with details, as anyone can go and look anywhere in the scene.

Another one of my friends Michael is currently working on the scenery and initial modeling for characters in a, supposedly, action packed animation. I have been friends with Michael for the longest time, since middle school actually, and I have seen the development of most of the characters that he wishes to have in this animation and the story line and action sequence of this animation come to life over the years. I hope that this animation turns out as good as he has been telling me, because I feel partially connected to both the characters and he animation as a whole.

Image result for unreal engine vs unity
Unreal Engine is another game engine just like Unity!
Unreal is used more due to how easy it is to make a game in it,
however Unity is slightly better thanks to it's better licensing policies.
There are two more people whose projects have stood out to me. Bado is currently working on a video game inside of Unreal Engine 4 (another game engine). From the sounds of it, the game play will be very similar to Ninjio. The other person whose project really spoke to me was Garet's. He is currently working on bring a fantasy world to life. This world of his has apparently been around since he was in elementary school, quite like how Ninjio's world was created when I was a junior in high school. I wish both of these people the utmost luck and hope that their projects exceed any standards they set forth for themselves.

This week's work log:

Monday October 30th: View a few classmate’s end of marking period blog posts
Tuesday October 31th: Started working on Bing Nu’s animation
Wednesday November 1st: Finished up the first idle animation for Bing Nu
Thursday November 2nd: Finished another idle animation for Bing Nu
Friday November 3rd: Made a walk cycle for Bing Nu and played around with IK in Unity