Advertisement

2d shooter in 3d

Started by April 10, 2006 04:36 PM
9 comments, last by tpk 18 years, 10 months ago
I've been working on a game in the same style as top down shooters lately, and came across a problem. Objects exist at various heights, from underwater platforms to ground targets to enemy ships flying at the same height as the player, but I want the gameplay to remain on a basically 3d playing field. Traditional top-down shooters were from a completely top-down view, lacking any perspective (at least on the functional playing field) and thus the actual height of ships/structures could be ignored in terms of visual effect (the missle/laser/etc. appears to hit it no matter what height it's at). My game has the camera above the player, but also trailing and angled slightly off from 90 degrees, resulting in a visual issue - the 'bullets' fired travel on a straight path, along the plane the player is on, but not all targets are on this plane. Detecting a hit is simple enough, I simply ignore height and see if it hit an enemy/structure/etc., but the player still sees it as having not hit the target if it's at a different height. I've been considering how to fix this, but haven't come up with a solution I particularly like yet. My first idea was to simply determine what the player is targeting, and alter the path of the projectile upward/downward accordingly. Unfortunately, I soon realised how difficult this would be considering that almost all targets are mobile...the player may be leading to hit a moving ship, or may be targeting the missle platform along the same path, but further back and down. In other words, determining the intended target is impossible from what I see. The best idea I have is to have multiple bullet types - air-to-air, air-to-ground, and air-to-sea. I wanted to do this for the sake of adding depth before deciding to use a 3d view anyway. Air-to-ground and sea could simply drop from the player's ship and then follow a straight path on the appropriate plane once dropping far enough, but I still think it would seem rather awkward looking, at least for air-to-ground weapons. So, that's an overview of the biggest problem area of the game I'm working on. Ideas/comments/suggestions/etc are welcome.
There is a game called Ace Combat Advance(yea you guessed right - it's for the GBA) you should try. In this bird eye game, the player can make his airplane dive in order to shoot lower ground targets. This does not make the game 3D, since there are only two possible heights - high and low.

Another thing you can do is to give ground bullets a pre-defined angle. Ground targets don't move as fast as air targets, so I guess it shouldn't be that much hard to hit them with angled bullets
-----------------------------------------Everyboddy need someboddy!
Advertisement
Depth cuing?

The game's 3D, right? So orbit the camera ten degrees back, to show a little of the back of the player's avatar. Then, have a translucent plane at the player's altitude, and have vertical lines connect each object to that plane.
Quote:
Original post by Iron Chef Carnage
Depth cuing?

The problem is not drawing bullets, but having 2D collisions in a 3D environment in which aiming appears much more difficult.
Having discrete layers as Someboddy suggests constrains bullet movement to two dimensions, but it might be graphically inappropriate.
If the more natural solution isn't acceptable the speed of bullets and enemy movements can be adjusted to avoid the possibility of dodging by changing height, maybe with some help from tall collision volumes.
Traditionally, opponents tend to never dodge bullets except accidentally as part of their predetermined movement; if some particularly fast enemies did dives, loops etc. to avoid bullets it could be a nice feature.
I wouldn't worry about guessing targets; there can be a simple priority rule that never surprises the player, for instance targeting incoming missiles first, then fighter craft, then harmless air enemies, then armed land/sea enemies and enemy buildings, then the harmless ones; by default the gun can spray suppressive fire horizontally, with a regular elevation sweep or randomly.
Air to air and air to ground weapons can be not only guided missiles with special height and locking policies, but also guns with a different priority order.
Regarding bullet types, a potentially important one is the explosion that blasts enemies in a wide height interval, from example from proximity mines slowly shot forward and sideways.

Omae Wa Mou Shindeiru

I was thinking about this and I came up with another way of doing it - all the collisions are done in 2d, largely ignoring the actual 3d positions. The collision works something like:

1. Move all entities as normal though the 3d world
2. Project all entities onto a single 2d plane (eg. the viewing plane)
3. Perform collision checks only in this 2d collision plane.

This actually works really well (even though logically it makes very little sense). If you look at newer 2d shooters like gigawing they have 'fake' perspective depending on how the sprites are drawn, but in the end all the bullets care about is the screen positions. This is basically just the same idea but with a proper 3d world.
I think a lot of people have missed the OP's point here. He has no problem detecting the collision - the problem is that his slightly skewed perspective highlights (visually) the fact that the bullets don't actually connect in the 3d world when triggering the explosion. The bullets are up in the sky and physically above a submarine or whatever, yet it counts as a hit. Programmatically intended, but visually flawed.

I think the trouble here is that it is quite simply a design flaw.

Solution 1
Simply ensure the camera maintains a completely top-down perspective. I'm sure the slight angle you'd added had been part of the visual style and compliments the 3d visuals but it really is what causes the problems.

Solution 2
Bullets that fire as a vertical spread, so rather than being a single pair of bulelts it forms something more like a collumn. This already sounds cackhanded but I'm just throwing out ideas here. Actually, ignore this idea, it sucks.

Solution 3
As already mentioned, have a split of weaponry taking care of both low and high targets. This has been done many times before but certainly makes for a nice mechanic. Even more so if the world is split into two layers and the Player effectively shift between the two. Almost using it as a means of dodging obstacles by flying under or over them. Kinda like ikaruga but instead of Black/White you're talking Ground/Air.


Hope that helps.

Advertisement
Quote:
Original post by ghosted
I think a lot of people have missed the OP's point here. He has no problem detecting the collision - the problem is that his slightly skewed perspective highlights (visually) the fact that the bullets don't actually connect in the 3d world when triggering the explosion. The bullets are up in the sky and physically above a submarine or whatever, yet it counts as a hit. Programmatically intended, but visually flawed.

Thats why my method is nice - the collision method means that theres never a visual inconsistancy and it doesn't need seperate bullet types or odd bullet patterns.
Quote:
Original post by OrangyTang
Quote:
Original post by ghosted
I think a lot of people have missed the OP's point here. He has no problem detecting the collision - the problem is that his slightly skewed perspective highlights (visually) the fact that the bullets don't actually connect in the 3d world when triggering the explosion. The bullets are up in the sky and physically above a submarine or whatever, yet it counts as a hit. Programmatically intended, but visually flawed.

Thats why my method is nice - the collision method means that theres never a visual inconsistancy and it doesn't need seperate bullet types or odd bullet patterns.


Ah right, I think I get you now. Wise thinking. Yeah, go with that I say.
Another thing you might consider doing is just making it impossible for the player to hit out-of-plane enemies (unless the player is using some kind of guided weaponry). Einehänder for the Playstation did this, and while I think the game would stand on its own without that feature, it was certainly an excellent game.
Jetblade: an open-source 2D platforming game in the style of Metroid and Castlevania, with procedurally-generated levels
Though likely obvious, I'll note the previous anonymous post was me (forgot to log in...)

This topic is closed to new replies.

Advertisement