Monday, October 12, 2015

Tinker: Weapon List; Pistol, Rifle, Shotgun, Melee: Version 2


Colt M1911A .45ACP
An antiquated weapon found in decent numbers. Usually carried by more veteran members in the zone. Preferred for its caliber, damage, resistance to elements and ease of maintenance.
Glock 19 9x19mm
Commonly found in the area, by almost all persons not affiliated with security forces. Simple design means less jams, chambered in the 9x19mm the weapon is a good choice due to the over abundance of that caliber. Has full auto feature.
M9 9x19mm
Standard issue to security forces. Has higher damage and better accuracy, lacks full auto. Usually found on the lower ranking members. Fetches a good price and uses a common ammo round.
Sig P227 .45ACP
Standard issue to security forces.Found on higher ranking members, all the features of the Colt but with better condition and the added options of attaching mods.Compact and lightweight.
Markov 9x18mm
Antiquated weapon found in plentiful numbers greater than the Glock. A good starter weapon of fall back weapon when the more modern fire arms fail. Using a rarer caliber dimension makes this weapon unstable in the long run.
AK-47U 7.62x39mm
Preferred by seasoned members due to its compact nature, and high damage, the shorter barrel gives a wider spread and less accuracy. Often used for raiding facilities as the spread is good for crowd control.
AK-47 7.62x39mm
The iconic weapon used by a few members due to its limited numbers. High damage, high rate of fire, inaccurate, great for long range and mutants.
AK-74 5.45x39mm
More common that the AK-47, its chambered in a weaker but plentiful round, but its accuracy and high rate of fire make it a preferred weapon by many over the M4A1.
AK-12 5.45x39mm
Rare to find, this next gen uses a newer caliber and is speculated to be carried by security teams past the Ghost Gate. Accuracy, mid damage but a high rate of fire with durability makes it a valuable weapon.
SCAR 5.56x45mm
Commonly found with security forces, this new generation weapon is durable, light, accurate despite using an antiquated bullet. Rare to find unless fighting security members, goes for a great price.
M4A1 5.56x45m
Found by almost all members that have made some money, the compact rifle offers attachments, accuracy and decent rate of fire.
G36C 5.56x39mm
Found on seasoned members this weapons compactness and accuracy make it a preferred weapon for raids, the integrated scope is an added benefit to those with steady hands using semi auto.
SPAS 12ga
Hard to find, this weapon was designed  for police usage. It found its way in the area due to arms sales. High fire rate, a high damage, reliably built, the weapon is used by those who have it for hunting, and infiltration.
Remington 380 10ga
Easy to find, this weapon is a staple as a secondary weapon for many jumpers, seasoned or not. It often comes with rails and can be customized(flashlight, suppressor, holographic sight) making it a versatile weapon.
SVD 7.62x54R
Used in small numbers by Voluntary faction , this weapon is well built, highly accurate, and packs a punch with its 7.62 rounds. Ammunition is hard to find making it impractical for prolonged expeditions. 
Hisu Knife Composite
Manufactured in japan from high carbon steel supported by carbon nanotubules in a honeycomb lattice the Hisu knife is almost un-breakable, able to withstand high heat, and holds its edge so well that it does not need to be sharpened. It can easily cut through all armor, and slash limbs and appendages with minimal resistance.

Tuesday, October 6, 2015

Concept art for an unnamed fantasy world.

I want to make a RPG game as well. I want this to be something new and fresh. I want it to be large and expansive, with many factions, side quests, plots and sub plots. The idea is heavily inspired by The Elder Scrolls and the Diablo series, but draws heavily from our history.

The game would feature the usual, dwarves, orcs, humans, elves, and with in those groups would be sub groups and sub groups. For example under Elves there would be the usual Dark Elves and with in that region would be Shadow Elves, and Ask Kin. The skin tone would vary from dark plue to dark purple to dark blue grey. Their societies would be similar but also have their diffrences, the voices, weapons, and so on would also vary between the groups.

The game would be set in a time where small strides have been made in mechanization, industrialization. As a result a rift between the secular forces and the believers of the old gods grows. During this you the player come across an enigmatic woman who becomes your companion. As the plot progresses she becomes more and more of a central figure in your life and the events of the game.

Races: Elves(Dark, Alter, Forest), Orcs(great, mid, lesser), Humans(Men of the North, South and West), Dwarves(Mountain, highland)Goblins/Hobgoblins, Djin, Daemons, Kinoly, Titans, Giants, Furies, Wraiths, Harpies.

