Game Development Community

Turn based a.i system

by Robert Russell · in Torque Game Engine · 05/28/2004 (10:05 am) · 4 replies

Hi how would I go about using the TGE to make a turn based system like for chess or something, any help or a point to resource would be great thanks.
-Rob

#1
06/02/2004 (1:14 pm)
Hi Robert,

I can't help you in much detail, so maybe you'll get a better response from someone else. But I did want to chime in and say that I know a few people ar working on things like this. Ben Garney may have some interesting things to say, if he catches this thread.
#2
06/02/2004 (2:54 pm)
I was working on the same thing last week and thort this way would be ok?
It works fine so far but i have not tested it much yet.

function startGame()
{
$activeClientIndex = 0;
$activeClientId = 0;  
$Game::HexSchedule = schedule(7000, 0, "nextTurn");
}


function nextTurn()
{
error("function nextTurn() activated");

%totalclients = ClientGroup.getCount();
echo("%totalclients = "@%totalclients);

$activeClientIndex = $activeClientIndex++;
if($activeClientIndex >= %totalclients)
  $activeClientIndex = 0;
$activeClientId = ClientGroup.getObject( $activeClientIndex );

echo("$activeClientIndex = "@$activeClientIndex);
echo("$activeClientId = "@$activeClientId);
$Game::HexSchedule = schedule(9000, 0, "nextTurn");
}
#3
06/02/2004 (3:07 pm)
Looks like a start, Brian.

@Robert: I see no reason why it shouldn't be possible. Since the scripting lets you give (or take) control from an object, you should be able to selectively allow a player to control one object and then take it away.

Determining the "take away" part might be a problem, though. If you use a totally isolated system, like where the player just selects a waypoint on where to move, and what to fight, that might be not so bad. (But would definately require engines changes, to get some kind of 3D selector working.) Either that, or limit how far they can move or how many attacks they can do in a single "turn".

One thing to keep in mind though is dropped clients. Don't let the game get hung up waiting for a non-existant player to take their turn...
#4
06/03/2004 (10:01 am)
Thanks for the positive responces, this is why TGE and the Garagegames community is so great.
-Rob