Jump to content

[SOLVED] Rail Shooter Sample


photo

Recommended Posts

Posted

Hi everyone, Before I try to reinvent the wheel I thought I'd ask for advice or perhaps there is already a sample of this somewhere. I would like to set up a control system very similar to Star Fox. The camera is fixed, with perhaps a few degrees of movement. The player would control the actor with their mouse. The actor would always be oriented forward and would move at a constant speed. I know this is a pretty open ended question but any design recommendations would be appreciated.

Posted

UNIGINE provides shooter sample project. Maybe this can serve as blueprint. There ate also multiple player samples showing different possibilities for player control.

Posted

In my experience I have prototyped a game to that exact specification in XNA!

 

First off you mention both player and actor in the same sentence. I have the feeling your looking at the PlayerActor class. Not the object you want for this project as it essentially a camera with an attached capsule based ridgid body with default control scheme designed for character based movements. You simply want to use a Player object for the camera and control its transforms through script by some rail path. Assuming you want a spaceship of some kind, you can attach an object (with a collision body shaped similar to the ship model) to the player node and then all transforms of that ship will be relative to the cameras position. You can then just offset the position of the ship to the camera by changing the local transform of the ship object. BUT this is not necessarily a good design. If your rail is anything other than a straight line then when your rail goes round curves your ship will move faster or slower forward depending on its offset to the centre of the rail. For this reason the exact speed your camera moves down the rail may need to be altered by the curvature of the rail and the current offset position of the ship to effectivly simulate a constant speed!

 

"The actor would always be oriented forward" - I would reconsider this statement. If you play starfox you will see that this is not true. When you move left and right, the ship will slightly orientate itself in the direction. If you don't want it to look flat I suggest you follow suit (unless your not creating a flight sim?). This further brings us onto mouse input. Mouse input is not a directional value like a say a d-pad is. It is a change in position that has magnitude. You obviously don't want to drag your mouse around the screen and have the ship zip about following the mouse cursor exactly. But this ties in nicely to the orientation of the ship, as this change in mouse position can be used to interpolate a velocity in the direction you want your ship to move *as well as* interpolating the orientation of the ship. But there is a fine balance between mouse movements being too responive or unresponsive. But the key here is to have nice smooth interpolated movements that are based on your mouse gesture.

 

Finally the hardest part, targetting. This gets harder when you drop fixed orientation, but adds an extra skill and depth to the game, as you only target directly forward when your ship is flying still (or just forward should i say! i.e. no input). Now the orientation must be slight like I said or your ship will shoot rather unhelpfully off screen. Your big big problem though is how does the player percieve depth to judge if the ship can hit something with its shot? By far this is the biggest design challenge. We copped out in the end and just copied starfox ourselves. They use a 3D targetting HUD of sorts, they have 3 square boxes at increasing depth from the front of the ship so a player can visually calculate if they can hit their target or not.

 

Hopefully this was of some help! :huh:

Posted

Carl, thank you for the detailed response. Yep, I was trying to use PlayerActor. I didn't realize how difficult the targeting could get. This is exactly what I was looking for, very helpful. Thanks again!

×
×
  • Create New...