Wednesday, September 4, 2013

Update 16: Alpha 1.4: Throwing

In the last few Alpha releases, I've been focusing on stabilizing the camera and shooting mechanics. I feel much better about how it all looks, especially the camera movement, with all bugs around the camera now addressed.

Although I have a few timing issues with the shooting still to solve, I've moved on to the next type of attack, throwing grenades. I started by working through the physics and showing the trajectory. 

With the help of two very important links:

  1. Some excellent theory from the Castle Story: http://www.sauropodstudio.com/dev-diary-number-eight/
  2. A script to draw the line from Unity3D wiki: http://wiki.unity3d.com/index.php/Trajectory_Simulation

Using this, I was able to calculate the distance to the target, based on a fixed angle of 45 degrees: this meant that I can throw my grenade in a nice parabolic curve towards the target. 

Here are two screen shots showing this in action in my test level, with the red line replaced by a trail of smoke: 

Just before the grenade hits...


Just after the grenade hits...


When my grenade collides against my target, it 'explodes'. At the moment it's just an expanding red sphere - particle effects to come later. I use the Physics.OverlapSphere() function to look for items within a certain radius:

Collider[] hits = Physics.OverlapSphere(myProjectile.transform.position, explosionRadius);


If any of my collider hits are a player, I deal damage, but if it's destructible terrain, I use the AddExplosionForce() function like this:

//If destructible terrain was hit, destroy it
if (hit.collider.tag == "DestructibleTerrain") 
{
    //Add Rigidbody to terrain/wall
    hit.transform.gameObject.AddComponent<Rigidbody>();
    
    //Add explosive force at the point of the projectile impact
    hit.transform.rigidbody.AddExplosionForce(explosionForce, myProjectile.transform.position, explosionRadius);
}

This has two effects: it removes the destructible terrain from the explosion area, and it propels the same terrain across the map, which I think is pretty cool...

You can download version Alpha 1.4 here: http://www.samsmithnz.com/content/tbe/tbe_alpha1.4.zip.

Thursday, August 29, 2013

Update 15: Alpha 1.3

Alpha 1.3 is released. This fixes all of the bugs in the previous two versions, as well as replaces the laser with a real projectile. Also fixed are all of the targeting icons in the GUI, tabbing between enemies and targets and a few camera issues.

Still outstanding are a few camera issues and the shooting timing still isn’t quite right. This holiday has been quite productive.


[Link removed to upload the newer and better Alpha 1.4]

Tuesday, August 27, 2013

Update 14: Alpha 1.1

Alpha 1.1, that doesn't crash (nearly as much), is released. There are still lots of camera and timing issues, which I am slowly crushing.

[Link removed to upload the newer and better Alpha 1.3]

Friday, August 23, 2013

Update 13: Alpha 1.0

After an extended summer break, I've picked back up where I left things in June. I now have my first, very basic vertical slice of a basic tactical warfare game. There is still no player movement, but I do have cover and shooting. Everyone has a 75% chance of hitting. The player has slightly more health to give him a better chance of sticking around. 

Most importantly, I have a build that works from beginning to end. The players take turns, and if the game doesn't crash, the last team standing wins! 

There are bugs, especially when characters die, sometimes the game gets stuck and crashes.

[Link removed to upload the newer and better Alpha 1.1]



Wednesday, June 26, 2013

Update 12: UnityVS - Adding Productivity

I've purchased my first tool to assist me in my game creation, UnityVS. This productivity tool will really help me with my debugging, enabling me to set breakpoints. With this, I should be able to move forward quickly


Here is a quick video of the camera I've been working on animating, transitioning between different states. 

Wednesday, June 12, 2013

Update 11: Chipping away at the basic game

It's been a busy few months for me as I had a new baby girl, kicked off two major projects at work and worked on a variety of outside spring projects in the backyard.

I have still been chipping away, converting my characters into Unity Prefabs, working with selecting objects on clicks and finally, getting the first, very basic turns working. It's always two steps forward and then one step back. Fixing a shooting bug introduces a camera bug, which when fixed creates a UI bug.  


Tonight was typical. I rewrote the shooting mechanics, everything looked good, I fired it up, and then.... nothing. One of the downfalls of game development is that a lot of the debugging tools are still behind that of most web applications. I did figure out the issue, but my code is riddled with Debug.Log statements that track my progress.

It is coming along. Here are 4 screen shots that for the first time are beginning to show the basic workflow. Please ignore the obvious clipping and camera issues.


Turn 1 Player: The isometric camera scrolls to center over the player. The player can see two targets (ninjas). Clicking on these centers the isometric camera over the enemies.


Turn 1 Player Shooting: the player then presses/enables the shooting button, which switches to the player cam view. Here the player has 3 options. 1, shoot the current target. 2. using Tab, switch between the other targets. 3. Press escape and go back to the first screenshot.


Turn 2 Enemy. After the player has show, it's the enemy turn. The same rules apply as turn 1, but now it's the enemy. Note that I now appear in the enemy/target list on the bottom right


Turn 2 Enemy Shooting: Ditto, but with the enemy again.



Wednesday, March 27, 2013

Update 10: Updating the Camera

It became clear to me very quickly that my camera in the isometric view looked a little cheap. Looking at how XCOM implements their camera, I noticed that they did actually use a perspective view, but at an isometric height. Today I switched to a perspective view, which I think really improves things.




I also added a 'killcam', which is a camera directly behind my player. When I shoot at enemies, it now switches to the camera so that you can watch the kill shot and then back again. Pretty simple stuff really, but very effective.