As for the various deities in the game they come in two forms, actual deities, or mortals who achieved dietetic powers. Both can be killed with the rightful steps taken. Though in the game there is very little of that.

Weapons: You have the usual melee weapons and bows, but with the industrialization you have projectile based weapons and arrow based called brim bow, brim bolt, brim shot. The brim part is the reactive stone found in the Human home land, used to fuel the industrialization efforts.

Spells: come in both, protective, conjuration, destructive and passive. To obtain spells you must either decipher a book on a spell, collect the words associated with it, pay for teaching and so on.
For those not magic inclined finding stones with glyph or pages inscribed with them (glyph scrolls) will imbue your weapon or armors, as for the glyph scrolls depending on what their classification is will float and act as a follower. So picture a floating page shooting lightning.

As for naming the cities, villages and names of the various races i plan on borrowing from long dead human languages or obscure enigmatic ones: Aramaic, Old Avestan, Sumerian, Elemite, Basque, Neshite.

A lot of the architecture for the cities are inspired by Zoroastrian, Cyclopic, American Native groups, Etruscan, Nubian, Hittite, Assyrian.

        


Thursday, October 1, 2015

Tutorial: Projectile Weapon: Part 1 Revision 2

This tutorial will be more lengthy, i will cover both raycasting, projectile spawning, ejection, bullet count, cinematics(sound, light), aiming down iron sights/scope.

Now, as always lets get some assets before we begin programming. Go to the asset store find a weapon that is free. There are many to choose from.

https://www.assetstore.unity3d.com/en/#!/content/21025

Now, we need some sound. freeSFX.co.uk has a decent selection. Pick whichever you want. Currently we don't care about the accuracy of the sound to the weapon, next we need the sound of a cartridge being ejected. freeSFX does not have any good ones, but Freesound.org does. Search for "bullet shell":
http://www.freesfx.co.uk/sfx/gun
--M1 Garand semi automatic rifle, .30 caliber, single shot (distant perspective)

Bullet shell sound from Freesound.org

We need magazine removal and insertion sound:
http://www.freesfx.co.uk/sfx/Magazine
--Machine gun, .308 caliber, remove magazine clip, full, DPMS LR-308, AR-10
--Machine gun, .308 caliber, insert magazine clip, empty, DPMS LR-308, AR-10


So, if you look at your weapon, you should notice a few things:
1) Muzzle(where the bullet flies from):
---We will need to add the fire sound and muzzle flash here.

2) Ejection port(where the spent cartridge ejects from):
---We need to add the bullet shell sound here.

3) Magazine(self explanatory):
---We will need to add a sound and an animation here.

4) Trigger
--This will play a sound when you run out of bullets.



Create a new scene and import your fire arm. Next we need to create a EnmptyGame object. You'll want to position the EmptyGame Object in front of the muzzle. It may be difficult to see, so add Mesh Renderer and Mesh Filter component. Under Mesh Filter search and find Sphere. It may be large in comparison to your weapon so scale it down till it looks right. Now rename the Empty Game Object as: GameObject:MuzzelFlash.
 

This game object will serve as the object for the muzzle flash, and when we do the projectile version it will be the spawn point for bullets.

Next we will repeat this for the ejection report. So make a new Empty Game Object, add the Filter and Renderer and position it over the ejection port. Make sure to name the Empty Game Object: EmptyObject:EjectionPort. Here we ill play a sound for the bullet casing and spawning a bullet casing.

Next make two more Empty Game Objects one for the trigger to play a sound when the magazine is empty and one for the magazine when the player reloads. As always make sure to name them appropriately. Below is my set up model:


Next parent all the GameObjects to the weapon object:


Finally, add an AudioSource component to your model. Make sure that Loop and Play On Awake are unchecked.

Here i will cover the basics of a firearm, Raycast shooting, bullet count and display, and zoom. What follows after will be the script we will write appended for different needs. First thing add an audio source to the weapon model and un-check Loop and Play On Wake, this is where you will place you shooting sound. Lets make a new C# script and name it Firearm_Standard.cs

Raycasting is used in most games. Even when you see bullets fly those are for cinematic. They dont do anything other than give you the impression that its real. In reality, the damage your weapon does is like laser tag. When you press the fire button a ray is projected from your weapon. The ray is a class that has its own function to check if it hit anything. If it does it applies damage.

