Instructions to setup a game with one NPC.

  1. cp -r tutorial.base gameBots
  2. Set up paths:
    1. in gameBots/main.cs, change tutorial.base to gameBots
    2. in the top level Torque main.cs, change defaultGame to "gameBots"
  3. in the server directory, cp botRandomOne.cs to bot.cs
  4. add exec("./bot.cs"); to server/game.cs
  5. replace onMisssionLoaded and onMissionEnded in server/game.cs with the code:

    function onMissionLoaded()
    {
    // Called by loadMission() once the mission is finished loading.

    new ScriptObject(AIManager){};
    MissionCleanup.add(AIManager);
    AIManager.think();
    }

    function onMissionEnded()
    {
    // Called by endMission(), right before the mission is destroyed
    AIManager.delete() ;
    }

Next Steps

Now make multiple bots. The botRandomMany.cs file spawns off multiple bots.

Next get a bot to follow a predefined path. The botAlongPath.cs file assumes you create a path using the Torque editor GUI. The tutorial linked to above explains the GUI usage steps very well.

Finally, add terrain and collision detection between your player and the bots.