Tactics RPG Anchored UI

The user interface (UI) is one of those areas you always end up spending a lot of time implementing, and every game needs one in some form or fashion. I have built up a variety of reusable libraries in the past, but with Unity’s new UI tools I find myself starting over again. If you’re like me, the anchor and pivot system provided by a RectTransform may have been a bit confusing. I like working with it pretty well in the inspector, because I can modify the anchors and pivot to any corner for easy placement. In code, it wasn’t quite as easy, so this lesson is dedicated to the creation of a few reusable components which will, hopefully, make all our lives easier for awhile.

Continue reading

Better than events

I’ve received some feedback regarding using event-based architecture in my recent post on my Tactics RPG State Machine. The concern is that because events cause extra memory allocations it could have an affect on performance. I’ve used events heavily in every project I’ve worked on and to date have never observed a performance problem on their account. Still, I was curious to run some tests and see just how bad it might be.

Continue reading

Tactics RPG Path Finding

Pathfinding can be a relatively advanced task, mostly because the logic takes a moment to grasp. We will be using a form of pathfinding to highlight all of the tiles that a unit can reach. When one of those tiles is selected the unit will follow the best path to the target. To make it more interesting, I will add three different movement types: a walking unit which must go around enemy units and tiles with too large a jump delta, a flying unit, and a teleporting unit.

Continue reading

Tactics RPG State Machine

This week we are going to create a State Machine which, over time, will handle all of the states which ultimately control our game’s logic. Initially I will create a state which is responsible for initialization (creating the game board, etc.) and then we will add another state which allows us to move the tile selection indicator around the board using events from our Input Controller. We will also add a simple Camera Rig to make sure that the game camera is always looking at something relevant.

Continue reading

Tactics RPG User Input Controller

In this lesson we will be writing a component to manage user input. We will work with Unity’s Input Manager so that your game should work across a variety of input devices (keyboard, controller, etc). The component we write will be reusable so that any script requiring input can receive and act on these events.

Continue reading

Using Git with Unity

In the last post, I introduced the concept of Source Control and introduced several options available to you. In this post I want to focus on just one option and show some sample workflow of it’s use with Unity. We will create a new Unity project and configure it for versioning, initialize a local repository, make some commits, branches, and merges, as well as discuss some patterns of source control you should consider using. Continue reading

Intro to Source Control

Today I would like to talk about something which isn’t actually programming, but which every programmer should know – source control (also known as version or revision control). You will see this topic listed on most job listings as something you should be familiar with, but many hobbyists go far too long (sometimes waiting until getting hired into a big company) before realizing its many benefits. Source control can be extremely valuable even if you work solo on a project! Continue reading