Jump to content
  • Advertisement
Sign in to follow this  
valleyman86

Top Down Shooter - 2D Feel with 3D Graphics

This topic is 2810 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am in the process of creating a 3D top down shooter. I want it to have a very old school arcade feel too it. You know where it's easy to destroy massive amounts of enemies and looks crazy. I don't want it to be too difficult however. A game that I loved was Blackhawk Striker 2. I would like to keep this feel.

The main question I have though is this. In this game it is clearly a 3D game. The bullets are 2D sprites and they seem to hit ground and air units while not hitting buildings. Buildings can only be killed using a bomb that drops on occasion. I can figure out the building mechanics and I can think of ways to do the ground/air mechanics but I am curious as to what you guys think is the solution. The issue is that the bullets fire from an aircraft (the player) and this generally shoots over anything on the ground. This must still hit ground units though and not look whacky. Air units should be fine if they are all the same level as the player.

My idea is to make the ground units hit box extend to the sky and if a bullet hits it then it dies. Is this the best way or not? I have not tested this yet as I want to make sure the design sounds ok but this sounds more like a hack than a great solution.

Thanks.

Share this post


Link to post
Share on other sites
Advertisement
[color=#1C2837][size=2]My idea is to make the ground units hit box extend to the sky and if a bullet hits it then it dies.[/quote]
Depends on your 3D Projection. If the FOV is too high, this will look like you're shooting above the Target and it magically explodes.
Instead of extending the Box "straight" up, transform it so that it is parallel to your Projection.
If you've got a low FOV, this should be fine.

Share this post


Link to post
Share on other sites
A simpler approach might be to use 2D collision detection and ignore collisions between objects that you decide shouldn't interact. E.g., bullet collides with building: ignore. Bullet collides with ground unit: damage to ground unit. I'm assuming your collision engine makes provisions for setting collision type and "collides with <type>" variables.

Share this post


Link to post
Share on other sites
See I like that approach Buckeye but I am honestly not familiar with using 2d collision detection in a 3D game. You have any suggestions or tips on that?

Edit: I was thinking maybe I could use a technique similar to mouse picking using a ray from the camera and through the bullet to see if it intersects with the ground units (or air even). Would this be too slow?

Share this post


Link to post
Share on other sites
Hmm...well in the 2D games I've made, I either use a simple "contains" method or a vector distance test. If you do not have a high number of objects, you can simply loop through each and test to see if the distance is greater than the two objects radius's combined. A simple rectangle would probably work fine as well. Basically, you can use standard 3D collision checks, just drop the 3rd dimension. You can also do as Buckeye suggested and ignore object types in which do not require interactions. Also, each collideable object could have an onCollision event in which gets ran of course during a collision. In my game, I have projectiles apply damage directly to the objects they hit. If you want projectiles for example to always pass buildings (ie. they should not collide or stop at buildings) but they should also not appear to intersect them either, you could always turn depth testing off for the sprites and render them after the 3D geometry (please correct me if I am mistaken here). Hope this helps.

Share this post


Link to post
Share on other sites
[font=arial, verdana, tahoma, sans-serif][size=2]Yea I will be doing some optimization and only doing collision with objects that need to be tested against but I was more curious about the 2D look and feel while maintaining a 3D scene. I mean if I really wanted too which is still a possibility is to make a 2D game. My only issue with that is that 2D has been done to death. I really like Blackhawk Striker 2 and would like to make a game like it and add my own touches. I think I will try that ray intersection technique to see if that looks good.[/font]

Share this post


Link to post
Share on other sites

See I like that approach Buckeye but I am honestly not familiar with using 2d collision detection in a 3D game. You have any suggestions or tips on that?

Edit: I was thinking maybe I could use a technique similar to mouse picking using a ray from the camera and through the bullet to see if it intersects with the ground units (or air even). Would this be too slow?

Ah.. I see what you're talking about. You have an actual 3D world with vertical height. As suggested above, you may have to implement bounding boxes (or other collision shapes) for each object that extend vertically from the ground to elevation high enough that a ray cast from the player's "height" would intersect everything of interest.

Perhaps more simply, why not just implement 2D collision detection, ignoring all height parameters? I.e., your collision engine need use only 2 of 3 dimensions. That would be (probably a lot) faster than 3D collision detection, particularly if you're concerned only with rectangle and circle collisions. For each object, implement "I'm of type <someType>" and "I collide with <otherTypesOfInterest>"

I do that with bitfields and test for collisions with binary testing:

enum { TYPE_BUILDING = 1, TYPE_AIRUNIT=2, TYPE_GROUNDUNIT=4, etc. }; // single bit per type
if( ObjWithType() & OtherObjCollidesWith() ) evaluate_collision;

Share this post


Link to post
Share on other sites
Exactly... I would love to use 2D collision detection but its not really that simple if the tanks/cars are on the ground and the aircraft is in the air. The bullets would be the same height as my players aircraft. With perspective if I use simple 2d detection then the bullets would look like they are hitting nothing and the ground units magically die.

Maybe there is a way to do collision detection on what is actually drawn to the screen using screen coordinates? Does that make sense?

Share this post


Link to post
Share on other sites
One solution would be to implement an "auto-aim" that adjusts the angle of the shot based on the location of the closest enemy directly in front of the aircraft...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!