PDA

View Full Version : Sprite flickering in 1.07b - solution found



blackvoid
30-10-2006, 09:03 AM
1.07b is counting sprite animations from 0, we lowered the animation frames by one and it works.
BTW, the problem occurs in the provided sample as well.

WILL
30-10-2006, 04:09 PM
Umm... may I ask what exactly was the problem from? Your reference seems kinda vague.

Was this something that was an issue in the release it's self or from another project?

blackvoid
30-10-2006, 04:11 PM
All sprites in 1.07b started flickering. It was all Okay in unDelphiX6 that we used before. It seems that 1.07b is counting animation frames from 0 (previously it was 1). So reducing the animation count by 1, the problem goes away.

ijcro
30-10-2006, 08:17 PM
All sprites in 1.07b started flickering. It was all Okay in unDelphiX6 that we used before. It seems that 1.07b is counting animation frames from 0 (previously it was 1). So reducing the animation count by 1, the problem goes away.

Please tell me where is this change? DXSprite unit or the edit form no changed from version 6 to 7. Thank you

blackvoid
01-11-2006, 12:00 PM
Hi Ijcro,

I contacted you by mail, but if you did not get it, please drop me a mail at: info1848@yahoo.com

When we upgraded, all sprites started flickering, we figured that it was because the engine displayed an empty animation frame.
What we did IIRC is that we reduced the AnimCount for all our sprites by 1 and the flickering went away. I will double-check this with my coworker who is responsible for the graphics programming.

seiferalmasy
17-02-2007, 02:26 PM
Anyone know how to work around the flickering sprite bug in undelphix? Driving me mad.

Like the other guy said, it seems to be drawing a blank frame after the animation is complete, then returning to first frame causing a "flicker". It has doen it with me since the very first undelphix and is still happening in 1.07c

I tried contacting jaro at undelphix@micrel.cz but it won't send

seiferalmasy
21-02-2007, 08:55 AM
Actually after closer inspection,flickering started in 1.07 :(

The first undelphix works fine, no flickering. I have also noted that with 1.07c, the sprites are altered too.

For example, 1 black 25*25 cube with a yellow line running through the middle. In earlier versions, the line is correct at 5 pixels wide. In 1.07c, the line is about 3 pixels wide, smoothed out and looks completely wrong.

Didn't go into it much really, the flickering is the main issue. I have gone back to early version of undelphix

ijcro
21-02-2007, 02:25 PM
Hallo,

sorry I had a little problems with my mail-box...

Please tell me, how version is OK, version with new look of DXSpriteEngine or version without it?

I am preparing new version of unDelphiX 1.08 and I want correct it.

Thank you.

seiferalmasy
21-02-2007, 03:03 PM
It is 1.07c.

I can prepare a demo for you. Earlier versions had 0 flicker. But the sprites flicker when animated in 1.07 onwards (b and c for sure).

Do you want a demo with exe?

also...

I can demonstrate the yellow line thing here with screenshots

http://img73.imageshack.us/img73/93/redcubewithyellowlinexu7.png (http://imageshack.us)

Above is the picture in delphix and early versions of undelphix (100% correct)

http://img62.imageshack.us/img62/16/redcubewithyellowline10lq8.png (http://imageshack.us)

Above is 1.07c. As you can see the yellow line has changed (and even cuts out on the left, the rest of it is different too.

ijcro
21-02-2007, 08:09 PM
Thank you.
Please demo in source (no exe, can be very simple) into prototype project included in source unDelphiX.
I can test it directly with new prepared version 1.08.
Regards

seiferalmasy
21-02-2007, 09:11 PM
No I will have to give u exe also (am preparing). That way u can be sure to see the bug;) :lol:

ijcro
21-02-2007, 09:24 PM
Well, I waiting for your demo.
Regards

seiferalmasy
21-02-2007, 09:33 PM
i will sort it in a sec. i am a bit drunk so this gonn atake longer than usual :shock:

ijcro
21-02-2007, 09:49 PM
And can you try like DXDraw1.TextureFilter(0) ?



if not DXDraw1.CanDraw then Exit;
DXDraw1.BeginScene;
{set texture filter explicit here}
DXDraw1.TextureFilter(0);{0..4 - like D2D_POINT, D2D_LINEAR, D2D_FLATCUBIC, D2D_GAUSSIANCUBIC, D2D_ANISOTROPIC}
DXImageList1.Items.Find('bckgrnd').StretchDraw(DXD raw1.Surface, Bounds(0, 0, DXDraw1.Width, DXDraw1.Height), 0);
....

seiferalmasy
21-02-2007, 10:31 PM
ok demo is ready with exe. u will see the flicker, hopefully u can sort it somehow 8)

http://www.uploading.com/files/KK6D6T7T/flicker_in_1.07c.rar.html

ijcro
22-02-2007, 05:09 PM
I tried correct it. :) Please try version 1.07d from my WEB.