We need to declare some intrinsic classes and then some variables:

 Ray hitRay = new Ray ();
RaycastHit hit = new RaycastHit();

public float baseFOV;
Vector3 raycastLookAtPoint;
public Transform raycastSpawnPoint;

public float lastShot = -10.0f;
public float fireRate = 0.15f;

public int weaponDamage = 50;
public int bulletsInMag = 30;

Now under Update() we have to link the Ray to the camera so that the view port on the camera is used as the origin of the ray.
hitray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

Next we need to take user input and set the condition that the weapon will fire when a button is pressed and the raycast is deployed but only when there are bullets in the weapon and the last shot has fired. Here we will also add bullet count and conditions for automatic fire. Interestingly if we dont have the conditions for auto fire we will still have auto fire, but it will be too rapid, unrealistic, noisy as the sound will mesh together, and if you are using projectiles there will be too many projectiles causing lag and in instances of collision the impact with objects will not be registered.


if(Input.GetButton(KeyCode.Mouse0))//Check for mouse button pressed
{
         if(bulletsInMag > 0)//now we are checking if there is enough bullets
         {
                 if(Time.time > fireRate + lastShot)
                 {
                     if (Physics.Raycast(hitray, out hit, 1000.0f))//if the ray has hit something at 1000 units
{
raycastLookAtPoint = hit.point;
raycastSpawnPoint.transform.LookAt(raycastLookAtPoint);
                      }
                                   
                         GetComponent<AudioSource>().Play();
                         lastShot = Time.time;

                         bulletsInMag--;
                     }
          }
}

Now we have to cover the zoom feature, this wont be looking down rails, but more like games in the 90s like GoldenEye, just a zoom feature. Under Start() we have to initialize the above variable: baseFOV = Camera.main.fieldOfView;

if(Input.GetButton ("Fire2"))
{
        Camera.main.fieldOfView = 25;
}
else
{
  Camera.main.fieldOfView = baseFOV;
}

You can experiment with Camera.main.fieldOfView = 25; by changing the value to zoom more or less in/out.

Projectile:

Now if you want to do projectile instead of raycast, we will first delete all the lines of code dealing with raycast. It would be best to start another script: Firearm_Standard_Projectile.cs

Next we need a bullet model if you have any assets you can use those, if not, a sphere works well or a capsule.

In place of the raycast we will actually instantiate a the bullet model and add force to it. First we need to declare a variable for the bullet model: public Rigidbody caliber556mm, next we need one for the location where the bullet will spawn from public Transform bulletSpawnPointBarrel, and finally the speed at which we will propel the bullet public float caliber556mmSpeed.

if(Input.GetKey(KeyCode.Mouse0))//If user has pressed the fire button
{
if(bulletsInMag > 0)
{
if(Time.time > fireRate + lastShot)
{

Rigidbody instance =  (Rigidbody)Instantiate(
                        caliber556mm,
                        bulletSpawnPointBarrel.position, 
                        bulletSpawnPointBarrel.rotation);
instance.AddForce(transform.forward * caliber556mmSpeed);

GetComponent<AudioSource>().Play();//play the shooting sound

lastShot = Time.time;

bulletsInMag--;//Deduct bullets from the magazine

Destroy(instance.gameObject, 1);//
   }
  }
}

So what we are doing is creating a temporary variable for the Rigidbody(because unity does not allow direct manifestation of the Rigidbody because when we delete the Rigidbody  we would delete the entire object from Unity. But by using the temporary variable we delete the variable not the model and then we create another and delete and so on and so forth.), and spawning it from the spawn point, then we AddForce() to the Rigidbody using the caliber556mmSpeed.  After about a second of our human time the temporary variable is deleted saving on memory.

Where as the raycast applies damage directly, the bullet model will need a script to be able to apply damage(we will cover that later). With that said make a new script and call it: Bullet_Dynamics.cs

In your Bullet_Dynamics script we will just use the intrinsic function OnCollisionEnter() and in it type: Destroy(gameObject);
This is a self referring statement since it is encapsulated with in this script on the bullet object.

Now add this script to your bullet model, also add a Rigidbody component to you model, change the values of the rigidbody to Mass: 0.09, Drag: 0, Angular Drag: 0.05. Its up to you if you wish to check the box for gravity, though i do for realism. Play around with the speed of the bullet under Firearm_Standard.cs and the gravity check box under Rigidbody.