Programming 2D Games

The official forum for "Programming 2D Games" the book by: Charles Kelly

It is currently Fri Feb 28, 2020 9:08 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Jul 30, 2014 2:28 pm 
Offline

Joined: Sat Oct 12, 2013 4:48 pm
Posts: 44
Hi,

I am a bit confused, In the engine, you have not used LPDIRECT3DSURFACE9. I wanted to know why is that?

I have added the surface method whithin your engine and I get the exact same result, the sprites renders the exact same way, so what is the difference? advantage? disadvantage?

Also is it me or it seams that when a sprite moves about, it looks a bit like it is laging or flickering and it actually looks fuzy to me and gives me a headache at some times especially the spacewar examples. Maybe some settings in the graphics class needs to be changed? or my pc is not good enought(I get same results on other computers) or maybe it is just me who needs new glasses??

One last question: why do you have to scale the background when scrolling it? without scaling it you see the borders everytime it wrappes around. I get why you scale the background but is there a way to achieve a scrolling background without having to scale it and not seeing the borders??
scaling the space image for example really ruins it and makes it fuzzy!
Kind regards

JC MAZZA


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 31, 2014 1:18 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 554
guizmo01 wrote:
Hi,

I am a bit confused, In the engine, you have not used LPDIRECT3DSURFACE9. I wanted to know why is that?

I have added the surface method whithin your engine and I get the exact same result, the sprites renders the exact same way, so what is the difference? advantage? disadvantage?

From the MSDN website: The IDirect3DSurface9 interface enables you to indirectly access memory through the UpdateSurface method. This method allows you to copy a rectangular region of pixels from one IDirect3DSurface9 interface to another IDirect3DSurface9 interface. The surface interface also has methods to directly access display memory. For example, you can use the LockRect method to lock a rectangular region of display memory.

Accessing surface memory is typically very slow and should be avoided. Games typically create a new image for each displayed frame. The image is written to an off-screen buffer which is then swapped with the on-screen buffer. The game engine does this swap in the showBackbuffer function in the Graphics class.

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 04, 2014 1:25 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 554
guizmo01 wrote:
Also is it me or it seams that when a sprite moves about, it looks a bit like it is laging or flickering and it actually looks fuzy to me and gives me a headache at some times especially the spacewar examples. Maybe some settings in the graphics class needs to be changed? or my pc is not good enought(I get same results on other computers) or maybe it is just me who needs new glasses??

This question is covered here: http://www.programming2dgames.com/forum/viewtopic.php?f=5&t=64&start=10#p1055

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 04, 2014 1:37 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 554
guizmo01 wrote:
One last question: why do you have to scale the background when scrolling it? without scaling it you see the borders everytime it wrappes around. I get why you scale the background but is there a way to achieve a scrolling background without having to scale it and not seeing the borders??
scaling the space image for example really ruins it and makes it fuzzy!

It is not necessary to scale the background when scrolling it. The Shadow and Reflection demos do not scale the water background. Humans are very good at pattern recognition. For that reason I recommend using a background image that is larger than the game window. This helps reduce the chance of of a repeating pattern. One way to achieve a larger background image is to scale it up which is what I chose to do in the Spacewar example.

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group