seiferalmasy
22-02-2007, 05:46 PM
Flickering bug is FIXED in 1.07d

weldone;)
:D
-------------

The other bug I mentioned with incorrectly drawn sprites still there , however. It only happens when do3d is set to true (or probably when hardware mode is enabled).

I cannot test do3d on its own. As soon as I set all of the others to false and have do3d to true, i get an access violation.

ijcro
22-02-2007, 07:44 PM
OK. Can be demonstrate this bug in your code?

I am preparing new version 1.08 and sprite will has new drawing functionality with blending and other effect.

Regards

seiferalmasy
22-02-2007, 07:48 PM
yes, using that demo I gave you.

Enable do3d,dohardware,dodx7 and you will see it looks wrong compared to all set to false.

Because that red cube is small, you will need a good eye;) The bug doesn't just affect sprites, it affects all drawing including Stretchdraw/draw

Maybe you added smoothing or another effect to the drawing?

I can prepare a larger demo?

ijcro
23-02-2007, 08:04 AM
Please yes, I like when you prepare demo for illustrate overwritten problem.
I can try correct it.

I saw in your code, that you no use attribute for hardware acceleration in DelphiX (BeginScene, EndScene). Please use prototype demo (you use threaded timer instead DXTimer), there is barebone for application. I will be prepare better prototype, because many extensions are missing (like DXInput).



procedure TForm1.DXTimerTimer(Sender: TObject; LagCount: Integer);
begin
if not DXDraw.CanDraw then Exit;

DXDraw.BeginScene;
try
{clear surface with predefined windows color}
DXDraw.Surface.Fill(DXDraw.Surface.ColorMatch(clBl ack));

//----------------------------------------------------------------------------
{All drawing here like}
//DXImageList.Items[0].Draw(DXDraw.surface,0,0,0);
//----------------------------------------------------------------------------
finally
DXDraw.EndScene;
end;

{ Draw FrameRate }
with DXDraw.Surface.Canvas do
try
Brush.Style := bsClear;
Font.Color := clWhite;
Font.Size := 10;
Textout(3, 3, 'FPS: ' + IntToStr(DXTimer.FrameRate));
if doHardware in DXDraw.NowOptions then begin
Textout(3, 14, 'Device: Hardware');
Textout(3, DXDraw.Height-16-14, 'Change device mode to software press SPACE.')
end
else begin
Textout(3, 14, 'Device: Software');
Textout(3, DXDraw.Height-16-14, 'Change device mode to hardware press SPACE.')
end;
if doFullScreen in DXDraw.NowOptions then
TextOut(3,DXDraw.Height-16,'For windowed mode press ALT+Enter.')
else
TextOut(3,DXDraw.Height-16,'For fullscreen press ALT+Enter.');
finally
Release; { Indispensability }
end;

DXDraw.Flip;
end;


Thank you for your cooperative work.

Regards

seiferalmasy
23-02-2007, 10:01 AM
Ok. I have created the test with your code and again uploaded.

Please note, the 2 cubes you can see.

The red is drawn wrong for sure, take a good look at it, it changes when -[do3d].

The second black cube, seems to be ok, but in my game, the yellow line is thin and smoothed (??)

regards, DLPB

[press space to remove do3d]



-----

TEST 2

http://www.uploading.com/files/UUELN755/Bad_Draw_in_1.07d_hardware.rar.html

seiferalmasy
24-02-2007, 06:00 PM
and also with 1.07d, animation bug. I have many frames at 72 * 72 pixels. when do3d/hardware, the animation does not play correctly, it shifts fro left to right, like it does if you get the patternwidth and patternheight wrong.

will test this bug more.

edit: doesn't happen with small 5 frame animation- 20*20 (h= 20, w= 100)

but it does with 74 frame animation- 72*72 (h=72, w=5328)

only happens with hardware mode enabled and with large framerate/framesize or maybe just large picture

TEST 3

http://www.uploading.com/files/OD8T7JWU/Bad_Animate_in_1.07d.rar.html

<<remember to enable hardware mode to view the bug

ijcro
26-02-2007, 11:28 AM
To Example 2:

I tried it and no change in look, all display OK. When you will demonstrate me wrong look, please send me your picture with good and bad picture.
I tried it with some set up of TextureFileter() like


DXDraw.TextureFilter&#40;Ord&#40;D2D_POINT&#41;&#41;;

or


DXDraw.TextureFilter&#40;Ord&#40;D2D_LINEAR&#41;&#41;;

and no bad look give.

Via your code like


procedure TMainFm.DXTimer1Timer&#40;Sender&#58; TObject; LagCount&#58; Integer&#41;;
begin
DXInput1.Update;

if not DXDraw.CanDraw then Exit;

DXDraw.BeginScene;
&#123;D2D_POINT, D2D_LINEAR, D2D_FLATCUBIC, D2D_GAUSSIANCUBIC, D2D_ANISOTROPIC&#125;
DXDraw.TextureFilter&#40;Ord&#40;D2D_POINT&#41;&#41;;

