Unity Triple A – Characters looking at stuff via IK

I have been talking about doing this for ages, and as my interest for Triple A techniques increases and the blog was looking a little sparse, I thought I would do a few tutorials on more Triple-A techniques. In this article, I am going to talk about using Inverse Kinematics in Unity and in particular characters looking at each other.

If you have ever played games like Uncharted 4 or Final Fantasy XV, when characters talk to each other whilst the player is controlling them, you will see them physically look at each other. This to me is really cool and adds a level of immersion that you wouldn’t get if the characters “just” talked to each other. If you look at the gif above you can see a transform being moved around the environment and the characters head looking at it, whilst the rest of his body is still. That is the sort of thing we will be looking at in this article.

So firstly what is IK?

Well in simple game dev terms, it is an animation technique.

Most animation is produced using a technique called forward kinematics. This is where an animation is created by rotating the angles of joints in a skeleton to predetermined values. The position of a child joint changes according to the rotation of the parent and thus the end point of a chain of joints can be determined from the angles and relative positions of the individual joints it contains.

Inverse Kinematics is working backwards to forward kinematics (hence the name!). By taking a chosen point in game space, you work backwards and find a valid way of orientating the joints so the endpoint lands at that position.

In simple terms, it allows us to make characters do stuff like point at things, look at things, touch an object at a specific point, etc in a more dynamic way. Unity actually has this built into Mecanim, which is pretty sick.

In order to get IK working you need a “correctly configured avatar”. In order to get one easily, I grabbed the Ethan from the Standard Assets.

Then we go an make an animator controller with his idle animation and set it up for IK by clicking on the little settings icon and enabling IK pass.

Then make sure your animator controller is actually assigned to your character’s animator.

Setting up the character to look at stuff is super easy. Create a new script called IK Controller and add the following:

Add a sphere into the scene and set it up as your _lookObj. Set up the other references. Run the game and move the sphere around a bit and viola.

We have a system similar to what is shown above.

Now in conversations, you can do a distance check if the characters are close enough you can enable the IK look at.

There you go. Easy!

If you want a sample project all the code lives here:

https://github.com/coxlin/IKTest

Share

User-friendly data tools for my JRPG

Image result for persona 5

I haven’t done a project blog in regards to tech in like forever. In fact, I haven’t blogged in like forever. HI! So yeah I finished Persona 5 (hence the picture) and it took around 90 hours. And that game is a JRPG. And I am working on a JRPG so see it is kind of relevant right!

So today, I am talking about how I am doing some of my data tools. JRPG are giant houses of numbers. It is like your overpacked loft… but instead of the random crap you have collected, it is numbers. And you want to be able to change these numbers all the time for balancing.

As I said before I built a sort of equivalent CMS system in my game. It is the loosest phrase of “content management system”, but as I said in the previous post, I modelled what I was doing by separating data, etc from my work at MediaTonic, who have a quite frankly world class CMS that is hundreds of times better than others I have used. Like I mentioned previously, I make heavy use of scriptable objects:

For some designers, however, double-clicking on the curve and editing it from the editor can be quite cumbersome. And writing Editor GUI code in Unity is quite frankly out of the question, because it is well… horrible… so I came up with a slightly better solution.

Google sheets. In google sheets you can build your data really nicely, view it in graphs and curves to see progression and can be used for balancing.

I came up with a sheet schema as above and then wrote some a little editor script:

And also a static parsing class to parse the data from a csv file to my game data:

 

What the editor script does is add this little button to my battle character scriptable objects:

And uses the parsing code to fill out those curves.

Therefore we can use the power of a spreadsheet program to plot our graphs and then load the data in and apply it to our scriptable object.

Neat, huh?

 

 

Share

Your first games programming gig – the 2018 edition

Image result for shadow of the colossus ps4

It is 2018, and whilst the world can feel like it is falling apart a bit in regards to politics, economics and whatever, we can rejoice.  ONE OF THE BEST GAMES EVER GOT REMADE AND IT IS NOT TERRIBLE! Seriously if you have a PS4 go and and get Shadow of The Colossus.

