Friday, 12 December 2014

Ultimate FPS and Photon Unity Networking

I received an e-mail today that got me interesting in my game again.

Too much of my time was spent tinkering with animations and controls to try to get things just right. I've looked at some pre-build assets before but none quite hit the mark.


Ultimate FPS (UFPS) have added a third person view and now multi-player.  Both those features are exactly what I have been waiting for.  They have teamed up with Photon Unity Networking (PUN) which is my multi-player platform of choice so I am already familiar with that.

http://forum.unity3d.com/threads/ufps-ultimate-fps-50-off-sale.126886/
https://www.assetstore.unity3d.com/en/#!/content/2943
https://www.exitgames.com/en/PUN

It's a closed Beta at the moment but this looks to be exactly what I need to speed up my development:
http://www.visionpunk.com/content/assets/ufpsmp/landing.html

1000's of hours have gone in to UFPS which I would never have time to replicate and so I am very hopeful that all I need to do is add in my gamepad support and some AI and the rest will be level design and assets to complete the game.  Sounds easy but I know there is still a lot of work left to do.


Coming up to the Christmas break I might even have some time to work on it.

Fingers crossed that they let me in on the Beta.

Friday, 14 November 2014

Pause

Following on from my last post about source control, lots of additional things have conspired to halt development.

The aforementioned source control issuesLand Rovers, laptop problems, excessive work at my day job and then playing Destiny on my Xbox One have all been parties to what I expect to be a long pause.


Destiny is so close to the game I would have liked to have developed that I am spending my spare time playing that.


I expect to return to my own game development at some point but for the time being any updates will be few and far between.

Wednesday, 27 August 2014

Clone a Repository in SourceTree

I have not done much development for the last month.  This is because, in addition to being busy with other things, the repository for Diabolical on my main laptop became corrupt!  I have not had enough time to think about fixing it.  It's holiday time and despite the weather I have had some outside jobs to do including some work on my Land Rover.

I looked at the problem with SourceTree a couple of weeks ago and decided that the only way to fix the busted repository was to take a copy of my most recent changes that have not yet been pushed up, delete the old local copy of the repository and start again with a fresh download of the source.

The trouble is it's now over a Gig download so it's not a quick fix.  I also can't remember all the repository settings.  I use a quick work round for security issues and there are some very basic Getting Started answers on the support site but I decided to do some reminder screenshots to add to this article.

As long as the repository already exists on the server the process in SourceTree is easy.

Clone/New from the toolbar




Enter or select the source path




Select from the list on the server or select another server





Enter the local path to the folder to store the repository



You can select an existing empty local folder or manually add a new folder name which will be created


Press the clone button to download all the files from the repository

It may take a few minutes depending on the size of the repository and your download speed but then you will be ready to start working on your project.


Tuesday, 26 August 2014

Security Workround for SourceTree

SourceTree is easy to download and easy to install but getting the security working can be a bit tricky to start with.  This is made worse, if like me, you are pressed for time and sometimes behind an SSL aware man-in-the-middle firewall.



I kept getting an SSL certificate error when trying to clone a repository.  I am fairly sure this is due to not adding the SSH public key to the repository on the web site but at the time I was in too much of a hurry.

As I was having trouble I did a quick bit of searching and found an option to 'Disable SSL certificate validation...'



That got rid of my errors and allowed me to get on and download my repository.


For my open source and experimental projects the security is not critical but for more important projects I would suggest taking the time to configure SSH correctly.


Monday, 14 July 2014

The Importance of Nothing

Just a quick tip for this article.

I have a lot of layers in my Unity Mecanim Controller which I turn on and off as needed by setting the weight to one and then usually fade that back out to zero when no longer needed.  The layers are typically for upper body only movements like reloading or throwing.

I had struggled with unexpected jerky starts when the layer was enabled.

I eventually realised that there is a mandatory default animation on each layer.  In the layers where it was useful to transition from Any State, the behaviour of the controller is to immediately start the default state, which causes the jump and then start the transition from that incorrect state to the desired state.



Armed with that information I simply added a default state that does not have an animation.  It does nothing and has no transitions but that fixed it.

Wednesday, 25 June 2014

Mecanim Animations

I have been working on moving about the game and getting the animations in place for the actions I will need.

