Torque 2D/GenreTutorials/StrategyOverview

From TDN

Image:Alert.png This article or section needs updating.

Parts of this article or section have been identified as out of date.
While the information may be useful, be advised that it may be inaccurate, buggy or erroneous.

Reason: This tutorial was written for a previous version of TGB and certain steps of may no longer work or are done differently in the current version of TGB. As such it is not recommended for beginner TGB users. For a list of current tutorials, please click here.

If you are able to revise this information, please do so and remove this 'update' flag when finished.

Contents

Overview, Planning, and Design


Introduction



Real Time Strategy (RTS)

An RTS game is fairly self-explanatory, it's a real-time strategy. The premise of RTS games are usually based around combat and/or conquest that is acheived by giving orders to one or more units. RTS games are generally in either a top-down view or a simulated isometric view (at an angle). Often the game is completely run by the use of the mouse, the keyboard usually reserved almost exclusively for shortcuts, formations, quick commands and menus.

This tutorial set will step you through creating an RTS game in Torque Game Builder. As you have probably already figured out, there is quite a bit to even the simplest RTS game. Keeping the potential complexity in mind, we will only be going over the basics in creating a fairly trimmed down RTS game. Further tutorials will explain how to accomplish some of the more advanced operations done in an RTS.





Overview



What will we go over?



The following will be covered in this tutorial set:

  • Overview, Planning, and Design (the current document)
    • Overview what will be covered in this tutorial set
    • Plan out the technical aspects of the game
    • Create a quick game design
  • Creating The World (utilizing Tile Maps)
    • Cover the basics of working with the Tile Editor
    • Creating a multi-layered Tile Map
    • Bring the Tile Map into Torque Game Builder to start as our game world
  • Mouse Selections and Selecting Objects
    • Create a system to select T2D object
    • Configure this system for our RTS games
    • Create a dialog that changes upon selecting units
  • Setting up a Unit Creation System and Moving New Units
    • We will establish an easy system to "spawn" a "unit" at a specified location
    • Add a variable delay to make it a creation process and create a "base" that can be used to create such units
    • Implement a basic click and move system
  • Creating Scripted Actions/Behaviors
    • Develop some actions and behaviors needed, breaking them down into individual steps
    • Scripting state handlers for these actions and behavors
    • Getting them to work ( important step I guess :D )
  • Creating a Basic GUI and Triggering it on Selection
    • Triggering an action upon selection
    • Create a basic properties GUI
    • Display correct properties upon selection
  • Setting up the Camera System to Scroll with The Mouse
    • Recognize when the mouse gets to the edge of the window
    • Create a proper window scrolling effect
  • Setting Conditions for Winning and Losing
    • Define what will decide the winning condition and implement it
    • Implement a Winning and Losing Screen
  • Creating a Basic Interface GUI
    • Create a main menu GUI
    • Create and implement an in-game GUI
    • Implement "winning" and "losing" GUIs and full cycling to complete the RTS game demo



What will we have when finished?



Our goal will be to have the following:

  • Complete, though basic, RTS game in Torque Game Builder
    • Full multi-layered Tile Map based world
    • World that scrolls when mouse reaches edge of world
    • An interactive unit creation system with a progress bar
    • "Bases" that units can be created at, one for each team
    • A behavior/action system built around an AI state machine
    • Unit selection with ablility to give commands
    • Winning and losing conditions that fully cycle and complete the game
    • Full basic GUI, including:
      • Main Menu GUI
      • In-Game GUI
      • Winning and Losing GUIs
      • Credits GUI
  • Have a good understanding in the following concepts in Torque Game Builder and Game Development
    • Game Planning and Design
      • How to scale down a game concept
      • Taking that "concept" and building a quick plan for it
        • Forming a list of what tasks/systems need to be created (personally I always do some form of this now, that way when I've scripted one goal I don't have to try and re-visualize the entire project to get cranking away on the next step)
        • Create some initial Data Structure concepts and outlines of what we will need to implement and some ways to organize it (this can be a -huge- problem later, especially with data heavy games like RTS and RPG games, so best to look at this now and be prepared)
      • Creating a basic Game Design (this is a quick and dirty evaluation of gameplay aspects)
        • Create a general theme/premise for the game (usually at least some sort of correlation/consistency to a central theme is a good idea :)
        • Develop some units and a small way they can be unique (in this case the keyword is small so we can focus more on getting this done vs. making this in-depth)
        • Do some basic level design so we know what we're going for with the gameplay and can go into the level creation aspects much quicker
    • Torque Game Builder Development/Scripting (getting things done)
      • Images
        • How to load "Static Sprites"
        • how to load "Animated Sprites"
        • Basics of the Scene Object Editor (awesome editor done by Justin)
        • Placing these in the world through the script
      • Events and Callbacks
        • Develop a good understanding of how event driven Torque Game Builder is
        • Understand what a callback is and where to go from there
        • Utilizing Torque Game Builder's event/callback system into our game systems
      • GUIs in Torque Game Builder
        • Learn the basics of the Torque GUI editor
        • Scripting basic interaction with the Torque GUI system and Torque Game Builder
        • Creating dynamic GUIs
      • Torque Game Builder commands and utility funcitons
        • Understand and use a good deal of Torque Game Builder commands
        • Use some Torque Game Builder utility functions that we might not already know about or have not used
        • Create some utility functions of our own (generally a good scripting technique)
      • Packing up our basic RTS game
        • Learn what we need to remove and how
        • How to package up our game with what files we need





