Introduction: Game Development 101: Tips & Tricks!
So, you like playing video games? Maybe it's about time, you built one up yourself!
Isn't it beautiful? The idea, that you get to create your own world, based on your rules and fantasies? I think it is.
But let's look at reality for now. You start creating your own game, plenty of resources to learn from, there's youtube and countless other courses and websites! Days turn into months, months into years, and you start losing patience.
The truth is, it is not that complex at all, in fact it's much easier and less time consuming than you think!
I'd like to share some very important topics, which most people overlook, but later on they become the most important reasons why most games don't get published in the end.
The most important thing a game designer/developer should be aware of, is PERFORMANCE. Right from the start, that should be your primary focus. It's important that your game should look good, with good graphics and all, but what's the point if your game requires a supercomputer to run it?
And that's the only reason why most games fail.
If you are interested/beginner in game development, I want you to know that you can do it too! It's easy, and it's fun. You just have to clear about what you want to make. The big decision to take, is whether you are going to make an art game, or you are going to make something that's entirely focused on programming, like Minecraft.
If you are good at programming, but also want to make it artistic, you are going to have a hard time building a game. It's going to become confusing for you, and your priorities will get mixed up.
If you are a beginner with no programming skills, I suggest making 2D games first, or perhaps an art game if you are up to the challenge( it's easy actually).
Unity is the game engine that I'll suggest, not only because Unity has made it very easy for people to make games, but also because there's a ton of documentation and resources to get you started.
Each game engine has it's pros and cons, if you want to compare before you start, feel free to dig around.
This is a great place to start! Make some 2D games using these tutorials first. Publish them, and then move on to the next big project! Most importantly, have fun! :)
[NOTE: I have attached a .pdf file containing a list of keyboard shortcuts for Unity]
Step 1: (Trick 1) Volumetric Lights!
If you have ever played any art games(or seen someone play), eg: Playdead's Limbo; you must have noticed how the rays of light are visible on the screen. It looks beautiful, doesn't it?
You can do this too! There are lots of tools(some of them are free) available in the market which can be used for that, for eg.: Aura. But these tools can lower your FPS count considerably, affecting the entire performance of your game.
There's a simpler way of doing this, which will have no effect on performance! Let me show you how!
You need a 3d modelling tool, I recommend Blender(it's free!). You can download it here.
1. Open Blender. Delete all the unnecessary stuff on the screen.
2. Press Shift+A on you keyboard to add a new mesh.
3. Go to Mesh > Select Cone!
4. That's it. Save it as a .blend file, or you can export it to any other format. Nowadays Unity supports a wide range of formats.
Now Copy that model(the cone), and paste it in your assets folder of your project.
We need a new shader for this Cone. So let's make that Shader!
1. Open your project in Unity.
2. In the project tab, Right click > Create > Shader.
3. Rename that Shader as 'Transparent Shader'.
4. Open that shader file ( monodevelop is unity's default editor ).
5. Copy the Code from the above picture.
That's it, we are all set! Now save that Shader.
We need to create a Material to use our new Shader:
1. In the project tab, Right click > Create > material.
2. You will see a shader option(drop down menu) at the top.
3. Change it from standard shader > Transparent Shader.
Add your Cone to the scene, change the material from Default material > You New material
You can even change the color of your Material depending on the color of lights you will be using. Also, the transparency amount can be adjusted!
Now, add a Spotlight to your Cone! To do this:
1. Right Click on your Cone model in the hierarchy
2. Lights > Spotlight
Change the color of your spotlight as you wish. Adjust the intensity and range of your spotlight, along with the transparency of your Cone Model!
Step 2: (Trick 2) Use of Fog
Fog is mostly used to create a nice realistic environment in video games. Sometimes it can compliment the art style of a game.
Apart from that, in Video game development, fog is used to hide objects that are far away from the Camera.
In Unity, the Camera gameobject has an option called 'Far Clip plane'. Adjusting this option determines how far your Camera can see. To increase performance, this value is sometimes decreased. But we don't want the player to notice that objects far away from the player have somehow vanished!
This is where the use of fog comes handy! Add fog to your scene, adjust the values, and that's it!
Read more about fog here.
To add fog to your scene:
1. Go to the lighting tab (Top right corner, beside the inspector tab)
2. The fog option should be at the bottom of this tab.
3. Click on the box to activate
4. Adjust the color, and density of your fog
Step 3: (Trick 3) Use of Depth of Field
Have you ever used a DSLR camera to take pictures? Heard of bokeh? If you have, then you can easily understand how depth of field works!
Its an effect used to simulate focus and blur effect, as if the camera object in your game is an actual Camera!
However, please note that using this effect can lower your FPS count considerably!
Read more about Depth of Field here.
You can get it from the Unity Asset Store, there are two options, the old effects pack, and the new post processing stack. Either one can be used.
To use this effect:
1. Download the suitable pack.
2. Select the Camera object in your scene.
3. Click on add component.
4. Type in, 'Depth of field'.
5. Select the suitable script.
6.Adjust the values.
Step 4: (Trick 4) Use of Bloom
Bloom is another visually stunning effect in Unity editor.
If you ever need to create a dream-like scene, or perhaps, a magical environment, the bloom effect will save your day! It adds a natural glow to all gameobjects in a scene.
Read more about bloom here.
There are lots of options available in the Unity Asset Store for adding this effect. However I'll recommend using the 'Fast Mobile Bloom'. It has minimal effect on the FPS count, and is very performance-friendly!
To add this effect to your scene:
1. Download the suitable pack.
2. Select your Camera Object in the Scene.
3.Click on Add Component.
4. Type in 'Bloom'
5. Adjust the values as required.
Step 5: (Trick 5) Multiple Directional Lights
Directional lights have the least effect on performance. So why not put it to good use?
We can use multiple directional lights of different colors to compliment the art style of our game!
For eg.; Suppose you are making a Sci-fi Cyberpunk-ish game. So you can use one directional light that's yellowish(like the sun), another directional light that's pink-ish or perhaps purple to add a tinted visual effect to your scene.
Step 6: (Trick 6) Use of Sprites As Background
To improve performance and FPS count, Sprites can be used in place of actual 3d models!
This will save you a lot of time(3d modelling takes a lot of time), and also improve the performance factors of your game.
Make a sprite in adobe illustrator, export it as .png and simply add it to your game as required.
To read more about how sprites work, click here.
This is a video demonstration on how to add Sprites to your scene.
Step 7: (Tip 1) How to Increase CPU/GPU Performance!
These are perhaps the most important things that have a huge impact on performance, but are often overlooked by developers:
1. Always try to keep the number of meshes as low as possible. For eg.; if you have a number of fruits in a basket, it's important that you make it as a single mesh in your 3d modelling tool rather than having a separate mesh for apples, bananas, grapes etc.
2. Use as few materials as you can. Always try to use one material/mesh rather than using five. Rendering materials and rendering meshes are the same to the CPU.
3. Unity has a very handy feature called 'Batching'. There are two types of batching, static and dynamic. Static batching is used widely. It combines static (not moving) gameobjects into big Meshes, and renders them in a faster way. To enable static batching, select a gameobject > in the inspector tab, on the upper right corner, click on the box that says 'Static'. The important thing to remember is that the gameobjects should not be moving, and that only objects using same materials can be batched together.
To read more about batching, click here.
4. Textures. The image files that you import to make new materials for your objects. These are the usual culprits that will slow down your graphics performance. Always use small size textures(but not low quality).
5. The other important thing is the number of triangles used in the 3d models of your characters. So try your best to keep the triangle count low while not compromising on quality.
Step 8: (Tip 2) Performance Vs Lights
The hierarchy of lights based on their effect on performance is: Spotlights>Point Lights>Directional Lights
Using lights in your scene does make it look great, but do remember to not use more lights than absolutely necessary. It takes up a lot of processing time to calculate the effect lights have on surrounding objects.
Please note the following:
1. Spotlights are the most expensive lights when it comes to performance. If it's possible to replace them with point lights, do it!
2. Spotlights and Point lights have a range. It can only affect objects that are within the range. If you have a large number of objects to light up, rather than using a single high range light, use multiple small range lights! Higher number of objects that can be effected by a light, means more computation, hence, low performance.
3. It's important to note that a mesh will only respond to the eight brightest lights affecting that mesh.
Step 9: (Tip 3) Scripting Vs Performance
1. Update and Fixed Update functions, don't use them unless absolutely necessary. Sometimes, there's no other way, and you just have to use these functions. In that case, keep it small and simple. Don't put a bunch of stuff under these functions. These functions are called several times per second, and can really add up if you have a large number of scripts with Update functions.
2. Unity monodevelop has an Update() by default. If you are not using it, remove it from any script that has it but you are not using it.
3. Coroutines can be used as a healthy alternative to Update calls.
4. Always remember to disable any monobehaviour script that you are not using anymore, but is still active in your scene.
5. Always try to call on functions in the most direct way possible.
Step 10: (Tip 4) Audio Enhancements!
Don't use compressed audio files for playing small sound effects like gunfire. It would cause the CPU to spend some time(unnecessarily) uncompressing it at runtime.
Step 11: Conclusion
Explore! That's literally the best advice that can be given. Explore concepts, concept art, see what other people are building, get ideas, build on those ideas!
Check out the best and top-rated games on Steam here.
What makes a good game great? Why is it that some games are an instant hit, while some are not? What makes a game unique? These are the various things that exploring can help you learn!
Thank you for taking the time to read this article. If you have any questions, drop a comment, or feel free to send me a text!.
Best of Luck!
Participated in the
Pro Tips Challenge