The advantage of Unity is there are lots of pre-produced kits to use.  Some free but most have a small amount to pay.  I have been working on the in-game movement.  I have tried lots of the free packages, used most of the tutorials and purchased a lot of animations at modest prices.

I have found that the Unity Mecanim system is very powerful.  It has some great advantages, like being able to re-task animations from one model to another.  Like any complex system, getting the best out of Mecanim is still time consuming.

None of the assets I tried or purchased had a control system or set of animations that completely suited how I wanted Diabolical to behave.  I have therefore created the input controller and the Mecanim controller almost from scratch.

I created myself a test environment using bits and pieces from the assets I purchased and some of the tutorials.  This made it easy to test changes.

Some of the best animations I purchased were designed for root motion as are most of the latest Unity tech demos.  Root motion is where the animation moves the character within the world.  This leads to a much better looking result.  The trouble I found was that I could not get it to feel like a first person game.  It felt like watching a third person.  For example, instead of the animation moving as quickly as the player input round a corner, there was a nice looking smooth curve but not quite what the player controls were doing.

Diabolical is an over the shoulder game, so although the view is third person the controls should feel like a first person game.


If I had more time or lots of people to work on it, I am sure root motion can be used to produce a good feeling and good looking first person solution, unfortunately I have neither the time nor the people, it's just me.  I have opted for the more traditional route of the input directly moving the player entity and the animations doing a best approximation of the movement to get there.

You end up with feet sliding and perhaps the odd lag in the animation but to me the movement feels better from a players perspective.

It's taken a few weeks and I've had a few frustrating days in that time but I am now happy with the result.


I have more and better animations than I had in the XNA version.  In Unity I already have rifle and pistol aiming up and down, walking, running, jumping, shooting and reloading.  I just need to add throwing grenades and I am done with this bit.

Monday, 12 May 2014

Blender to Mixamo to Blender to Unity

As with all 3D modelling one of the biggest problems is transferring models between applications and still retain all the details.

The following is what works for me to get a mesh modeled in Blender 2.70a in to Mixamo to create the rig and then back in to Blender and on in to Unity 4.3 still in a state to animate.

You may not need to get your model back in to Blender but I need to add some simple animations not available from Mixamo yet.

Blender to Mixamo

Export from Blender using the FBX exporter that ships with Blender 2.70a.



You only need the mesh but the settings matter little.  Mixamo appears to sort out most things.  I used the defaults of -Z Forward and +Y Up.  I do change the Path Mode to 'Strip Path' so the FBX expects the texture file in the same folder as the FBX file.

Compress the FBX file and the texture file in to a zip file and upload just that Zip file in to the Rig upload of Mixamo.


It took me several variations of file types before I worked out the above that worked.  Even the zip file was a problem.  For some reason a zip file created with 7zip did not work but a zip created with WinRar did.

Once in Mixamo the Auto-Rigging worked very well.  Mixamo does a much better job of weight painting than I can manage.

The next trouble was exporting in a format that I could read back in to Blender.

Mixamo To Blender

I found the standard Collada worked with Blender 2.70a, not the version for use with the older version of Blender.



I added the T-pose animation and downloaded it as a zipped Collada file.

I then imported that in to Blender using the Collada (Default) importer shipped with version 2.70a of Blender.



I never understand why most importers change the scale to 0.01.

I simply change the scale for all three axes back to 1.0 and the model and the armature are as I expect.


I downloaded a version with an Idle animation and that worked as well.

Blender to Unity

Blender to Unity poses few problems.  Export to FBX and drag in to Unity.



Again I use the standard settings in Blender, I only include the Armature and Mesh and change the Path Mode to 'Strip Path'.

In Unity, drag the FBX file exported from Blender in to a folder in Unity.


The model imports face down but the armature and animation will make the model face the correct way up without having to rotate the imported mesh.



Like other importers Unity also imports at a scale of 0.01 so it needs to be changed to a scale of 1.0.



If necessary drag the texture in and create a material using that then drag the material in to the mesh renderer for the model.


Prepare to Animate

To use any of the animations it will be necessary to configure the Avatar Rig in Unity.



Select the model and press the Rig button.

Change the animation type to Humanoid and press Apply.



The chances are it will work it all out itself but if necessary you can press the configure button.



At this point you should be able to use Mecanim animations on the imported model.  Job done.