Sign in to follow this  
slyprid

[.net] Best way to create a tile engine

Recommended Posts

slyprid    202
I'm currently experimenting with making a tile engine. I've created two engines so far with the exact same capabilities. The only problem i'm having is the one I created in Direct3D only runs at max of 30-40fps, whereas the one created in DirectDraw runs at 60+fps. I know that directdraw isn't supported anymore, but is it worth going to Direct3D because of that? Or is there a better method in Direct3D to render tiles. The way i'm currently doing it is creating primitives that consist of 4 verticies, than I texture them. I picked up some speed by having it texture the primitives with the same tiles all at once, but I would like to use a tileset instead of just a list of textures. (reason I want to use tileset, is that since it runs slower with more textures loading, why not load one texture with all the tiles you need) Slyprid

Share this post


Link to post
Share on other sites
Undergamer    142
I assume you used some kind of rendertotexture stuff to access the backbuffer directly in the D3d engine to yield such low results.

My suggestion would be to exploit the power of d3d and use actual triangles/squares rendered in orthagonal mode. This would allow you to use hardware acceleration to the max.

Technically speaking: go load up quake 3 and the first thing you see is a hud. That hud is probably drawn very quickly and dirtily through a similar orthagonal operation. Accessing the backbuffer is time consuming at best because you have to check the context, lock, copy, and unlock the buffer (via that rendertotexture func or an UpdateXXXXX func).

30 fps is unreasonable, even for software emulation mode in most sample apps.

Actualy, you can do this with as few as 30 lines of code (to setup this view mode, render your triangles with "textures" as tiles, and reset the view mode to perspective).

g/l

Share this post


Link to post
Share on other sites
slyprid    202
Well I went and rewrote my program to see if it was my coding slowing it down, but found out that if I use vertexBuffers instead of just writing a vertex at a time than it speeds it up alot. I'm currently running at 100+ fps right now (only 1 tile texture on screen atm though) But it is running alot better now. Thanks for the advice, I also changed to rendering in orthogonal mode.

Slyprid

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this