Turn Based Engine Developer Diary
Creating my own turn based engine in Unity3D.
Friday, April 17, 2026
April 2026 TBS Update
Thursday, October 7, 2021
My development workflow
Today, I'm going to demonstrate my developer workflow and architecture for my game, with Unity3D, GitHub, and Visual Studio. I've created a workflow that allows me to verify any change with a rich set of automated tests, and automatically load those changes into my Unity project, reducing the time to resolve bugs, and giving me confidence that my code is robust.
Architecture
At the top level, I have my Unity project (in green), a private project stored in GitHub. This has an attached .NET project, (named the default "Assembly-CSharp"), that references a .NET standard dependency "Battle.Logic", a public project in GitHub. Attached to the Battle.Logic project, is a unit test project that currently has ~97% code coverage - and leverages over 200 tests that run in just a few seconds - giving me almost instant feedback that the project is in good shape.
The bug
Wrap up
Sunday, August 1, 2021
Reorganizing, again.
Every couple of years I end up in the same spot, lost, overwhelmed, unmotivated. 6-12 months later I repeat the cycle, rebooting and starting again. I've done this for roughly ten years...
This round is different. This one is powered by DevOps and GitHub.
Why is this one so different?
First, I've separated the logic into a separate project, and it's open source and on GitHub for anyone to use. Using .NET Standard 2.0, and C#, I'm able to write unit tests that validate that this project is working as expected. As it's all just C#, no graphics are being rendered, the tests run extremely fast, nearly 200 tests in less than half a second. I calculate paths, chance to hit, field of view, etc, without a graphics engine. These automated tests are a crutch when I walk away for a day, week, or several months. I know that when I return, I have a series of tests to tell me when I break something else.
Additionally, I can visually see my maps and situations in 2D using ASCII. I can render these data structures in 3D with Unity3D relatively easily, but seeing it in 2D gives me an easy debug mechanism.
I also have a detailed log to help me with debugging. Human readable, important as I am a human.
More is coming, I've just started to integrate this in Unity3D, and I know there will be more breaks in development, but now I know I'm chipping away at a system I can always pick back up again. I start a turn by calling my battle logic, all of the movement calls return a list of moves and if their are any interrupts - and in general, it's making the 3D part of this, much, much easier to manage
Tuesday, September 26, 2017
Update 51: Emerging AI
- Find all possible tiles the character can move to, initializing them with a score of 0.
- Assign points to any tiles that are in cover (+10). If the character is currently not in cover, give all of those positions an extra boost to encourage the character to move into cover. (+10)
- Add points for tiles that are in range for the character to shoot at the opponent. (+10)
- Add points for tiles that close the gap between the AI and opponent. (+5)
- Add points for positions in cover that flank the opponent (+20)
- Add points if the opponent is within range and has more than a 50% chance to hit. (+10)
- Add even more points if the chance to hit is 80% or more. (+20)
- Add even more points if the chance to hit is 95% or higher. (+30)
- Order the list by total score, descending order (highest first)
- Pick the top score from the list.
Thursday, September 14, 2017
Update 50: Combat and 50!!
However, the combat is proceeding along nicely. I've added projectiles and the destructive terrain back. I've added back the shoulder cam when you are aiming and choosing your target. The enemy and player are now dealing (and receiving) damage. I almost have a quasi game here.
Here you can see the setup of the level, with the second (shoulder) camera ready
The view from the shoulder cam. The models really look low res here!
Boom!
Before the shot...
"Missed", that is the end of that wall!
Here you can see the ray-cast passing through the enemy, it was a hit!
Thursday, August 31, 2017
Update 49: Added weapons to the characters
I also added a muzzle flash when the gun shoots (it shows for just a fraction of a second).
Next I will add projectiles and add back in the destructive environment that I started with, all those years ago.
Sunday, August 27, 2017
Update 48: Implementing the turn state diagrams
When a player has finished all of their moves, it switches to the enemy turn, where the (overly simplified AI) decides to just pass ("Patrol"), and switch back to the player. Since the player still can't attack, I think this is fair.
Next we need to add AI to the player to move into cover and shooting between the two teams...




















