Creating a Tile-based engine with D3D8

Started by
0 comments, last by DanMan 22 years, 3 months ago
Hi everyone, I''ve got a couple of quick questions about the subject (creating a title-based engine with D3D8). First, each tile is a textured square consisting of two triangles (that parts easy). The texture actually consists of squares of tiles. Now here''s where I have a question: it would be more efficient if I could use triangle strips to define the map (each tile would only require 4 verticies instead of 6). Doing that though, each tile would share two verticies (and two texture coordinates), correct? Well, there''s a way around it, by defining each tile as a separate triangle list, but then each one would have to be rendered with a separate call to DrawPrimitive, which would be sloooooooow, correct? Second question, how exactly does non-transformed world coordinates map into texture coordinates? I of course would like each tile to fit the tile texture without having to be stretched or crammed, so if I have tile in the texture that is 32 pixels by 32 pixels, how wide (in world coordinates) would my quad need to be? Heh, does any of that make any sense? Any help is of course appreciated... ---DanMan
Advertisement
Use indexed primitives! Indexed primitives and a triangle list. Each tile would be made up of 4 vertices and 6 indices. Or better yet, use DirectDraw...

Well anyway, as for your second question, I''m pretty sure there are many tutorials on setting up your orthographic projection such that there is a 1:1 ratio between world space and screen space.

~CGameProgrammer( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.

This topic is closed to new replies.

Advertisement