Jump to content
  • Advertisement
Sign in to follow this  
seansps

Best way to go about a 2d isometric shooter?

This topic is 2502 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

Hi all,

I know this is a loaded question but any pointers would be appreciated...
I'm new to game coding (but not new to C++ or C coding) and instead of starting off with a platformer, I'd like to do a sort of 2D shooter in an isometric style.
I don't want it to be jagged motions of up, down, left, right, diagonal... I want fluid controls (think like Grand Theft Auto 1) but I want the art to be in an isometric style. Is this even achievable?
Since I have no experience in 3D game coding... that's probably off limits... but I know that it could be easier to do it in a 3D engine.

I was thinking doing it with SFML/C++. (Perhaps I should do SDL instead?)

How would you go about it? Perhaps there are open source games/engines that you can recommend that I look at for ideas on implementation? Personally, I'm having trouble imagining how to implement a game with an isometric grid and fluid motion (allowing for more than one entity to be on the same spot in the grid, aiming in any direction with the mouse, etc.) Any suggestions on how to go about implementing an isometric grid for this kind of game would be valued too.

Or perhaps maybe isometric is not the way to go?

Share this post


Link to post
Share on other sites
Advertisement
Hi there!
One thing you can think about is just having a Isometric art style but all of your entities are based on a straight XY grid.

You could even have prerendered worlds with really beautiful graphics pretty easily by doing this.

I ended up trying to program a free form movement method in my isometric game I am developing and it became a pain in the neck when dealing with collisions and a dynamically changing world.
So I opted for 8 directional movement but clamping to tile coordinates and transferring entities to the next location when they cross the threshold.

Share this post


Link to post
Share on other sites
Hi! Thanks for the response. Yeah, that's what I was thinking... perhaps isometric art and then everything on XY. But like you said... free form movement I can already envision having problems with collisions... (say for instance walking behind a building but colliding with the front part...)

When you reference crossing the threshold.. do you mean that you set what part of the grid they are in, and allow them to move within that part, and then when they cross a certain part of the grid, it sets that object's location to be in another part of the grid? Would something like that work?

Going back to the free-form motion idea... what if sprites for things like buildings (drawn in isometric style) have essentially two hit-boxes... one that determines where the player collides and cannot move any further ... and another that allows them to actually collide with and walk through it, but when doing so, they are drawn behind the building. Would that work? I guess you would need something similar for trees and such... could get really complicated.

Share this post


Link to post
Share on other sites
For drawing everything I have a list that gets created with all of my entities and objects that is sorted based on its isometric Y coordinate.
I use that list to draw all of my objects and entities in the correct Y axis order front to back. Terrain is also drawn like this with multiple layers.

I currently do 8 frames of animation in each direction and use the frames as my threshold for tile transitions using something like this for each frame:

int Px_X = 8; //8 frames
int Px_Y = 4;
switch (Ent->_PositionData.FacingDir)
{
case DIRN:
{
Ent->_PositionData.PixelOffSetY -= Px_Y;
CameraPTR->WorldPixelOffSetY -= Px_Y;

}break;
case DIRNE:
{
Ent->_PositionData.PixelOffSetX += Px_X/2;
Ent->_PositionData.PixelOffSetY -= Px_Y/2;

CameraPTR->WorldPixelOffSetX += Px_X/2;
CameraPTR->WorldPixelOffSetY -= Px_Y/2;

}break;
case DIRE:
{
Ent->_PositionData.PixelOffSetX += Px_X;
CameraPTR->WorldPixelOffSetX += Px_X;

}break;
case DIRSE:
{
Ent->_PositionData.PixelOffSetX += Px_X/2;
Ent->_PositionData.PixelOffSetY += Px_Y/2;

CameraPTR->WorldPixelOffSetX += Px_X/2;
CameraPTR->WorldPixelOffSetY += Px_Y/2;

}break;
case DIRS:
{
Ent->_PositionData.PixelOffSetY += Px_Y;
CameraPTR->WorldPixelOffSetY += Px_Y;

}break;
case DIRSW:
{
Ent->_PositionData.PixelOffSetX -= Px_X/2;
Ent->_PositionData.PixelOffSetY += Px_Y/2;

}break;
case DIRW:
{
Ent->_PositionData.PixelOffSetX -= Px_X;

}break;
case DIRNW:
{
Ent->_PositionData.PixelOffSetX -= Px_X/2;
Ent->_PositionData.PixelOffSetY -= Px_Y/2;

}break;
} //end switch



When frame 8 is hit I *tilewalk* the entity based on its facing direction:

///////////////////////////////////////////////////////////////////////
void EntityHandler::TileWalk(Entity* Ent) //Moves a int based on facing direction
{
Ent->_PositionData.PixelOffSetX = 0;
Ent->_PositionData.PixelOffSetY = 0;
switch (Ent->_PositionData.FacingDir)
{
case DIRN:
{
Ent->_PositionData.LocY -= 2;
}break;
case DIRNE:
{

if(Ent->_PositionData.LocY&1) // if y is odd also
{
Ent->_PositionData.LocX += 1;
Ent->_PositionData.LocY -= 1;
}
else //else y is even
{
Ent->_PositionData.LocY -= 1;
}

}break;
case DIRE:
{
Ent->_PositionData.LocX += 1;
}break;
case DIRSE:
{
if(Ent->_PositionData.LocY&1) // if y is odd also
{
Ent->_PositionData.LocX += 1;
Ent->_PositionData.LocY += 1;
}
else //else y is even
{
Ent->_PositionData.LocY += 1;
}
}break;
case DIRS:
{
Ent->_PositionData.LocY += 2;
}break;
case DIRSW:
{
if(Ent->_PositionData.LocY&1) // if y is odd also
{
Ent->_PositionData.LocY += 1;
}
else //else y is even
{
Ent->_PositionData.LocX -= 1;
Ent->_PositionData.LocY += 1;
}
}break;
case DIRW:
{
Ent->_PositionData.LocX -= 1;
}break;
case DIRNW:
{
if(Ent->_PositionData.LocY&1) // if y is odd also
{
Ent->_PositionData.LocY -= 1;
}
else //else y is even
{
Ent->_PositionData.LocX -= 1;
Ent->_PositionData.LocY -= 1;
}
}break;
}

return;
}

Share this post


Link to post
Share on other sites
Cool, thanks! This could achieve a similar effect to what I was going for.

Edit: Does this in effect give the illusion of free-form motion?

Share this post


Link to post
Share on other sites

Edit: Does this in effect give the illusion of free-form motion?


No its clamped to tile based movements, so you click and the player traverses a tile.
Its not as responsive as free-form but it works well.

Free form just had too many things I had to keep track of for tile transitions.

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!