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

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

Creating an RTS Game in Unity 2023: A comprehensive guide to creating your own strategy game from scratch using C#
Автор: Cicanci Bruno
Дата выхода: 2023
Издательство: Packt Publishing Limited
Количество страниц: 548
Размер файла: 5.6 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы  Дополнительные материалы 

Cover....1

Title Page....2

Copyright and Credits....2

Contributors....4

Table of Contents....8

Preface....16

Part 1: Foundations of RTS Games....22

Chapter 1: Introducing Real-Time Strategy Games....24

What is a real-time strategy game?....24

Classic examples....25

Modern games....25

Understanding the game and level design of an RTS game....25

Character....26

Camera....26

Control....26

Creating a game design document....27

Game outline....27

World....27

Characters....28

Enemies and bosses....28

Gameplay overview....29

Game experience....30

Mechanics and modes....31

Summary....31

Further reading....32

Chapter 2: Setting Up Unity and the Dragoncraft Project....34

Technical requirements....34

Downloading and configuring the Unity Editor....35

Using Visual Studio Code as the default IDE....37

Importing and organizing assets from the Unity Asset Store....41

Summary....43

Chapter 3: Getting Started with Our Level Design....44

Technical requirements....45

Setting up our base scene....45

Scenes....45

Lights....46

Camera....47

Ground foundation....48

Level scene....49

Creating the first map layout using Prefabs....51

Creating a custom group of Prefabs....56

Using ScriptableObjects to configure the map....57

Creating ScriptableObjects for game configuration....58

Creating ScriptableObjects for level configuration....61

Adding a custom editor for the level configuration....63

Creating a map editor to speed up map creation....70

Controlling the camera....76

Summary....82

Further reading....82

Chapter 4: Creating the User Interface and HUD....84

Technical requirements....85

Using Canvas for a responsive UI....85

Setting up the UI and HUD using Prefabs....91

Creating the MenuButton GameObject and popup....93

Displaying the resources counter....100

Adding the action buttons....103

Creating the details panel using a custom camera....106

Rendering the minimap....112

Loading the UI scene additively....115

Summary....118

Further reading....119

Part 2: The Combat Units....120

Chapter 5: Spawning an Army of Units....122

Technical requirements....122

Configuring the unit ScriptableObject....123

Spawning units using the Object Pooling pattern....125

Implementing the Object Pooling pattern....126

Creating a BaseSpawner class....128

Updating the UI using the Message Queue pattern....129

Implementing the Message Queue pattern....130

Creating the message interface....133

Implementing the warrior unit spawner....134

Creating the resource type....136

Updating the UI....137

Creating a debugging tool for the Editor....139

Creating the Object Pool for the Warrior unit....139

Creating the debug script....144

Summary....147

Further reading....147

Chapter 6: Commanding an Army of Units....148

Technical requirements....148

Preparing the Prefabs and UI....149

Adding more debug options....149

Preparing the Prefabs and UI....151

Drawing the selected area in the UI....153

Preparing the level scene....157

Selecting the units....159

Setting a custom color for the selected units....160

Defining the unit selector component....164

Moving the units....168

Summary....171

Further reading....172

Chapter 7: Attacking and Defending Units....174

Technical requirements....174

Updating the UI with the selected units....175

Setting up the selected unit details....175

Setting up the selected unit actions....184

Attacking and defending with units....197

Setting up layers and collisions....200

Updating the UI....202

Attacking and playing other animations....205

Adding the new Mage unit and ranged attack....212

Creating the data, object pool, and spawner....212

Setting up ranged attacks with fireballs....217

Summary....225

Further reading....226

Chapter 8: Implementing the Pathfinder....228

Technical requirements....228

Understanding the pathfinder....229

The Greedy Best-First and A* algorithms....229

The NavMesh....231

The Unity AI Navigation package....232

Implementing the pathfinder using the NavMesh....234

The NavMesh component....234

The NavMesh Agent component....238

The NavMesh Obstacle component....241

Debugging the NavMesh....247

Summary....251

Further reading....252

Part 3: The Battlefield....254

Chapter 9: Adding Enemies....256

Technical requirements....256

Configuring the enemies....257

Spawning the enemies....263

Creating the enemy messages....264

Creating the enemy component....265

Creating the enemy spawner....268

Configuring the enemy spawner....271

Testing the enemy spawner....274

Damage feedback in the UI....276

Managing the damage feedback....277

Fading the text over time....279

Setting up the Prefabs for the damage feedback....281