.......


To Example 3:

In DXDraws unit is texture limit like



const
maxTexBlock = 2048;
maxVideoBlockSize = 2048;


When you want use larger texture (in Px) please change this value (2048) or restrucuralize your to this size (size 2048x2048) without change value.

It is own limitation of DXDraws resp. DelphiX and I it put from code to public constant only.

seiferalmasy
26-02-2007, 12:24 PM
http://img144.imageshack.us/img144/9046/red1us8.png (http://imageshack.us)

incorrect. HARDWARE mode AND patternheight<>0 , Patternwidth<>0

http://img341.imageshack.us/img341/5402/red2rr3.png (http://imageshack.us)

CORRECT. SOFTWARE mode OR patternwidth=0, patternheight=0

----------

Tried your code and set to point and linear. No effect

Edit:

UPDATE. Only happens when patternheight and patternwidth are set! If set to 0, no change in draw.

Conclusion.

Both problems can be traced back to using hardware mode with patternheight and patternwidth.

There is a problem with Patternheight and patternwidth or calculations connected with them once hardware mode is enabled.

ijcro
26-02-2007, 01:47 PM
Fine,
I think that it is no problem of paiting but it is problem fill in texture to mesh. A see into and I try it repair...Please be patient, thank you

seiferalmasy
26-02-2007, 01:49 PM
no worries. We are all greatful for your continued support for delphix:) well I am:) :D

I will help you out with testing these 2 issues

ijcro
26-02-2007, 02:32 PM
Thank you!

I think, that solution founds! I will make some tests and next day I planning the update file as 1.07e...

BTW: I looking for anybody that known DirectPlay from DirectX 9. I have prepared version of unDelphiX to DirectX9 but I am sorry I don't know rewrite DXPlay and own form to new interface. Can anybody help me with them? Thanks.

And I have question for Vista users: Is still use RM mode of DirectX or not? I have letters by some users of Vista, where they wrote that RM is not supported now. Is it true?

ijcro
01-03-2007, 09:36 PM
I tried correct it. Please try version 1.07e from my WEB.

Regards

seiferalmasy
02-03-2007, 12:10 AM
tried 1.07e.

Problem persists.

red cube still altered

Other testing cube altered.

Animation with large sprite, still broken (though you did explain soemthing about setting blocksize?)

I will prepare a better demo to illustrate :D

-----

update:

I am going into this in some detail. Give me some time;)

seiferalmasy
02-03-2007, 01:32 AM
http://www.uploading.com/files/CT6D0IQ6/1.07e_bugs.rar.html

New test. Better this time.

Look closely at the yellow lines;)

space bar to switch back and forth.

Version 1.0, undelphix has none of the above problems. I haven't tested 1.06? anywhere I can download it?

ijcro
05-03-2007, 03:42 PM
Hello,

I saw your example and I think that is not error in unDelphiX last version.

You can draw set of images (74 clips 72x72px) from image size 5328x72px.

I try it and the is problem with physical size of texture (some adapteurs support 2048x2048px only). Texture is shrinked to physical size (or other me unknown method) but unDelphiX recount size on bitmap size.

I do glue your images to raster 9x9img and set of limit images (because emty images created) and it works very fine. I don't know instant solution now, but I try in prepared version 1.08 better test for large images with supported texture size. I use your demo for future tests

Regards

seiferalmasy
05-03-2007, 03:43 PM
Thanks dude :D :D

Good luck

kotai
05-03-2007, 05:09 PM
BTW: I looking for anybody that known DirectPlay from DirectX 9. I have prepared version of unDelphiX to DirectX9 but I am sorry I don't know rewrite DXPlay and own form to new interface. Can anybody help me with them? Thanks.


Direct Play from DirectX9 is same as DirectX8.1. I was trying to create the new interfaces IDirectPlay8Client and IDirectPlay8Server (that are those who allow to connect the client without opening ports, since the IDirectPlayPeer also is that open ports) but I could not do it.

Finally I did was to increase the functions of the DirectPlay7 since Hori made it very basic.

If you want I can send you everything what I did, that is not great.

Kotai.

ijcro
06-03-2007, 07:49 AM
Direct Play from DirectX9 is same as DirectX8.1. I was trying to create the new interfaces IDirectPlay8Client and IDirectPlay8Server (that are those who allow to connect the client without opening ports, since the IDirectPlayPeer also is that open ports) but I could not do it.
Finally I did was to increase the functions of the DirectPlay7 since Hori made it very basic.
If you want I can send you everything what I did, that is not great.
Kotai.

Thank you, I am using DirectX 9 headers October 2006 Delphi adaptation by Alexey Barkovoy. I want enhance DXPlay component to new DirectX functionality. I will like when you help me with them, thanks.

Regards