Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Creating an RTS Game in Unity 2023

You're reading from   Creating an RTS Game in Unity 2023 A comprehensive guide to creating your own strategy game from scratch using C#

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher Packt
ISBN-13 9781804613245
Length 548 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Bruno Cicanci Bruno Cicanci
Author Profile Icon Bruno Cicanci
Bruno Cicanci
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Preface 1. Part 1: Foundations of RTS Games
2. Chapter 1: Introducing Real-Time Strategy Games FREE CHAPTER 3. Chapter 2: Setting Up Unity and the Dragoncraft Project 4. Chapter 3: Getting Started with Our Level Design 5. Chapter 4: Creating the User Interface and HUD 6. Part 2: The Combat Units
7. Chapter 5: Spawning an Army of Units 8. Chapter 6: Commanding an Army of Units 9. Chapter 7: Attacking and Defending Units 10. Chapter 8: Implementing the Pathfinder 11. Part 3: The Battlefield
12. Chapter 9: Adding Enemies 13. Chapter 10: Creating an AI to Attack the Player 14. Chapter 11: Adding Enemies to the Map 15. Part 4: The Gameplay
16. Chapter 12: Balancing the Game’s Difficulty 17. Chapter 13: Producing and Gathering Resources 18. Chapter 14: Crafting Buildings and Defense Towers 19. Chapter 15: Tracking Progression and Objectives 20. Chapter 16: Exporting and Expanding Your Game 21. Index 22. Other Books You May Enjoy

Creating a game design document

A game design document (GDD) is a document written by the game designer that defines the scope of the game, from the characters and story to the gameplay and mechanics used by the player. There are different approaches to elaborate a GDD, from straightforward text to dense documentation full of details and explanations. We are going to use a simple but effective method that consists of defining the bare bones of our game with enough details that will help us develop our game with all the features in mind.

In the following sections of this chapter, we are going to define the game that will be developed throughout this book: Dragoncraft.

Game outline

Dragoncraft is an RTS game where the player will defend a small village against the dragons that are scattered through the land. Before facing the mighty dragons and destroying their nests, the player needs to expand the small village by creating new buildings and training an army to both attack and defend the village. To grow the village, the player will need to gather and produce resources while defending the territory against orcs and exploring the lands beyond the village to find even more resources. It is important to create the right strategy to explore and defend before the dragons start to hunt for more food.

World

The level has a map showing land with a few forests, villages, and the dragon’s nest. Villages can contain both enemies and extra resources for the player, so it’s well worth the adventure to explore and raid them. Each level will have a map that increases the difficulty, giving the player more challenges.

When the game starts, the entire map is covered by clouds, so the player will have to send units to explore and review the map. The player must defend the village; otherwise, the enemies will kill all the units and take the resources away, making the player lose the game.

Characters

The player’s army can be trained to be bigger and stronger based on what buildings and levels the player crafted in the village. There will be two basic types of soldiers: the Footman, a melee combatant, and the Wizards, who can cast powerful spells from a safe distance:

Figure 1.1: Mini Legion Footman PBR HP Polyart by Dungeon Manson, ©2022 Unity Technologies

Figure 1.1: Mini Legion Footman PBR HP Polyart by Dungeon Manson, ©2022 Unity Technologies

The units can be generated and upgraded in the training camp using resources that the player collects. When both units are combined and used wisely, they can form a very versatile army.

Enemies and bosses

Hidden in other villages across the map, the enemies will wait for the player’s units to approach their territory. The orcs will attack the units with no mercy and, if they defeat the player’s units, they will follow the trail back to the player’s village to raid it. There are a few errant orcs that will spawn in different locations and search for the player’s village, attacking at first sight:

Figure 1.2: Mini Legion Grunt PBR HP Polyart by Dungeon Manson, ©2022 Unity Technologies

Figure 1.2: Mini Legion Grunt PBR HP Polyart by Dungeon Manson, ©2022 Unity Technologies

As the player starts to upgrade the units, the orcs will also become stronger by spawning new and improved versions. A few variables of the orcs with different colors and stats will keep the game challenging for the player.

The player’s objective is to find and kill the dragon and destroy the dragon’s nest. A few orcs will help the dragon, which is like the level boss, to defend the nest and attack the player. Each level will have a different dragon with different stats:

Figure 1.3: Dragon the Soul Eater and Dragon Boar by Dungeon Manson. ©2022 Unity Technologies

Figure 1.3: Dragon the Soul Eater and Dragon Boar by Dungeon Manson. ©2022 Unity Technologies

If the player is taking too much time to find the dragon’s nest, a new dragon will be spawned to protect the nest while the other dragon goes to look for the player on the map. The dragons are quite strong and it will take a few unit upgrades and a large army to defeat them. Unlike the orcs, the dragon will not abandon its nest to look for the player’s village if it kills all player units sent to explore the map.

Gameplay overview

Dragoncraft is an RTS game where the player starts in a small village with a couple of units and very limited resources. The player will need to expand their village by gathering resources and training more units to be prepared to find and kill the dragon hidden on the map. The player gives commands to the units to gather resources, build or upgrade a construction, and train more units.

When the game starts, only the village is visible in the top-down camera, and the player must select and command the units to go explore the map and clear the way. The mini-map on the UI is a great tool to quickly move the camera to a desired location on the territory and will be very helpful in the late game.

Enemies, controlled by the game’s AI, are hidden across the map and will attack as soon as they see the player’s unit approaching. Also, from time to time, a few enemies will start to explore the map and find the player’s village to raid and loot the resources. The player must explore and find the dragon hidden on the map, defeat it, and destroy the nest. If they take too much time to find the dragon, the dragon will start to look around and explore the map, but the nest will be very well guarded by another dragon.

The player oversees the village and gives out orders to make the units perform activities. The player mainly completes input via the mouse, in which they can do the following actions:

  • Left-click to select a unit or building
  • Left-click and drag to select units
  • When the units are selected, right-click to set a movement target (when the target is in a valid position) or attack an enemy
  • When units or a building is selected, the UI at the bottom of the screen will change to display information and extra actions available
  • Moving the mouse cursor in any direction will also move the top camera

Besides the mouse, the player can use the Escape key to pause the game, and the Space key to move the camera back to the village.

Game experience

The player must have the feeling that they need to think and act quickly as the enemies are doing the same to raid the village. All tools and resources available should be useful for the player to make decisions and see the outcome so they can plan the next steps.

The game should be balanced in such a way that a series of wrong decisions may lead the player to lose the game, but at the same time, the right decisions lead them to victory. The victory path should be challenging and not a shortcut that will make the player so strong that nothing can defeat them. In the end, the player must feel rewarded by the experience and want to play again but on a slightly more difficult map.

Mechanics and modes

The gameplay mechanics are the classic RTS actions that the player must choose wisely because each one takes some time to complete, and the units can’t be interrupted once they start an action. The selected units can perform different actions, such as the following:

  • Gather resources from a location and bring them to the main village building
  • Build or upgrade constructions
  • Attack an enemy
  • Move and stay idle in one specific spot until another command is given

There are different types of buildings and they can all be upgraded. These buildings are required to store resources, train new units, and unlock new upgrades. Besides the main hut, all other buildings must be constructed using at least one unit, and the cost of resources is displayed in the UI. The buildings are as follows:

  • Town Hall: This building is responsible for storing resources. Upgrades will increase the number of resources received and unlock other buildings.
  • Barracks: This building is responsible for the units’ training. Upgrades will unlock different units such as the Wizard for ranged combat and stronger units to be trained.
  • Defense Tower: This building is used for defense. If the enemies enter the tower area, a ranged attack will hit them.
  • Blacksmith: This building is used to craft strong weapons and armor for the units, giving them more means of attack and defense.

Once the player finds and defeats the dragon, and destroys the dragon’s nest, a new game will be offered to the player, where they can choose to play the same map again or the one that was unlocked by completing the current one. Each map is predefined, and no random levels are generated.

The GDD is a great resource for describing what the game is about and the gameplay and mechanics that make it a great game. It is also important to let the game developers know what to create and how everything connects to make a memorable experience for the player.

You have been reading a chapter from
Creating an RTS Game in Unity 2023
Published in: Oct 2023
Publisher: Packt
ISBN-13: 9781804613245
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image