If you’re looking to break into game development, learning to code will give you superpowers. The advantages of knowing how to program include:
- You will make better design decisions because you know how the game systems work.
- You will fix bugs faster and give better feedback to team members.
- You can create tools and scripts to save yourself time.
- If you really take to it, you open up new career options like technical artist or technical designer.
Today you can do more than ever before without knowing a lick of code. But just about every role in game development benefits from scripting, and knowing the basics will separate you from the pack. In this article, we’re going to show you how to get started learning to script. We’ll be using Lua and the game platform Core, which will let you see the results of your coding right away.
What is scripting?
Scripting, also known as coding or programming, is the way to write instructions for the execution for your game using a very specific language. This is similar to rules for a board game, which explain the order of turns, determining the first player, and different options at a particular moment. The difference is that board game instructions are written to be understood by humans, whereas for programming you need a language that’s understood by the computer.
Choosing a Programming Language: Lua
Choosing a Game Development Platform: Core
The official Lua documentation is fantastic, but simply writing Lua code won’t let you explore making a game. For that, you’ll need a game development platform or engine. For purposes of this article, we will be using Core, since it uses the Unreal engine and most applies to learning professional game development. Other options include LÖVE, a free framework for making 2D games in Lua, and Roblox. Here’s how to get started installing Core.
Choosing a Good Code Editor
Choosing a good code editor will save you time. Most game dev platforms like Core include a built-in code editor, which is great if you want to get started right away, but you will be happiest in the long run setting up an external editor. We recommend Microsoft’s Visual Studio Code. It’s free, open-source, and used by more than 1/3 of developers. Other code editors include Sublime Text and Atom. Here’s how to set up Visual Studio Code for Core, including extensions to make it easier to use Lua and the Core API.
Tutorials will help you learn the basics of programming, as well as details specific to Lua. A good tutorial will lead you through making something on your first try, giving you the foundation to ask more specific questions. The following tutorials include several “getting started” overviews, as well as details about the Core API, which will let you use Lua to activate more complex behaviour.
- Scripting introduction: a beginner’s guide to Lua and scripting in general.
- Intro to Lua on Core Academy: a complete introduction to Lua scripting for game developers.
- (Video) Learn Lua quickly with no coding experience necessary: a one-hour tutorial for learning Lua from scratch.
- Lua.org getting started guide: a good introduction to Lua by the creators of the language (note that it does not include game dev specifics).
Trial and Error With Free Content
Now that you have the basics under your belt, the best thing you can do is just start making things. Don’t worry too much if you don’t know how yet. Diving in is how you learn what you don’t know, which is a crucial step because it tells you what to learn next.
Still, starting from scratch is intimidating. To help, modern platforms like Core and Roblox come with vast libraries of community-made content that you can download and change to your heart’s desire. Pro tip: try commenting out lines of code and seeing what breaks. You can always un-comment it afterwards. This will start to show you what the code does.
You can also start with a framework, which is a collection of assets and scripts for a common game type. For example, in Core, start with the RPG Framework that includes an XP system, NPC enemies, and fantasy weapons in one package. Each of these includes Lua scripts you can dive into.
There’s never been a better time to learn to code. Even if you’re aiming for art or design, code will help you make better games. Playing with scripts will teach you a ton, even if they break – especially if they break. So, have at it!
Thank you to Core Games for writing this article. Learn more about the platform at CoreGames.com