Flight Game Example - Q & A
by Martin Schultz · in Torque Game Engine · 06/21/2007 (7:13 am) · 43 replies
This is the official questions and answers thread for the Flight Game Example. Please post here questions.
#22
Here is a screenshot:
09/13/2007 (12:58 am)
Torque 1.5.2/ FGE/ and a lot of resources added in thus far:Here is a screenshot:
#23
09/13/2007 (12:33 pm)
Great you got the fix applied and all working. Screenie looks great! :-)
#24
09/22/2007 (3:56 am)
Thanks I must have overlooked that. I just integrated AFX (the hard way), and added sql support to the game. Game is slowly making process. Working of the multiplayer selection model process now. Will post another game screen very soon...
#25
09/22/2007 (7:26 am)
Great! Happily awaiting the next screenies! :-)
#26
Had our first Lan the other night... :)
09/25/2007 (12:02 pm)
I'll be releasing details on my game shortly too. Man, this sped (past for speed?) up alot of things for my game dev too. Had our first Lan the other night... :)
#27
09/25/2007 (12:52 pm)
Hehe, cool! Wanna see screeeeeenshots!!!!! :-)
#28
Here is another screenshot:

and one of the mission-select screen:
09/27/2007 (4:26 pm)
Multiplayer still doesn't work. Basic SQL is now in-game. Rewrote TeamDeathmatch to allow for selection of Allied and Enemy Bots.Here is another screenshot:

