Game Creation & Development Tutorial For Beginner Programmers

Complete Guide To Game Design: Free Tutorial About How To Code A Game For Beginners

Almost every serious gamer wants to develop his own video game that suits his tastes, and if possible, profit on it. After that they give a try to their little dream and, as you guessed, fail excessively.

They don’t pick best tools, they code in wrong language, they pay for things that have free alternatives, and this chain of mistakes quickly builds up till their frustration reaches levels higher than motivation does.

Then they give up on their game design dream, even if they were smart or talented, or their game idea was really good – they gave up, so nothing of that matters anymore.

This free, huge, over 20000-words game development guide is targeted specifically at ambitious independent developers who want the highest chances of creating a successful game, acquiring players, and making sales. But most importantly, to create a game that they want to play and be proud of.

If you follow this regularly-updated tutorial, you will learn how to make a game using best, free, and modern tools, frameworks and systems. And if you also follow the rest of articles on the site, you will learn how to acquire players through marketing channel, keep them for long, and indirectly gain an edge over your competition.

That altogether, along with a lot of motivation, discipline and work, can result in profiting on coding games as independent developer, in creating a brand, being recognized and making even more sales. But there’s a long way before all that happens, so lets get started from the basics!


Getting Unity Game Engine & Account

Unity is our choice because of it’s outstanding performance, easiness, limitlessness, C# support and many more. There’s no reason to pick other engine or code the game from scratch instead.

Unity is just perfect so don’t think about changing the tool, which would just reduce your time. Our first step is downloading Unity, installing it and registering an account. So read post about getting Unity engine and account, this is not something complicated, the important part is about how free this engine really is.

If you already installed Unity and know everything about royalties, then its time to create 3D model for our player!


Modeling First Humanoid Character

We could just move the 3D cube around and code movement for it. But that’s boring. Why would someone do that? Blender is like Unity of the modelling world. It’s free. It’s popular. It’s great.

Especially after version 2.8 came out – it’s hard to not love this software. Lets instead model our humanoid player character in Blender so we can work on something that actually resembles a game. Read this chapter about Blender character modeling, because an indie developer, you will do a lot of things on your own, including modelling, and Blender can really speed up your asset creation.

Not only that, but models made in free Blender aren’t any worse than these made in paid alternatives! But character model alone is useless. What do you want to do with it without animations? So we need to create the most basic animations for running, jumping and being idle before we code the movement.


Creating Character Movement Animations

If you thought gamedevs hate to create models, then you were wrong. What indies truly hate is making animations, and most especially character animations. That’s because the time investment required to make a-not-painful-to-look-at running or jumping animation is very huge comparing to writing a code or doing other parts of our game.

Lets not wait any longer and get to creating run, jump & idle animations for character model in a way that’s much faster and perfect for beginners who already have a lot of stuff to learn, so read chapter about character animation design that uses Mixamo as main source. You can do all your animations this way and in other cases you will have to use Blender – which is just as great at animating as it is at modelling.

So we have movement animations of our character, what we need to do now before we write the code is to hook them to Unity’s Animator.


Importing Animations & Setting State Machine

Creating a 3D character is tough. Not only we need a model, but also an animation, that we later need to set properly in Animator, and all these things need to be done before we can code our movement.

This is why so many people prefer creating 2D games – they are easier. But 3D is just beautiful and limitless. So follow this lesson about Unity Animator and animation, in this chapter we will be creating state transitions & parameters in Unity’s Animator to later interact with our animation via code, and of course to have smooth transitions between each of our clips (e.g. from running to idle or from jumping to running).

This chapter is quite easy (it just looks like its not) so after that is done we will encounter first problems in our programming journey – writing player movement code that interacts with clips via Animator API and character object via Character Controller API.


Coding First Scripts & Player Movement In C#

Coding is the funniest part of game design. Coding is also one of main reasons why people chose Unity instead of other engines. That’s because people absolutely love C#. C# is an amazing, well thought, multi-purpose language.

Coding in C# or even rewriting our code (when something goes wrong) feels more than great. In this chapter we will code 3D player movement, animation & rotation via API of Animator & Character Controller components to later create a camera script that will be great fit to out movement. So head to chapter about coding Unity C# scripts to make our character movement, if you don’t know C# then that’s an issue, however I explained C# basics as well.

What you need for now is to just understand the basic syntax like variables, methods, functions and if statements. If you understand that, further learning of both C# and Unity’s API will go very smooth.

If you test the changes you can see we can already run around and jump but camera doesn’t follow our player. Such gameplay doesn’t make sense so in our next chapter we code a camera script that follows players and orbits him.


Making Following, Rotating & Orbiting Camera

Creating a camera script that will work for 3D FPS, MMO and RPG video games is huge challenge. That’s because it involves messing with complex properties such as quaternions that represent 3D rotation data.

However, you only need to do it once. In this chapter we will create a player-orbiting & player-following camera control script that will be assigned to camera object. Head to chapter about creating Unity camera control script, it can do many things at once, you can decrease or increase the zoom, you can make it look at mouse cursor (it happens by default), or invert axes. It’s great for any 3D single player RPGs, MMORPGs, and is similar to default Unreal Engine camera.

What makes this script different from typical camera is that it’s orbiting the player rotating around him, while looking at mouse. So you can run in one direction, but look with your mouse wherever you want and it won’t change where we are running.

Wouldn’t it be annoying if we had to rotate our character just to rotate our camera? In our next chapter we will be creating RPG inventory system that works for any kind of games, even multiplayer, 3D and 2D.

Creating Drag & Drop UI RPG Inventory System

Whatever game you’re creating, you need an inventory system. Without it, players don’t really feel like they are getting any better, and character development (along with collecting items, weapons and upgrading them) is huge psychological entertainment and game addiction factor.

Not only such inventory is required in all game genres, like RPG, MMO, MOBA, FPS and other kinds, whether multiplayer or singleplayer, but also it is really interconnected with other parts of the game, such as character equipment window, quick-use item bar, skill window, and so on. So inventory system needs to be done wisely.

In this chapter we will create simple 3D inventory for our RPG game (but can be used in other genres and 2D games as well). It’s built on Unity’s canvas UI objects, and items are hold in slot elements. So read chapter about Unity RPG inventory system tutorial, it has drag and drop feature, you can rearrange items in inventory, and pick them up from ground or drop them. It has clean, optimized code, and not much of it, so it’s really easy to read, understand and extend it.

One of good things about this inventory performance-wise is that we use triggers instead of update function, so collision code is not checking if conditions are met all the time, but only during collision.

After you are done creating our inventory we will make an enemy, health-bars and artificial intelligence so our enemy knows when to chase us, when to attack us, and when to stop and go back to his base. We will also implement combat system.

Coding Unity Enemy AI & Combat System Scripts

One of reasons why people prefer multiplayer games from singleplayer is because NPCs are boring and easy to trick, while real players behave in most unexpected ways. One way to fix it is to add multiplayer to your game, but even multiplayer games need smart monsters, enemies and NPCs in it.

In this chapter we will be creating very basic Unity’s artificial intelligence enemy script, combat system, health bars, chasing and attacking, and going back when target is out of sight. So read tutorial about coding Unity AI enemy & combat, enemy will hit in fixed time intervals, and after each attack player HP will be removed.

Whats good about this combat system is that it has clean code, not much of it, it’s easy to understand and extend, just like our inventory. Its also optimized performance-wise.

Nowadays players get bored by static, passive enemies that are easy to run from and won’t attack until you come close. So it would be smart to create more entertaining system for our game, perhaps enemy could attack our village from time to time, or track us in the forest.

Leave a Reply