• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

finite coords..what the..?

1 post in this topic

hello all! I am building a basic isometric engine..and have everything working except one thing...when i scroll the map..its currently scrolling 1 tile length (left, right, up, or down)

this makes for some pretty fast and choppy scrolling..i know that there is a way to scroll more smoothly using something i think is called 'finite coords' ? can anyone explain this method or point me in the right direction to figure it out?

thanks alot!!

-jkat
(elmo11@rcn.com)

0

Share this post


Link to post
Share on other sites
i know that Jim Adams has an article about this on the light befallen site.

www.lightbefallen.com

fortunately, and unfortunately at the same time, i'm currently working on a program that demonstrates EXACTLY what you are asking about. (the unfortunate part is that i wont be done with it for a few days, or i could show you right now)

however, i will give a quick answer as to how you can solve your problem.

the issue here is in translation of screen coordinates(ScreenSpace) to world coordinates(TileSpace), and vice versa.

ScreenSpace is the viewable area of the screen. it is usually a rectangle.

so, for example, lets say you are doing a fullscreen application that runs in 640x480, but at the left hand side of the screen, you have a 64 pixel wide toolbar, at the top of the screen you have a 16 pixels menu bar, thus leaving you with the following rectangle:

code:

const int TOOLBARWIDTH=64;
const int MENUHEIGHT=8;
const int SCREENWIDTH=640;
const int SCREENHEIGHT=480;

RECT rcScreenSpace;
SetRect(&rcScreenSpace,TOOLBARWIDTH,MENUHEIGHT,SCREENWIDTH,SCREENHEIGHT);


and now lets say you want to also put an 8x8 pixel border inside this area.

code:

const int BORDERWIDTH=8;
cosnt int BORDERHEIGHT=8;

rcScreenSpace.left+=BORDERWIDTH;
rcScreenSpace.right-=BORDERWIDTH;
rcScreenSpace.top+=BORDERHEIGHT;
rcScreenSpace.bottom-=BORDERHEIGHT;


now i've got the bounds of my screenspace (please note that since i've used constants,i have no idea what the actual coordinates of the screenspace are, and nor do i care, and nor SHOULD i care).

next, i'm going to determine by PlotSpace.

PlotSpace is exactly the same size as ScreenSpace, but with left and top at (0,0)

code:

RECT rcPlotSpace;
CopyRect(&rcPlotSpace,&rcScreenSpace);
OffsetRect(&rcPlotSpace,-rcScreenSpace.left,-rcScreenSpace.top);

converting between them is a simple matter

code:

//screenspace->plotspace
ptPlot.x=ptScreen.x-rcScreenSpace.left;
ptPlot.y=ptScreen.y-rcScreenSpace.top;

//plotspace->screenspace
ptScreen.x=ptPlot.x+rcScreenSpace.left;
ptScreen.y=ptPlot.y+rcScreenSpace.top;


now, we are going to make plotspace talk to tilespace, through a tilespacewindow

to do this, we merely need to keep track of a single point, that is the corresponding point in tilespace to (0,0) in plotspace. this is an arbitrary point, and it is the key to scrolling your map. i.e. this is the value you change by whatever factor you like to scroll your map in any direction.

so, let us call this point ptTileSpaceWindow.

now, to calculate the position of the tilespace window:

code:

RECT rcTileSpaceWindow;
CopyRect(&rcTileSpaceWindow,&rcPlotSpace);
OffsetRect(&rcTileSpaceWindow,ptTileSpaceWindow.x,ptTileSpaceWindow.y);

now we have a method by which we can translate tilespace coordinates into plotspace coordinates

code:

//plotspace->tilespace
ptWorld.x=ptPlot.x+ptTileSpaceWindow.x;
ptWorld.y=ptPlot.y+ptTileSpaceWindow.y;

//tilespace->plotspace
ptPlot.x=ptWorld.x-ptTileSpaceWindow.x;
ptPlot.y=ptWorld.y-ptTileSpaceWindow.y;


its important to note, at this point, that i'm breaking this down into more steps than it needs to be. you can translate from screen space to tilespace without utilizing plotspace, which is only included here for illustration purposed.

now, we want to determine if a given tile is within the viewable area. in order to do this, we need to know the world coordinates of the rectangle that will contain an individual tile.

the following code provides the equations for plotting staggered (offset) tilemaps as well as diagonal (diamond) tilemaps. most likely, your own equations will be similar to one of these.

code:

//staggered map
XPos=TileX*TILEWIDTH+(TileY&1)*(TILEWIDTH>>1);
YPos=TileY*(TILEHEIGHT>>1);

//diagonal map
XPos=(TileX-TileY)*(TILEWIDTH>>1);
YPos=(TileX+TileY)*(TILEHEIGHT>>1);


next we find the bounding rectangle of the tile.

LeftPad, etc are padding values, and may well be 0 depending on whether or not images stick out of the tile.

code:

RECT rcTile;
SetRect(&rcTile,TileX-LeftPad,TileY-TopPad,TileX+TILEWIDTH+RightPad,TileY+TILEHEIGHT+BottomPad);

now, we check to see if any of the tile bounding rect is within the tilespace window:

code:

RECT rcIntersect;
BOOL bIntersects;
bIntersects=IntersectRect(&rcIntersect,&rcTile,&rcTileSpaceWindow);
if(bIntersects)
{
//the tile is viewable
}

if it is viewable, you can easily translate rcTile from tilespace to screenspace coordinates, also, you can use rcIntersect to clip the tile without too much trouble.

did i say this post would be short? i lied.

[This message has been edited by TANSTAAFL (edited August 30, 1999).]

0

Share this post


Link to post
Share on other sites