and one of the mission-select screen:
#29
Transaction ID: 1S515228RK561523L
Item Price: $30.00 USD
Total: $30.00 USD
Order Description: Flight Game Example for TGE(A)
Buyer: Johnny Hill
Got a few ship mods to try :)
11/11/2007 (1:05 am)
I used Paypal option Transaction ID: 1S515228RK561523L
Item Price: $30.00 USD
Total: $30.00 USD
Order Description: Flight Game Example for TGE(A)
Buyer: Johnny Hill
Got a few ship mods to try :)
#30
11/11/2007 (3:15 pm)
@Johnny: Will process your order immediately now. I was 2 days out of town and completely offline. Mail coming in a minute...
#31
Thanks for the quick service Martin!! Here is a link of what I was talking about.Carrier Command
11/12/2007 (3:32 am)
Np :) Thks! Out of town at the moment myself :))Thanks for the quick service Martin!! Here is a link of what I was talking about.Carrier Command
#32
1- nice work on the tracking and general behavior schema, but I'll note a bit of a gain from shifting the bots from a per-bot think schedule to a bot manager schedule, ie:
ship_ai.cs:
(self-preservation, and goalswitch being references to the prior scripted chunks broken down into functions. call that a personal design choice)
(can probably cut that down even further later, but theres the initial findings)
That got about 5 extra bots, bringing it up to 15.
additionally, the two processticks:
Already wich also holds a check to ensure that youre only calculating the moves on the server as well. That brought it on up to a stable 20-25.
Any other notions kicking arround for getting all 40 up and working, before I turn to pruning down the inheritance tree a bit?
edit: oops, forgot a func.
12/16/2007 (2:35 am)
Couple notes from trying to get all 40 bots up in the air and moving at once:1- nice work on the tracking and general behavior schema, but I'll note a bit of a gain from shifting the bots from a per-bot think schedule to a bot manager schedule, ie:
ship_ai.cs:
$ThinkFrequency = 500; //cycle through all bots 1/2 a second at a time
$AIindex = 0; //how many bots are there?
$AICycle = 0; //wich one are we looking at this cycle?
function createAIBot()
{
%ai = aiConnect(getBotName());
%ai.thinkingAllowed = true;
%ai.index = $AIindex;
$AIindex++;
return %ai; // return the new client id
}
function thinkcycle()
{
$AICycle++;
if ($AICycle > $Pref::Server::BotPlayers)
{
$AICycle = 0;
}
// Inform the client we're starting up
for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ )
{
%cl = ClientGroup.getObject( %clientIndex );
if (%cl.isAIControlled())
if (%cl.index == $AICycle)
{
if (! isObject(%cl.player))
{
// wow - we're dead somehow and should init ourself
$AIindex--;
%cl.aiSetThinkState($AIGLOBAL_IDLE);
}
//error(%this SPC "is thinking");
%cl.selfpreservation(%cl);
%cl.goalswitch(%cl);
}
}
schedule($ThinkFrequency, 0, "thinkcycle");
}(self-preservation, and goalswitch being references to the prior scripted chunks broken down into functions. call that a personal design choice)
(can probably cut that down even further later, but theres the initial findings)
That got about 5 extra bots, bringing it up to 15.
additionally, the two processticks:
void AIFlyingVehicle::processTick(const Move* move)
{
//Move aiMove; //already handled by parent!
//if (!move && getAIMove(&aiMove))
//{
//move = &aiMove;
//}
Parent::processTick(move);
}For two reasons: 1, it cuts down on assigning the move twice, two, the vehicle::processtick (least for tgea 1.03) contains:Move aiMove(NullMove);
if(isServerObject() && getAIMove(&aiMove))
move = &aiMove;Already wich also holds a check to ensure that youre only calculating the moves on the server as well. That brought it on up to a stable 20-25.
Any other notions kicking arround for getting all 40 up and working, before I turn to pruning down the inheritance tree a bit?
edit: oops, forgot a func.
#33
The reason why I took the "every-bot-uses-it's-own-timed-brain" was because I wanted to avoid having every half second or so having one "batch" job running through all the bots because depending on the complexity of calculations done then each batch you might notice a slight framedrop every half second which "pulses" your framerate a bit. This is not the case when the think methods are not called all at once, but spread all over time. But it is mainly a design thing, some like it this way, some that. Both are valid and fine.
12/17/2007 (2:43 pm)
Cool, good work! In general TGEA is handling large amounts of bots way better than TGE through its batch rendering capabilities. Brian Ramage and Ben G. did a good job there.The reason why I took the "every-bot-uses-it's-own-timed-brain" was because I wanted to avoid having every half second or so having one "batch" job running through all the bots because depending on the complexity of calculations done then each batch you might notice a slight framedrop every half second which "pulses" your framerate a bit. This is not the case when the think methods are not called all at once, but spread all over time. But it is mainly a design thing, some like it this way, some that. Both are valid and fine.
#34
When you've got each one cycling on it's own like that, eventually you'll run into a situation where they destroy each other. at wich point they both respawn at the same time, and the cycles then sync back up.
The posted code represents a (verry wip) loop that checks the total number of bots and cycles through em one at a time once every half-second and tells them "ok, it's your turn to make a decision" so that that case never occurs. It's one of those really old concepts they keep changing the name for, unfortunately... when I learned it it was called serialization. Dunno what the newfangled term is when it's aplied specificly to artificial intellegence though. Ideally, what that would expand to would be a check for cpu load that would notice that adjusts how much time between cycles the bots think.
12/17/2007 (11:19 pm)
Ah. Aparently I wasn't quite clear enough in the explaination there. Apologies.When you've got each one cycling on it's own like that, eventually you'll run into a situation where they destroy each other. at wich point they both respawn at the same time, and the cycles then sync back up.
The posted code represents a (verry wip) loop that checks the total number of bots and cycles through em one at a time once every half-second and tells them "ok, it's your turn to make a decision" so that that case never occurs. It's one of those really old concepts they keep changing the name for, unfortunately... when I learned it it was called serialization. Dunno what the newfangled term is when it's aplied specificly to artificial intellegence though. Ideally, what that would expand to would be a check for cpu load that would notice that adjusts how much time between cycles the bots think.
#35
Now I want to take the repairship and add weapons to it. Would the aiRepairship class allow this or is it a major rewrite? (I want the Repairship to repair allied ships and fight against enemy ships). Currently, I am adding the Repairships per the FGE, do I have to add them like a bot?
01/21/2008 (4:01 am)
I just got 48 bots (fighters) in the air (space?) at one time and 6 repairships (capships). No LODs, lots of FPS lag, but no crash.Now I want to take the repairship and add weapons to it. Would the aiRepairship class allow this or is it a major rewrite? (I want the Repairship to repair allied ships and fight against enemy ships). Currently, I am adding the Repairships per the FGE, do I have to add them like a bot?
#36
To answer your question: Yes, aiRepairship is not hindering you from adding weapons, so no problem there. Technically there is not much difference between the aiFlyingVehicle and the aiRepairship flying vehicle class. Mainly it's the trigger for the repairship that gets synchronized with the ship, so you could even merge both together in one file technically (the trigger is then simply not used if you use a scout ship).
So basically you could do the same with weapons for the repairship as with the scouts, it's just a matter of scripting I would guess.
01/21/2008 (9:39 am)
Just out of interest: Might you post a screenie here with the 48 bots? Must look awesome.To answer your question: Yes, aiRepairship is not hindering you from adding weapons, so no problem there. Technically there is not much difference between the aiFlyingVehicle and the aiRepairship flying vehicle class. Mainly it's the trigger for the repairship that gets synchronized with the ship, so you could even merge both together in one file technically (the trigger is then simply not used if you use a scout ship).
So basically you could do the same with weapons for the repairship as with the scouts, it's just a matter of scripting I would guess.
#37
01/28/2008 (6:42 am)
I added the trigger to aiFlyingShip. Works good after changing how/ when the "Repairship" is spawned. Changed the script (a repairship should not seek another repairship). Note to self: add turrents - as the capships are big, slow, lumbering targets that only fire straight ahead. Fixed naming so that each fleet has its own set of player names and ship names. Only thing to merge back is the repairship paths.
#38
Added the following since the last update:
A working (and auto-updating <--- REAL HARD) navigation display that shows the player ship's position, heading and pitch.
To get this to work with GUI panels was a pain so I pretty much had to create my own which merges the updating of shapebase and with GUIPanels. Now since that is done, I can add jumpgates and release this as an Alpha 0.1 relese soon.

