Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 12 Aug 2013
Offline Last Active Sep 09 2013 04:43 AM

Topics I've Started

Tile-based, textured 2D side-view terrain - best way to draw?

17 August 2013 - 08:43 AM

Pretty much what the title says. I want to implement something similar to what is used in Terraria: textured tile-based (by which I mean comprised of physical blocks - just in case) modifiable terrain (in 2D, side view). Except with a lot more tiles to draw (I intend to use variable zoom; my current hopes are to draw about 150,000 tiles at the camera's furthest, but I'd still need 4x4 textures for when the camera is up close). What would be the fastest way to draw this? Or maybe I'm way in the dream land here?


On a somewhat related note, I'm currently using textured quads to draw objects, because I've read that ID3DXSPRITE is deprecated, not as flexible, and so on. Is this true?

VSync messing with QPC() timing?

12 August 2013 - 08:14 AM

I apologize if this is the wrong subforum, but I couldn't quite figure out where to post this.
Anyway, I'm currently trying to make my physical calculations independent from rendering. What I've done is make every physical object store its transformation matrices, which are then modified during physical calculations or used for rendering.

Calculations and rendering are initiated in the message loop as follows:

timer.Update(); //this essentially does the QueryPerformanceCounter(&tickCount)

Notes: timer is a custom object;

tickFreq is initialized via QueryPerformanceFrequency(&tickFreq) in the constructor;

memory1, memory2 and phystick are pre-initialized to zero;

phystick is displayed during rendering using ID3DXFont interface.

Also, let's assume MaxFPS to be 60 and PhysicsFreq to be 1000.

And I'm using a laptop.


Now, I've decided to do the whole "count the ticks" thing to check that "physics-to-frames" ratio stays the same. And here's the problem. Without VSync (D3DPRESENT_INTERVAL_IMMEDIATE), it's fine. With VSync (D3DPRESENT_INTERVAL_ONE), it stays level for around 5 seconds and then gradually drops to roughly 1/3rd of its original value. All movements slow down as well.


I've tried commenting out the physics call, updating tickFreq every Update(), but nothing works. FramePass() is executed at stable intervals, I've checked. What in the world could I be missing?

(Also, feel free to point out if my concept is a waste of time.)