Game Development Community

Do I need a new class for this?

by Mike "wowo" Miller · in Torque Game Engine · 01/15/2003 (12:25 pm) · 4 replies

Hi,

I'm trying ;) to make a game, which is a flying/space game where the player controls a heavily modified FlyingVehicle object rather than the default player object.

So far I have the vehicle physics set up the way I need them, and am moving on to getting some baddies into the game. Here lies my question:
In order to create a computer controlled enemy, what do I need to do? I'd like for it to be a flying object that waits, stationary, in a certain spot, and upon seeing the player it will attack and follow the player, if the player happens to flee. I'm talking very simply AI here.

So, can this be done using the existing AI class even though i'm not going to be using the default player as the enemy? Or should I create a new class derived from ShapeBase and start from scratch?

Note: The enemy doesn't have to be animated.

If i need to create a new class derived from ShapeBase, does anyone have any pointers as to how I'd go about doing this?? It seems like such a daunting task when I look at the guts of the player class....

Thanks, and sorry about this long-winded post :P

[edit] typo [/edit]

Mike

#1
01/15/2003 (12:41 pm)
I can't think of a reason why the existing AI wouldn't be able to do that (IIRC, that's about ALL it does... :) )
#2
01/15/2003 (1:21 pm)
So can the AIPlayer class be used with any ShapeBase or ShapeBase derived class? I ask this because the AIPlayer class is defined as:
class AIPlayer : public Player

So even though the AIPlayer class is derived from the Player class, can I use it with a normal ShapeBase class?

Sorry, i've only been using the engine for about a week and a half now, i'm still learning :)

Thanks,
Mike
#3
01/15/2003 (1:51 pm)
I'm trying to do this too. I am trying to make floating asteroids. So far I have only been able to get them to work by making my Asteroid datablock of type PlayerData then creating them like normal AI except im not giving them instructions to move. Instead I am giving them a random impulse. The problem seems to be that my ship and crossbowprojectiles do not collide with the asteroids. The ship and projectiles fly through the asteroid and seldom if ever cause an onCollision. I confirmed that the models have the appropriate collision boxes and when I add a asteroid as a static shape my ship and projectiles hit it and impact and collide as they should.
#4
01/15/2003 (8:03 pm)
I *think*, that using big player class shapes makes the collision test go foobar... not sure... but someone said something similar the other day on IRC