Archived

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

jollyjeffers

TLVERTEX transformation

Recommended Posts

jollyjeffers    1570
hi, I''m using D3DTLVERTEX for my game - I know that using it means that D3D doesn''t transform or light my vertices (which is why I chose them)... but is there a quick way of translating them? As in, I have a grid made of tiles - but I want to scroll them across the screen... Is there any clever trick or do I just have to alter the x/y coordinates each pass? which would destroy my frame rate Jack,

Share this post


Link to post
Share on other sites
Facehat    696
Just transform them like you would with any other tile based engine :

vertex.sx = MapX - ScrollX;
vertex.sy = MapY - ScrollY;

MapX/Y is the actual location of the tile, and ScrollX/Y is where the camera is located relative to the top left of the map.

Edited by - The Senshi on October 7, 2000 12:22:03 PM

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Thought as much,
Just a little on the slow side when you''re dealing with
4 vertices to a tile, 200*200 tiles
=160,000 vertices to calculate...

Even on my 700Mhz Athlon I can only get 40-50fps, forget about playing it on any less than a 350mhz...

I could optimise it though... I think.

Jack,

Share this post


Link to post
Share on other sites
cruZ    133
...you could share the vertices, otherwise you have to draw every edge of a tile twice. I think that would help to reduce the rendering time.
Beside, if your map has 200*200 tiles you should implement a visbility check. Then you only need to draw tiles that are actually visible.


Edited by - cruZ on October 9, 2000 7:17:53 AM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Well, a while ago I wrote a 2D tile-based platform game on my Amiga 1200 using Blitz Basic (those were the days etc) and since my machine was running at 14Mhz or thereabouts cutting processor time down was very important.

The best hint I can give you is to only calculate and render the tiles that are visible. Before you render, figure out the leftmost and rightmost column of tiles that are at least partially visible, and also the topmost and bottommost row. Then only calculate and draw the tiles that are in this region.

Good luck, and e-mail me if you have any questions.

- Peter
peter@digital-animations.com

Share this post


Link to post
Share on other sites
jollyjeffers    1570
hi,

I''m not stupid enough to calculate anything uneeded...

A visibility algorithm is quite complicated for an isometric map...

btw, I made programs on the amiga - AmigaE was my tool.... goo ''ol days.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Hehe fair enough, sorry!

Yeah calculating visibility for isometric is a bit awkward when the landscape isn''t flat - adding buildings or whatever and hills makes doing a straight bounds determination impossible.

- Peter
peter@digital-animations.com

Share this post


Link to post
Share on other sites