Anyway! This article is the 2018 version that covers some things to think about when applying for and getting first programming job in the industry… as the title states… whatever let’s get to it.

Your Portfolio, Personal Projects and Game Jams

When it comes to games jobs, your CV is literally a piece of paper that you have written. Although it lists all the tech you have had, your experiences, your grades, etc, it is the old phrase of “actions speak louder than words”. You need to sort out a portfolio site to show off your work. Whether it is a wordpress blog like this or a github site or an itch.io page, your portfolio is invaluable and will sell you in a much better way than a piece of paper does.

However, it is not as simple as grabbing all your university work and whacking it on a website. You should have some non-course related projects up there as well. Games is very much a passion industry, and not working on games projects outside of your course can show a lock of passion. Yes university can be busy… but compared to working 5 days a week full time, you have bags of time to work on something outside your studies.

When picking a personal project though, don;t expect to make the next Final Fantasy 15, but at the same time don’t just show off a Pong clone. What you want to do is pick something simple, enhance it, make it super polished and for bonus points, have it running on a cool piece of hardware and maybe even release it on a store. It is super easy now to make games on consumer hardware. You can build Android APKs and distribute them, you can even make games for your retail Xbox One.

If you are stuck for ideas here are some games/genres you can look at as reference for “relatively” easy stuff to make that also covers a couple of Games disciplines such as Graphics, Gameplay, Physics and AI. Don’t full on clone them though, make sure they are your work and have your unique flair in them.

Your personal project doesn’t necessarily have to be a full game though. As this is your first gig you may be limited to what options you have (for example you may not be an A.I. programmer right off the bat) but, you can still tailor it to indicate what you want to do in the future.

If you love graphics programming you can make a really sexy looking demo that shows off a certain technique. You can even go to places like GDC Vault and Siggraph and find papers to give yourself inspiration. For example you could have a crack at doing something like the Sand Rendering in Journey.

Image result for journey ps4

If you really like AI you can go to resources like AIGameDev for inspiration or have a look at something like TORCS where you can make a cool A.I. car controller to race against others.

Image result for TORCS

 

A really good way to add to your portfolio is a Game Jam. You don’t even need to go to somewhere and do one, places like itch.io have a massive list of game jams that are always running with a variety of different themes and the famous Ludum Dare runs pretty regularly. You may make something absolutely amazing that you then keep working on after the jam and release commercially. Titan Souls is a prime example of such a scenario.

Image result for Titan Souls

The best way to present all your work is through videos and builds. Show a youtube clip to entice me into actually want to play. Then, don’t make it hard for me to play. If you are using Unity or Unreal, make a web build. I can play it right there in the browser. If it is an exe, make sure you package everything your game needs (for example if it needs something old like the XNA runtime, make sure the installer is included). If it is a mobile game, provide and APK for Android (don’t go through the pain of sorting provisions profiles, etc for apple).

Show Passion

I mentioned this briefly in the previous section, but to reiterate, games development is fueled by passion. Rami Ismail of Vlambeer put it brutal honestly in the film “Surviving Indie”. For what you do in game development, you can probably get 2-3 times the salary doing something similar in another industry. Especially with programmers where you could in theory go and do banking software, etc for lots and lots of money (and if money is what drives you rather than enjoying making games for 85% of your week then yeah games is probably not for you). That said, games does not pay badly in the grand scheme of things where the average wage of the UK is around £27k and London is actually lower than that.

That minor tangent aside, the point here is, you get into the industry because you care. And show it. When talking to potential employers in interviews, etc release your passion for whatever games excite you and why they excite you. Just saying “I like playing games” does not really cut it here. Why do you like playing games? Why in particular Zelda? Why does Need For Speed make you super excited when you see a car slide round the corner? What are your favorite games.

