Game Development Community

AI Flying Vehicle Classes for TGE(A)

by Martin Schultz · 06/20/2007 (8:42 am) · 33 comments

Download Code File

The included files have been developed for the Flight Game Example and add AI flying vehicle support to TGE(A). The attached file contains 2 classes, one for a fighter game type of space ship and one class for a mothership kind of space ship that has in difference support for an attached trigger which transform is synchronized with the space ship so that you could add a healing to any ship following the mothership or re-arm it for example.

The directory structure contains TGE and TGEA class files. Although their are identical from their contents, only the file suffix is different (.cc for TGE and .cpp for TGEA). Please add those files to your engine/game directory and recompile the engine with a clean build. Once the new binaries have compiled, you can create instances of the AI ships like this:

%player = new [b]aiFlyingVehicle[/b]()
{
	dataBlock = ScoutShip;
	client = %this;
};

or like this for a repairship type:

%player = new [b]AIRepairshipFlyingVehicle[/b]()
{
	dataBlock = AiRepairShip;
};

If you have any questions, don't hesitate to ask. Hope you find this useful and have fun with it!
Page «Previous 1 2
#1
06/25/2007 (6:50 pm)
Just bought this and REALLY GOOD JOB, kind of addictive game play very nice!
#2
07/02/2007 (11:52 am)
Hey Martin.

My ships dont want to move, for some reason my ships does not want to move. I'm tried stepping through my code, but i cant seem to nail the problem. Any ideas? I'm on MSN as always.
EDIT: Looking through code... Gonna see what setMovespeed does for me, but the setAimObject also doesn't make my ships turn.

Then my second question. Does the AIConnect functon differ from TGEA and TGE? I'm getting strange Characters when I use %player.setShapeName(%this.name);. The %this.name is the culprit. I've checked the getBotName() and it returns Names, but the above mentioned, is giving me troubles

Hmmm... Should I move my second question, since its a bit off topic?
#3
07/03/2007 (4:50 am)
Heya Burning,

regarding that the ships don't move: I'm pretty sure you're using TGEA, right? If so, please check the "docs" folder of the zip file attached to this resource. It contains a complete documentation which source code changes need to be applied to get the ship moving. In TGEA the getAIMove call is ripped out for whatever reason compared to TGE, so you need to re-insert that call again and some other small changes. I'm pretty sure you'll quickly see it in the docs. If not, please don' hesitate and ask again.
(I'm mostly offline this week due to holidays)

Regarding your second question: Can you give me some example? What does your %this.name contain?
#4
07/07/2007 (3:04 am)
This looks to be interesting, I hope I get around to using/testing this resource.

Rated at 4 to flag the page... will change after I try this.
#5
07/16/2007 (6:47 am)
Aaah... Cool Martin... Thanx!

Uuumm... I'll give you screenshots about the names when I see you again on MSN.
#6
07/16/2007 (7:00 am)
Will be online later tonight on MSN :-)
#7
07/26/2007 (11:12 am)
What I am wanting to do is have a smaller flying vehicle following a larger flying vehicle, basically a ship with pet. Looking at this resource, specifically the AIRepairshipFlyingVehicle, it looks as though I am easily able to do this. But is the AIRepairshipFlyingVehicle the smaller or larger ship? And then what is the other ship? Thanks a lot...love the resource.
#8
07/26/2007 (11:38 am)
You only need the AIFlyingVehicle class then. The repairship is some special variant of the aiFlyingVehicle class where you can apply in script a trigger object to the class and the trigger will be sync'ed in its transform with the ship. Honestly I think today it could even be one class because the differences are small - will do that one day.

Anyway, back to your question. Letting one ship follow the other is quite simple. In ship B you need to call "setMoveObject(ship A);" and ship B will automatically follow ship A.
#9
07/26/2007 (1:08 pm)
I added the SetMoveObject functionality in the AiFlyingVehicle::getAIMove, so it looks like:
if (mAimObject)
	{
		...
	}
	
	if(mMoveObject)
	{
		mMoveObject->getWorldBox().getCenter(&mMoveDestination);	
		mMoveState = ModeMove;
	}
And I added %slave.setMoveObject(%master) in the script. However, the slave ship flies around franticly, running into terrain and whatever else is in the world. Do you have any further suggestions on how to accomplish an FlyingVehicle ship? Thanks again.
#10
07/26/2007 (1:26 pm)
This set moveObject was already there and called setAimObject (not setMoveObject what I accidentially thought).

Regarding the stumbling flying vehicle: Well, yes, that is an unbalanced datablock. I highly recommand to buy my Flight Game Example which includes working datablocks. ;-)
#11
08/23/2007 (8:54 am)
I've made some changes to the AIFlyingvehicle class (and the FGE ai), which makes the AI a little better. Small changes, although I think trivial to better AI. Have some other small things I would like to add. Will add and testing it, and will share as soon as I'm happy. Dont expect much though :)

Even though this class (AIFlyingVehicle) is free, it's pretty hard to use without the scripts you get with FGE.
#12
08/23/2007 (12:13 pm)
James, I could make your changes available on the FGE owner's page, if you like.
#13
08/24/2007 (7:33 am)
Yeah sure, you can add it to the next version :) Busy with creating a simple escape state for AI.
#14
08/28/2007 (11:36 pm)
This Ressource dont work vor me. I can create Bots, but if i try to aim/move, the Bot rotate/jitter about one sec and then the game stops/crashes.
#15
08/29/2007 (12:08 am)
Alex: This happens usually because of unbalanced datablocks of your flying vehicle. That's what the other part of this resource is about, the Flight Game Example. It has examples of working datablocks for this resource. Might want to try the FGE? :-)

edit: typo
#16
09/20/2007 (7:50 am)
Apparently there was some major flaws in my "bug fixes"... hehe... I guess sometimes you get that. So now I only have the AI using the Boost when their Target is greater than a certain distance.

Has anyone tried to improve the aim of the AI? It shouldn't be hard for Vector-capable individuals.

Having a look at the aiTurret now by Paul Dana.
#17
11/01/2008 (8:32 am)
Anyone get this working with 1.71?
#18
01/31/2009 (12:28 pm)
any updates for TGEA 1.7.1/ TGEA 1.8?
#19
01/31/2009 (1:04 pm)
No, no plans yet to update it.
#20
02/01/2009 (3:10 pm)
got it kinda working - except for the VMPlayer. I am going to use it possibly for start of a NHTV IGAD Gamelab 2 project.

igad.nhtv.nl/made
Page «Previous 1 2