Planning and Design



Scaling down our game concept to a quick and dirty Game Design:



At first glance this process may seem unneeded, though often it is essential to evaluate this (especially in developing something like we are going to, a quick and dirty Torque Game Builder RTS game). Real Time Strategy games can get quite complex and demanding, many require large ammounts of data utilization as well as a large ammount of "entities" on screen being controlled and manuevered. Due to this level of complexity we are going to scale this approach down quite a bit. Right now we just want to get the very basics into the game to learn the process and implementation of such a game genre. From there we can build a fully complex RTS game down the road.

In this case I'm going to limit what aspects this RTS game can have... to accomplish this I'm going to list the major gameplay aspects that we will develop and accomplish by the end of this tutorial set (in no particular order).

  • Two teams, a base for each team
  • New units can be created from the base with a progress bar and a point spawned to
  • Two unit types (one soldier one worker)
  • Gold mining to earn money to purchase unit production
  • Upgrading of units from the main base
  • Units can combat other units as well as enemy bases
  • Multiple Selections
  • A very basic AI with states that is easy to build upon
  • Destroy the enemy base to win
  • Full GUIs



Ok so now we know what we are going to do. Its good to scale down all the possible ways to go with a project to just the base core of what you need to accomplish, often when you start implementing renegade features it can kill the progress on your game (this is often called "feature creep"). Now we can create a task list to accomplish the above list of game play aspects.

Creating our Task List:



We have a basic plan and design (nothing fancy needed for what we're doing, just best not to go in blind) so now lets create a task list. From what we have in the overview and planning sections we already have most of our tasks though this list is a bit different than what we've already listed. In this case I've already given you somewhat of a task list since this tutorial set is designed around that, though normally you will have to work this up from a basic planning and design standpoint. The difference of what we are about to create and what we've already listed is that the task list is a much more technical list. Each step in this list is not an idea in our process or an accomplishment we want to set as a goal, rather its a step that we need to get done. I find this helps me immensely, though we all have our own preferences. With this list we will have a basic breakdown of what we need to get done... for example the world tile map, player movement, combat, etc. The biggest value I gain from this is when I finish something and then am thinking about what next to do, now if we don't have a task list we have to re-visualize the entire (or most) of our project/game and then figure out what the next step is. With a task list we can simply check something off and move on to the next step. Now this isn't meant as a list to be followed with no exception, quite the opposite in fact, its simply there to be a quick and easy reference of what we need to get done so we don't have to re-figure the whole game each step. So here is our task list, in this case its the same as this tutorial set outline :)

Task List:



Ok now that we have a basic plan, design, and task list we are ready to get started...

Image:BlockoutLeftA.gif Image:BlockoutRightA.gif
Game Plans and Designs


Game plans and designs are relative to each project. I've found most projects don't need a large plan and design to get started. Better to get a quick and dirty prototype out as quick as possible to test gameplay and find out how fun the game really is and then go from there, though some planing and design is always a good idea.

Image:BlockoutLeftB.gif Image:BlockoutRightB.gif