Game Development Community

Hardpoints

by Bryce · in General Discussion · 09/20/2006 (4:55 pm) · 10 replies

Hello, as some of you know im working on a flight sim. Im wondering how to mount missiles on hardpoints outside the aircraft, and when the player chooses to fire one, it randomly chooses a hardpoint and fires the missile there? Is this possible?

#1
09/20/2006 (7:52 pm)
Absolutely. Make the DTS file that draws your plane have nodes called "mount0," "mount1" etc for the places where you want to mount the missiles. Then use the mountXxx() series of functions on your object (i e, "mountImage()") to attach the missiles.

When you get the fire key, you probably want to remove the missile from the plane, and instead spawn an AIPlayer that controls the missile (or some other kind of vehicle, that can propel itself).
#2
09/21/2006 (2:24 am)
AIPlayer? Just spawn a projectile that updates its position, if you want a missile. AIPlayer is heavy and Vehicles are even worse, that's as overkill as you can get for a simple function like this. :)
#3
09/21/2006 (7:01 am)
So how do i get the missile to fire from that hardpoint? youre just telling me how to dismount missiles off the wings
#4
09/21/2006 (9:54 am)
Quote:Just spawn a projectile that updates its position, if you want a missile.

Missiles are typically goal seeking, thus they use AI, thus I would probably use AIPlayer. Your mileage may vary.

Quote:So how do i get the missile to fire from that hardpoint? youre just telling me how to dismount missiles off the wings

Detect that the user pressed the "fire" button (use a key binding); send a message to the server to create the simulated object.

Or look at the way that the crossbow works in the starter.fps, and copy that, if your missiles are dumb rockets (no goal seeking).
#5
09/21/2006 (10:08 am)
Here's a resource for guided or seeking projectiles. I agree with Stefan that using AIPlayer would be massive overkill for that.
#6
09/21/2006 (5:54 pm)
When the player presses fire it will fire from muzzlePoint. I need it to fire from the hardpoint
#7
09/21/2006 (9:42 pm)
Three solutions:
1) Actually use AIPlayer. I bet you it'll work fine, for the number of missiles and planes you'll have in a modern jet dogfight! When spawning the AIPlayer, you have your choice of position.
2) Move the muzzle point, using an animation. Select animation based on which missile is firing.
3) Hack the C++ code to support overriding the "fire" location.
#8
09/22/2006 (3:09 am)
Hplus,

Quote:
1) Actually use AIPlayer. I bet you it'll work fine, for the number of missiles and planes you'll have in a modern jet dogfight! When spawning the AIPlayer, you have your choice of position.

Hehehe. You have the choice of position on most objects you can instantiate. Projectiles are not an exception. AIPlayer is based on Player, which is based on ShapeBase. ShapeBase is heavy as it is, and then you add Player ontop which is even heavier. Updating the position on a object is hardly AI. =)

Based on your comment about position and your choice of AIPlayer as a projectile, I suggest you should read up on how this stuff works on TDN - or better yet, make some tests and profile your results with AIPlayers as projectiles and you will soon find out why it's a terribly bad idea and why no game uses it.

Projectile is based on GameBase which is as light as you can get while keeping networking and ticking features. Projectile is also optimized for what it does, unlike AIPlayer which is made for - AI. :p
#9
09/22/2006 (2:24 pm)
Muzzlepoint anim....clever
#10
09/22/2006 (6:15 pm)
@stefan: sure, that sounds more efficient.

I refuse to believe that three AIPlayer entities would make any game not perform, though.