Hard-code irregular shaped blits?

Started by
4 comments, last by Jiia 21 years, 5 months ago
Really a very simple question. In my 2D isometric game (please don't move this to that thread ), I draw all of the flat diamond shaped floor tiles before I draw anything else (to prevent moving objects from slipping under the corners). Anyway, it does seem like a huge waste to draw all of them as rectangles, since those 4 corners amount to 50% of the image, plus having to check for transparent pixels for every single pixel. Would it be a good idea to hard code a specific blitting function and use it to manually treverse the pointers instead of using a loop? The only problem I can come up with is that it would look very ugly. Also clipping - I don't know how I could clip correctly with this method, unless I only use it for tiles that are completely on the screen. Any opinions on this? [edited by - Jiia on November 1, 2002 11:48:13 PM]
Advertisement
My recommendation: profile your drawing routines. If they aren''t taking up enough cycles that this type of potential optimization would make a large difference, then don''t bother.

Or, you can always just move to a 3D-rendered isometric world. After all, a single tile is simply two triangles.

RomSteady - Test Locally, Test Globally, Test Early, Test Often
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.
2D scan conversion. you move along the outlines of your tile shape, and fill line per line inbetween. That''s very fast (that''s how all the software 3D renderers work), esp. with simple shapes, and you won''t waste any pixels.
Well, I tried the line approach. Perhaps it would have a greater effect with smaller tiles, but there was very little change in the % of time spent drawing the tiles, and the number of tiles I can draw within 60 seconds. Either my code could have been written better, or the time my cpu takes to skip over transparent pixels is blazing fast.

Thanks again though,
Jiia
You could post your scan conversion code, and let people optimize it to death.

- JQ
Full Speed Games. Are back.
~phil
The only issue is that the rectangle blitting routines are highly optimized and are likely done with special CPU instruction or hardware support. So unless your method of drawing is significantly faster, you won''t gain much speed by doing it yourself.

tj963
tj963

This topic is closed to new replies.

Advertisement