Testing the damage feedback....284

Summary....288

Further reading....288

Chapter 10: Creating an AI to Attack the Player....290

Technical requirements....290

Updating the physics settings....291

Calculating the damage....295

Adding a base class for the data....295

Adding a base class for the characters....298

Updating EnemyComponent....302

Updating UnitComponent....305

Adding damage to ranged attack....309

Managing the collision and chase behavior....310

Creating the collision component....311

Creating the Enemy NavMesh....318

Updating Unit’s NavMesh....322

Implementing the character life cycle....325

Summary....329

Further reading....329

Chapter 11: Adding Enemies to the Map....332

Technical requirements....332

Creating spawn points....333

Adding fog on the map....342

Adding a new layer and updating cameras....343

Creating the fog component....344

Creating the material and Prefab for the fog....350

Updating the Level Manager....353

Patrolling the area....357

Summary....361

Further reading....361

Part 4: The Gameplay....364

Chapter 12: Balancing the Game’s Difficulty....366

Technical requirements....366

Writing unit tests....367

Setting up the UTF....367

Creating the first test script....371

Adding more test scripts....377

Using unit tests to simulate battles....380

Simulating a battle against a single enemy....383

Simulating battles against multiple enemies....390

Balancing the battle difficulty....395

Summary....401

Further reading....401

Chapter 13: Producing and Gathering Resources....402

Technical requirements....403

Generating resources....403

Managing the player’s inventory....406

Producing resources automatically....411

Gathering resources....419

Adding the new Resource layer....420

Producing resources manually....422

Testing the resources....427

Summary....431

Further reading....431

Chapter 14: Crafting Buildings and Defense Towers....432

Technical requirements....433

Crafting and upgrading buildings....433

Dragging and dropping buildings....433

Configuring the Resource Store....441

Creating the Resource Store UI....447

Creating the Store UI....454

Training units....466

Configuring the Unit Store....467

Creating the Unit Store UI....470

Testing the Unit Store....477

Defending with towers....478

Adding the Tower model....479

Adding the new Tower layer....480

Adding the Tower as a unit....481

Testing the Defense Tower....489

Summary....490

Chapter 15: Tracking Progression and Objectives....492

Technical requirements....492

Setting up objectives....493

Tracking objectives....497

Creating the Objective component....499

Creating the Objectives UI....507

Pausing the game....509

Winning or losing the game....510

Adding the Game Over popup....513

Summary....517

Further reading....518

Chapter 16: Exporting and Expanding Your Game....520

Technical requirements....520

Exporting Dragoncraft for desktop....521

Preparing the Editor scripts....521

Exporting the desktop build manually....522

Creating a build system....524

Adding more platforms....527

Expanding Dragoncraft....531

Adding music and sound effects....531

Adding more content....533

Summary....535

Further reading....535

Index....536

Other Books You May Enjoy....544

Building a successful real-time strategy game is challenging, because of both the complex mechanics and the need to strike a balance between different elements, ensuring that players enjoy creating and executing strategies against the game's AI.

Creating an RTS Game in Unity 2023 will teach you how to install and set up the Unity game engine, create a new 3D project, and build a level editor to make it easier to modify and add maps to a game. The RTS game will start to take shape while you learn to implement different core systems such as melee and ranged battles, unit spawners, camera controls, dynamic mapping generation, basic enemy AI, and the pathfinder algorithm. You'll also get to grips with implementing command units to perform actions, crafting and producing resources, basic physics and collision detection, and building an RTS game from scratch using C# and the latest features of the Unity game engine.

By the end of this book, you'll be able to make professional and high-quality end-to-end RTS games using the best practices and techniques from the gaming industry.

What you will learn

  • Incorporate the most used design patterns, algorithms, and techniques into your game
  • Employ the best coding practices used in the games industry
  • Explore the basics of AI and physics to create high-quality games
  • Build dynamic and configurable maps to enhance the player experience
  • Solve complex problems using the industry standards for Unity and C#
  • Create the mechanics present in classic RTS games using a modern approach
  • Gain a deep understanding of how to create professional games using Unity

Who this book is for

If you are a beginner game developer who wants to learn the skills to develop a professional RTS game, a programmer looking at career options in the industry who needs to develop a portfolio, or even an indie game developer seeking inspiration for your own games, this book is for you. Professional game developers, programmers with experience in C#, as well as game designers and artists looking for a practical guide to bring their game ideas to life will also find plenty of useful information in this book.


Похожее:

Список отзывов:

Нет отзывов к книге.