I actually did a talk in the last month about games I work on in my free time and I did a whole slide of some of the games that got me excited and drive me into the industry in the first place.

Soft Skills and Being “well rounded”

Your soft skills are as important, if not more important than your programming skills. Professional game development is very much a team sport. You will often be working in an open plan style office with a variety of disciplines. The lone programmer sitting in a dark room does not exist.

Soft skills are your personal attributes, personality traits, communication abilities, etc that define how well you play with others. Soft skills are not something you can really go and hard learn, they come through your life experiences. Hard skills like knowing C#, C++, Direct X, etc are tangible skills you can go and learn that are easier to quantify. So in order to work on them, you need to do stuff with others to see how you interact with others.

Here is an example that puts it in a more blunt way. You could be the best C++ programmer ever interviewed, but if you are super arrogant about your skills, don’t listen to anyone else’s opinion, don’t want to learn form those more experienced and think you are gods gift to game development, you are a bad developer.

Blunt, but you see my point right?

You can read books or whatever to improve soft skills, but in my opinion, go and do something different with other people. If you are at university, seriously, don’t spend all your time sat in the library and just reading programming books. You are not just missing out on half the experience, but also you are not taking the opportunity to develop your soft skills. There are loads of clubs and teams that tailor for a variety of interests. I personally did fencing (and still do now), which at Uni, is a team sport. I met up with people, interacted with them and developed your soft skills. Doing other things than just game dev actually helps you with your day to day, and also gives you a broader perspective.

Also, yes you get your degree for life, but after a while, it just becomes a part of your CV. Your degree is great at the start of your career, but your soft skills are going to be setting you up for life. Still work hard and aim for a 2:1 or over, but don’t sacrifice the other experiences and opportunity to improve your soft skills as well.

Swot up

OK, so you have applied for a job with a nice covering letter, CV and portfolio and you have a date for the interview. It is time to swot up. Basically, revise all the things. OK maybe not all the things but definitely the things your employer is looking for. The three things I would suggest revising regardless of the employer or role is Data Structures, Algorithms and 3D Maths. The majority of games programming will come into contact with some sort of maths and some point (especially the dot product and cross product, that is a question that EVERYONE asks). You are going to want to be able to store data in the most efficient and effective way possible, so you want to know what sort of data structure you should use in a specific scenario. You will possibly want to iterate or manipulate that data, what is the best algorithm to do that?

Look over what the job spec was again. Do they mention Unity or Unreal? How are your skills with those engines? If they use Unity, how is your C#? If it is not super clear, what engines or tech do their other games use? Wikipedia pages often say, but you can google this and find out. If you really can’t find it, and the game is on Steam, why not explore the files and find out? Unity games have a very specific structure for example.

Be nice, polite and passionate in interviews and don’t panic

Hey look, there is that Passion word again 😉 So you got the interview. Awesome. There is something in you that is attractive to your potential employer. Seriously, that is amazing, you have successfully sold yourself to someone else, and that is a win in itself.

So when you go, first off be likable. You are a human being at the end of the day and so are the ones that interview you. You aren’t some programming robot that is just gonna whack out code consistently, you are going to be in a team working with artists, producers, QA testers, etc. Show that you can fit into these teams. You know the soft skills? Show them off.

Be polite, do your thank yous, shaking hands, etc, pretty much all the stuff you would do in a normal interview. Although it is the games industry and we don’t often where suits, smartish clothes ( although I wear this every day) such as a nice shirt, jeans and pair of shoes is always a win (in my opinion anyway some people won’t mind 😛 ).

Also be passionate about what you do, love games. If you don’t love what you do, is it worth doing?

Finally if you get asked a question you don’t know about, try to solve it calmly. If you get it wrong then and you are calm about it that is much better than quite frankly “losing your shit” because you got it wrong. You are a grad, you really aren’t expected to know everything, but you will be expected to think about ways to solve problems in a cool and calm manner. “I don’t know” is a legitimate answer if you are REALLLYY stuck.

Make sure the job is right for you

