Kotlin Game Development: Introduction

I’ve always been interested in game development since I’ve got my first video game console: Dendy, that was a hardware clone of the Nintendo Entertainment System. I’ve enjoyed playing video games but I was also interested in how those games worked under the hood. I knew nothing about programming and even computers in general but I was sure that game development is a lot of fun.

Game development is one of the most fulfilling things that I experienced in my life. There are no rules or limits on what can happen in a game, the only limit is your imagination. You are free to create a whole world from scratch and it will follow any rules you want. You can express your ideas in a game and share it with anyone.

This is the first part of the “Kotlin Game Development” series and it’s better if you read it in chronological order:

  1. Part 1 - Introduction (you are here)
  2. Part 2 - Creating a Scene
  3. Part 3 - Controller Input
  4. Part 4 - Game Loop
  5. Part 5 - Game Factory
  6. Part 6 - Main Menu
  7. Part 7 - Model
  8. Part 8 - Game Scene
  9. Part 9 - Finalizing The Game

Art Form or Entertainment?

I think that games are a form of art. They can tell you an interesting story, just like a good book does, but you can actually see this story exactly as the author wanted you to see it. Sounds familiar, right? It’s just like a movie, but movies are linear so you can only be an observer who have no influence on what’s happening. Also, the movies have a fixed pace and it’s one of the reasons why some books are much better than movies despite the lack of visuals: movies are often artificially shortened to fit the movie theater standards or artificially extended to show you more advertisements.

Note: these articles assume that the reader has a programming experience. The reader is expected to be familiar with Kotlin or Java (example code will be written in Kotlin), but people with a background in other object-oriented languages probably won’t find any difficulties reading this tutorial.

Common Issues

The most common issue that an indie game developer might face is the lack of motivation to finish a game. Here are several tips on how to stay motivated:

  • Evaluate your skills realistically. It’s impossible to master everything, learning every aspect of game development can take years but it’s not necessary to start writing games as a hobby. Many beginners try to use low-level libraries such as OpenGL or DirectX in their first games. That’s what a professional game developer should know how to use but in most of the cases the Canvas API would be a better choice since it’s much simpler to use. You can save a lot of time and nerves if you select the right tools.

  • Consider how much time it would take to create a game. A lot of people try to write their own MMORPG or think they can match the top games in the industry in terms of the features. Let’s make it clear: even if you have the required skills and motivation, no one can make such a game in reasonable time. It takes hundreds of people and a few years, sometimes more than a decade to produce a typical AAA game. As an indie game developer or a small team, you don’t have a lot of time and resources but there are advantages in being small that you can utilize. Although it’s nearly impossible for you to create a giant game world and tons of beautiful graphics, you are able to experiment more with a gameplay. Big companies are too worried for their sales and it limits their ability to experiment with a gameplay. If you have no investors to please, that actually gives you a big advantage.

  • Don’t forget about graphics. It is an important part of the modern games. It’s cool if you can write a clean and beautiful code but players won’t see it. If your game looks bad it can discourage your player and even yourself. It’s much more fun to work on something that looks nice and clean. The typical indie game does not require a lot of graphics but graphics is very important to keep you motivated and make your game more enjoyable.

Conclusion

We won’t use any any specific game engine, it’s more fun to create a game engine from scratch and it will also help us to better understand how the video games work under the hood. In this series we’re going to create a Snake game because it’s relatively easy to implement which makes it a good game to start with.