Sunday, April 23, 2017

Update: things; revision 3

well, the blogger app is crap so i have to do this again. I'm back in school and have anew job, so things have been slowed down drastically. I have been helping a friend with his project loosely. By that, i have been designing levels for him. Its a mobile app game called Gravity Gerbil. The game uses your motion sensor to maneuver the player around a series of obstacles. The obstacles are elemental, mechanical traps, and maze, or any combination of the aforementioned. The objective is to collect items or maneuver through the level to reach the end.

EDIT:

:DDDDDDDDDDD Game is released :DDDDDDDDDDDDDDDDDDDDDDDD

Gravity Gerbil


Here are some screen shots:

 




Monday, September 19, 2016

Tutorial: Programming with Animation

Sometimes you have assets that are not rigged and come with animations. The benefits of this is that these characters are best for static background filler to add atmosphere like background characters in a movie. They are also good for companion AI, basic NPC enemies.

Here is a free model that comes with animations already:
*Skeleton
Once you have downloaded and imported Skeleton, navigate to it in the Project tab.



Click the arrow on the skeleton_animated to see the list of animation names, pay attention to the animation names their spelling particularly.
Before we begin programming we need to do two things:
1) drag the model into the game world.
2) select Skeleton and select Add Component in the Inspector tab, search or navigate for the Character Controller component.


 


**NOTE: If you notice the Animation component, dont mess with it, this is important and is default attached to the model, this allows us to use the animations that come with this model.

Now the character controller(the green capsule) might be too big, too small or sunken into the terrain. To fix it, change the Y Value under the Character Controller to 1, or play around if your circumstances are different.

Okay, now lets make a new C# script, call it: SkellyWalk.cs. If we look back on her animations we see that our model can run or walk. We will need a float variable for run and walk:

public float skellyWalkSpeed;
public float skellyRunSpeed;

Because our character can only move in two dimension we need to declare variables for moving horizontally and vertically:
public float horizontalX, verticalZ; 

Now we need to introduce two intrinsic classes to the Unity engine: Animation and Character Controller. The Animation class allows us to access the animations with in the model and the Character Controller is the one you have added to the model, this will allow us to move the model. As the character controller moves we will play the animation giving the illusion of real movement.

Animation skellyAnimations;
CharacterController amandaControler;

Before the script can access the above classes we must irt initialize their values. In the Start() method type the following:

skellyControler = GetComponentInChildren<CharacterController> ();
skellyAnimations = GetComponentInChildren<Animation> ();
skellyAnimations.SyncLayer (0);

The horizontal and vertical axes are controlled by the WASD keys, WS are vertical and AD are horizontal. These are built into Unity, so when the player presses AD or WS this is registered as a numerical value. If the value is greater than 0.0 the character controller will be in motion, if no key is pressed the value is 0.0 and the controller is idle.

In the Update() function we need to initialize the horizontalX and verticalZ value. To do so we have to link them to the value that Unity provides for our axes.
horizontalX = Input.GetAxis("Horizontal");
verticalY = Input.GetAxis("Vertical");

Now we have to do the transitions of animations based on keys pressed. If you map out the WASD keys on a Cartesian plane W has a positive value(> 0.0), S has a negative value(< 0.0), A has a negative value(< 0.0) and D has a positive value(> 0.0). This will be the basis for our if, else if, else structure. First we check for any movement:

if (verticalZ == 0 && horizontalX == 0)
{
skellyAnimations ["Idle"].wrapMode = WrapMode.Default;
skellyAnimations.CrossFade ("Idle");
}

Now we check if the player pressed the W key:

if (verticalZ >= 0.1)
{//walk forward
skellyAnimations ["Walk02"].wrapMode = WrapMode.Default;
skellyAnimations.CrossFade ("Walk02");
transform.Translate (Vector3.forward * Time.deltaTime * skellyWalkSpeed);
}

Now we check if the player pressed the S key:

else if (verticalZ < 0.0)
{//walk back
transform.Translate (Vector3.back * Time.deltaTime * amandaWalkSpeed);
amandaAnimations ["WalkBack"].wrapMode = WrapMode.Default;
amandaAnimations.CrossFade ("WalkBack");
}  

Now we check if the player pressed the D key:

if(horizontalX >= 0.1)
{
transform.Translate(Vector3.right * Time.deltaTime * skellyWalkSpeed);
skellyAnimations["WalkRight"].wrapMode = WrapMode.Default;
skellyAnimations.CrossFade("WalkRight");
}

Now we check if the player pressed the A key:

else if(horizontalX < 0.0)
{
transform.Translate(Vector3.left * Time.deltaTime * skellyWalkSpeed);
skellyAnimations["WalkLeft"].wrapMode = WrapMode.Default;
skellyAnimations.CrossFade("WalkLeft");
}

Just as a bonus, because this model comes with attack, below is the attack code, if the Key is Mouse0 or left click, play the animation "Swing normal"

if (Input.GetKey (KeyCode.Mouse0)) 
{
skellyAnimations["SwingNormal"].wrapMode = WrapMode.Default;
skellyAnimations.CrossFade("SwingNormal");
}

You may have notice three things:
1) .wrapMode = WrapMode.Default; This is another intrinsic feature in Unity. An animation is a series of frames showing movement. wrapMode has different settings to how to end the animation. This is all used to make the animation seem fluid and believable illusion of motion. In this instance we use Default which is set to Once. Meaning when the last frame of the animation plays, we will go back to the first frame in the animation.