Once you leave Uni, you will not know everything. And if a company expects you to know EVERYTHING then it is probably not going to be the right place for you. I have been in the industry for 5+ years and I certainly don’t know everything! And as a developer you will keep learning. However when you start as a junior it is good to have someone who will guide you and teach you cool, interesting and most importantly useful stuff. It is hard but try and get a feel for the place when you go for an interview. If they are going to mentor you and improve your professional skills as a programmer, that is a brilliant place to be. If they are just going to throw you in the deep end and not give you clear deadlines or expectations, then great if you want to learn things the hard way, but I would suggest going somewhere where there will be somewhere to mentor you and help you in your career development. Similarly, try and get a feel for the culture. Are the people nice? You are going to have to work with them for 8 hours a day. Can you literally picture yourself working there?

Some of this will be based on gut feels and stuff you can’t always quantify. I had the opportunity to go for an interview at a studio, but when I walked in it was almost silent and people seemed to be almost ignoring each other. As a super social person, I would have died pretty quickly there. Similarly, there was a company that said it was a games company, but when you drilled down to it they didn’t really want to make games, they wanted to focus on “Tech”. Which is great, it is a part of the games industry, but not great for someone who is passionate about the actual games rather than “the cool tech” behind it.

Lets look at another example. Your dream may be to work at a big company that makes cool 3D console games, however, you may just be a cog in the machine. On the flip side there may be a smaller mobile company, but you get your voice heard. Which one do you feel is best for you?

Finally, what are there “working on your own stuff” clauses. Some companies will stop you working on your own projects outside of work, or at least want full ownership of ANYTHING you work on, others will not. Is that important to you?

Be a humble sponge

When you get your first job, remember, you are brand new to this. A fair few of the guys you will be working with have been in the industry for a while. So even if you got a first, were top of your class or whatever, these guys will know more because they have worked on real life game projects which are very different to Uni projects you work on. Absorb everything from them, the good and the bad. You will learn so much, in a short period of time. When I first left Uni, I would say I learned a lot more of actual game development in the first couple of months in my career than I ever did in my 4 year course.

And also accept that you may not be put on the most sexy thing in the world. You may join a studio that runs multiple projects, some that are really “cool and interesting” and some that are a bit more vanilla. And you might get put on the vanilla shouldn’t be put off by that. Far from it. As a newbie you should embrace being put on that project. You will still learn a hell of a lot from more senior people that have been in the industry before. You can also make an impact to that project. Yes, there may be cooler stuff going on, but like I said, you are new. No stripes have been earned yet, so picking and choosing is not really an  option. Also in the long run, the vanilla game might do gangbusters and look great on your CV. And if you have worked on a game that has done well, then picking and choosing is more likely. Similarly, you may go to triple A and end up working on “the screen where the loot boxes are bought”. Again, yeah this is not sexy but you are part of a team that you can learn from.

Recruiters

In my experience, as a graduate it is better to send your CV around yourself. Because at the end of the day, that is what most recruiters are going to be doing for you at that stage in your career. This is how recruiters work. They are paid by your employer (usually after your probation period) a percentage of your salary for the first year. In other words, when you are hired, your employer is paying you and the recruiters the commission. Now, if you are a grad, in my opinion it is better for you to apply direct than it is through a recruiter. For one, it will be cheaper for your employer and two, if you apply direct it shows you took the time to go through their website and an employer feels you actively want to be there rather than being thrown a job you may or may not be interested in just to get your foot in the door. Later in your career, they can be super useful. Sometimes they have jobs that will never be advertised on company websites and they can do a lot of the adminy stuff if you are busy. But again, you are more likely going to want to take advantage of this in your later career rather than as a graduate.

And that’s that!

Well I hoped this little opinion piece helped and wish you good luck to you all applying for your first gig in games! If you are a grad and need advice or fancy a job working with yours truly at Mediatonic then you can contact me over on LinkedIn

Image result for thumbs up

Share