Multiple weapons now work. Cleaned up the GUI and started to add the Commander Map.
Here is another image. Working now on Weapons Arcs.
02/04/2008 (3:22 pm)
There are 48 Bots (fighters), 4 capShips, and 1 base in this screenshot.Added the following since the last update:
A working (and auto-updating <--- REAL HARD) navigation display that shows the player ship's position, heading and pitch.
To get this to work with GUI panels was a pain so I pretty much had to create my own which merges the updating of shapebase and with GUIPanels. Now since that is done, I can add jumpgates and release this as an Alpha 0.1 relese soon.

Multiple weapons now work. Cleaned up the GUI and started to add the Commander Map.
Here is another image. Working now on Weapons Arcs.
#39
1)However i cant seem to get the Hull and Afterburner bars in the playgui to start up properly..
2) And when i try to fire the Sidewinder It gives me a error..
starter.fighter/server/scripts/weapon_sidewinder.cs (500): Unknown command setNewTarget.
Object (7590) Projectile -> GameBase -> SceneObject -> NetObject -> SimObject
Note Weapon does fire, its just not seeking.
3)I have tried to add the reticle targeting as well, but it doesnt seem to want to target the AI.
Martin, i cant find my email with the FGE download page with my password, if you could possible re-email this to me... racs333@hotmail.com
12/31/2008 (7:04 pm)
Problem fixed. there was 2 user errors, and one missing piece of information, the guihealthhud needs to be updated with the new vehicle mask, the 2nd and 3rd error were resolved with a quick minmerge from another person who successfully got it working.1)However i cant seem to get the Hull and Afterburner bars in the playgui to start up properly..
2) And when i try to fire the Sidewinder It gives me a error..
starter.fighter/server/scripts/weapon_sidewinder.cs (500): Unknown command setNewTarget.
Object (7590) Projectile -> GameBase -> SceneObject -> NetObject -> SimObject
Note Weapon does fire, its just not seeking.
3)I have tried to add the reticle targeting as well, but it doesnt seem to want to target the AI.
Martin, i cant find my email with the FGE download page with my password, if you could possible re-email this to me... racs333@hotmail.com
#40
04/25/2009 (10:30 pm)
Has anyone been having a problem with the the FGE on Vista? The code base I am using is from the FGE TGEA 1.0.1 download. The game locks up after a 4-5 minutes of game time. I tried runing it as administrator, and also set the capatibility to XP SP2, but it still occurs. Nothing in the console log shows the issue.
Torque Owner Martin Schultz
Regarding your camera question: The FGE ship already has 2 different camera positions - one inside the ship (or better on the front of the ship) and a second one for 3rd person. You could just simply move the first person cam node inside your cockpit and voila - done.
@Carlos: In the C++ resource that belongs to the FGE there is a fix for the integer zero division bug. Have you seen that one? That fixed the problem for me.