2) .CrossFade(); All this does is allow us to fade into anther animation. For example you press W, skelyl moves forward, then you press D to move back. CrossFade lets us blend into walking back for a more natural transition.

3) transform.Translate(); This is an intrinsic class in unity, its purpose is to move the controller component. Its read like this, for example one of the above codes:
--transform.Translate(Vector3.left * Time.deltaTime * skellyWalkSpeed);
Move the character controller left the speed of the skelly walk variable times deltaTime. Delta time is a special form of time that calculates the time elapsed between two frames. If this is confusing (i dont blame you) especially delta time, i would suggest reading more about it, its a cornerstone of movement in programming.

Attach the script to the skeleton model, edit the float variables:



SkellyWalk.cs

Tuesday, August 2, 2016

Tinker: World Progress

Been about a three months?! Any who, i got some new assets and am streamlining my work to faster produce world building results so i can push this out soon. As the map gets populated i am having lagging issues in the scene editor.






I had to increase the map, as i realized the setting was not large enough to accommodate new locations.
 
                                                        Police stations pictured below.


EDIT: I should have two tutorials up Aug 7th, 2016, im leaving for vacation.

Sunday, April 24, 2016

Tinker: More Weapons: Unique: Revision 2


The ones below are unique weapons: usually chambered in different calibers, faster rate of fire, better accuracy, longer/shorter range, allows for attachments, more or less ammunition. They have their pluses and minus, the point being that the differences in specifications make the weapon unique to a players style or preference, easing the game in some ways, but making it more difficult in others. There is limited ammunition and format for particular calibers(i.e 50 JSP 5.57mm rounds total or 150 Hollow Points for 7.62x54R) so save them for particular cases and weapons that use them.  Legend: + = Good, * = Medium, - = Weak
Steyr A3 5.56x45mm
Fielded by the International Security forces expeditionary team, the A3 found its way inside after a few ambush attacks. After the security personnel moved back to the border the weapon is in scarce quantity.
+Capacity, *Accuracy, +RoF, *Damage
X-61:CQB 2x75mm
Experimental research project using a special cartridge designed to achieve greater velocity in addition to the weapons polygonal rifling. Only one is purported to exist, sealed in a bunker somewhere.
+Capacity, +Accuracy, -RoF, +Damage
Needles  1.6x41mm
Used by one of the more iconic members and only Italian fence jumper, he and his highly accurate weapon disappeared before the latest Sleep. His model was retrofitted to fire flechette rounds. Though the caliber is small, hey penetrate armor, steel and flesh with ease.
+Capacity, +Accuracy, -RoF, *Damage
PM-40H .45ACP
Used by the internal security of various research and manufacturing facilities. The PM-40 Heavy was designed for high accuracy, rate of fire and decent damage. Designed to effectively put down any target fast.
+Capcaity, +Accuracy, +RoF, *Damage
Markov .45ACP
Like the rest of Markov models found, this particular one is chambered in .45. Because of this it has less ammunition, more recoil but greater damage.
-Capacity, -Accuracy, *RoF, +Damage
Magnum .44 or .357 
Designed for hunting, the weapon became popular in the area by scouts who needed a compact weapon with a punch after coming into contact with many abominations found in the Tartaric forest.
*Capacity, +Accuracy, -RoF, +Damage
FAL 7.62x54R
One of the oldest battle rifles produced in the 20th century. It became very popular during the first breach due to the open fields that are very prominent in the area. This one in particular is chambered in a 7.62x54R
-Capacity, +Accuracy, -RoF, +Damage 
Slam Eagle 5.7x29mm
Used by International Security Forces infiltration units, the weapon came into favor due its compact nature, unique bullets that cause massive bleeding damage. Because of rarity, ammunitioon is hard to find.
+Capacity, -Accuracy, +RoF, +Damage
RPG-7 PG-7G-40mm
Originally found in mass numbers during the first breach brought with the thought of having to fight heavy armor, the weapon fell out of favor after there were no heavy armor units found.
-Capacity, -Accuracy, -RoF, +Damage

_________________________________________
The pictures below are grenades commonly used and various ammo boxes in the game.

Fragmentation
M67 and DM51-A1
Common frag grenades used. The M67 more so due to cheap production, but limited range of the M67 make it not ideal for open field battle, rater closed spaces and for flushing out enemies, as opposed to the DM51-A, which explodes with ball bearing like a claymore.
5.45x39, 10GA, 12GA, .45ACP
The most common rounds found: Full metal jacket and shot sells.
.357 and 2x75mm 
The most common rounds found: Jacketed hollow point and solid tungsten kinetic penetrators.
7.62x39, 7.62x54R, 5.56x45, 9mm
The most common rounds found: Full metal jacket and jacketed soft point.


Monday, April 4, 2016

Tinker: More World Progress: Part 3 or 4....












These are all pre-alpha. I will of course have too re-size them, re place them, re locate them, add more decals for atmospheric effects. I ran into an issue a week or so ago where the character model was too small. This led to poor resolution of the ground due to the camera being closer and the buildings being comically larger than the player. Hopefully soon i'll do a tutorial on Mecanim. I have all of it done except the explanation. But I have CCENTs to study for. I am a bit burnt out on world building, so ill start programming soon.