Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / create animated sprite does not show pixel perfect

Author
Message
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 2nd Jul 2005 21:32 Edited at: 2nd Jul 2005 21:56
After installing upgrade 5.8, I noticed that sprites created with the create animated sprite command are no longer pixel perfect.

Usually you can place a "1" after the load image command, to make sprites pixel perfect.

However, since the create animated sprite does not use the load image command, this is not possible.

Attached is an example code and image. It is hard to see in the example, but the image appears in darkbasic slightly blurred.

[edit]
I just check the change log for U5.8, ironically it says "Sprite - when using animated sprites the image dimensions are retained resulting in no more stretching". I never had this problem before, until they tried to fix something that wasn't broken .

Attachments

Login to view attachments
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 2nd Jul 2005 22:46
Yes, it does appear slightly blurred.

See the picture

Attachments

Login to view attachments
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 2nd Jul 2005 23:00 Edited at: 2nd Jul 2005 23:00
Thanks for confirming that. Heres a better (or worse) picture show it:

The text should be only in white and black, btw.

Attachments

Login to view attachments
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 3rd Jul 2005 21:56
I've added this to the dbHelp as Note, just so everyone can see it, as it is quite a big thing for everyone using Custom-fonts via this method!

Jess.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 4th Jul 2005 08:58
After a bit of experimenting it appears it IS pixel perfect but you must use computer-friendly sizes like 8, 16 or 32 pixels per image and don't have odd numbers like 11 for number of sprites across as that will always force weird image sizes.

I have tested LOTS of different varieties and things work if you adhere to these 'nice' sizes. Having a font made up of 28*28 pixels just won't work. You would have to load it in as an image and use get image to slice it up but then you end up with loads of images which you are trying to avoid.


OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 4th Jul 2005 16:47
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Jul 2005 13:58 Edited at: 19th Jul 2005 14:00
I got board and started exploring the different message bases. There is a way to avoid this bug. I just posted it today. When you load an animated sprite simply reload the same image to replace the image the animated sprite uses. Pixel perfect.

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 19th Jul 2005 18:41 Edited at: 19th Jul 2005 18:41
@Grog - nice find! Fixes it perfectly. Now all that's needed is for TGC to fix CREATE ANIMATED SPRITE to to what it used to and do the ,1 texture flag automatically. Animated Sprite command has been 'fixed' and broken and virtually every patch. Surely they can get it right next time...


OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 19th Jul 2005 18:57
We can but dream

Vote For AtomZ - You know it makes senze
http://spaces.msn.com/members/BouncyBrick/
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Jul 2005 08:33 Edited at: 20th Jul 2005 08:36
NP I thought it was normal till I saw this message. I just hope TGC isn't slow about fixing it now that they know there's a way around the bug.
Dejunai
18
Years of Service
User Offline
Joined: 19th Jul 2005
Location: Mentally: Manhattan; Physically: LA -doh
Posted: 20th Jul 2005 11:23
Quote Grog:
reload the same image to replace the image the animated sprite uses
End Quote

This does not seem to work for me...
How I wish it did.... ~shrug~
Reloading the image does lessen the effect,
allowing more cuts before the frames are worthless...

The more you slice up the sprite the worse it gets to the
point of actually flipping and even mirroring the frame
without reason.

I know this is extreme, but I was hoping to use a
sprite that was 32 across and 150 down...4800 Frames
is extreme, I know...

The effect is more dramatic when the DOWN slice increases,
I changed the above parameters to 480 accross by 10 down...
The distortion was still evident, but nearly as dramtic.

On another note, the majority of posts related to this issue,
seem to be people trying to use the "create animated sprite"
as a fast "paste image" while loading only one image...
Such as a bitmapped font set. Or a tile set... ( as I am )...

Perhaps TGC could consider an independent command for such
uses, that was free of any extranious animation code...
Just a thought...

================
-Dejunai
================
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 20th Jul 2005 18:44
I don't know what the relevance is, however, I noticed this with my latest compo entry...

When I compile the game on my dev machine, I get pixel-perfect animated sprites every time, no matter what I do ( excellent! )

When I compile the game on this ( Internet capable ) machine, I get blurry sprites every time ( haven't tried the reload trick, though ).

As far as I know, the installations of DBP and DX are identical ( I installed them at the same time )... Any idea's?

Specs of Dev Machine;
DX: 9.0c ( 4.09.0000.0904 )
DBP: 1.058

Internet Machine;
DX: 9.0c ( 4.09.0000.0904 )
DBP 1.058

All the other specs are meaningless, as the same effect happens for the exe's no matter what the computer they are run on.

Any idea's?

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 21st Jul 2005 04:42 Edited at: 21st Jul 2005 06:02
Dejunai, I did a few experiments (after reading your message). First I made an animation with 1600 frames and it worked great. Then I went way over your number of frames at 9600 frames and the whole image was distorted (even frame 1). It appears the greater the number of frames the more likely the whole image is distorted.

You might have to bite the bullet and split up your frames till this is fixed. :-(

And do something like this:



I would upload the image but it's 42 megs. ( 1249x11706 )

I seriously doubt TGC thought this command would be used in these extremes.

Edit: More experimentation reveals that pixel perfect sprite animation is still achieved around 3360 frames. That's using a frame that's 40x40 with 32x105 images. The file is 5 megs. I have no idea if frame size effects pixel perfection or not.

JessTicular, I have no idea... that's a weird one.
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 21st Jul 2005 05:41
Quote: "When I compile the game on my dev machine, I get pixel-perfect animated sprites every time, no matter what I do ( excellent! )

When I compile the game on this ( Internet capable ) machine, I get blurry sprites every time ( haven't tried the reload trick, though )."

Odd - are the GPU's different ?

Vote For AtomZ - You know it makes senze
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 21st Jul 2005 21:53
Yeah, they are;

Dev; GeForce FX5200
Other; Crappy MMX440 or something stupid like that

But, the thing is, if I compile it on this machine, then take it to my Dev machine, that exe still get's crappy results for the sprites...

If I compile it on my Dev machine, and bring that exe to this machine, it still looks pixel perfect...

So, I don't think it's the different GPU's? Unless something extra is compiled into the exe other than DX calls?

I dunno... It's odd

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
The Big Babou
21
Years of Service
User Offline
Joined: 10th Feb 2003
Location: Cyberspace
Posted: 22nd Jul 2005 22:04
As they are both nVidia cards, do they use the same driver? Or preferably the latest drivers.

... they call it a royale with cheese ...
Dejunai
18
Years of Service
User Offline
Joined: 19th Jul 2005
Location: Mentally: Manhattan; Physically: LA -doh
Posted: 25th Jul 2005 07:37
Hey All

@Grog, thanks for the advice,

Well I have been doing some experimenting too...
And just for the record, I have a 1000 tile screen...
Since the animated sprite solution wasn't really working,
I decided to just chop up a bitmap as needed and "paste image"
but of course you can't nominally check for "image exist"...
So I faked a poor mans version of it,
and everytime I made an image, I also made a bitmap
with the exact same imageNUM,
the bitmap was created as a 1x1 to avoid any memory issues...
Now I can check for "bitmap exist()" and know if the
image exists...
( Of course then I found the TPC DLL by the generous IanM,
and can now check for "image exist()" )

But I still wanted to compare the speeds of sprites to images...
Being new to the language and its quirks... And finding no
real consencus in the forums...

So I hacked up my 150x32 frame tile set...
in to [15] 10x32 sets... and made 15 animated sprites...

Everything worked perfectly and man-o-man...
sprites are turbo charged... then I made some adjustments...
and the sprites were blurry again... more adjustments...
they are pixel perfect, more and they are blurry...
it's not an on then off then on either...
Its just flat out random.... and the tiles are 8x8
which was reported to not be affected, power of 2 and square...
but alas they are ( grr randomly )...
I am using the reload image trick, and I have played with
the "set sprite" options... and the load image transparency flag...
There is just no solid way to defeat the blur...

just my continuing 2 cents...

================
-Dejunai
================
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Jul 2005 05:54
The animate sprite command is really messed up. TGC have a lot of work on their hands tracking down this bug.

Dejunai, maybe you should upload your code and media to them so they can see how bugged it can get. Can you post some screen captures of your experiments?
pizzaman
20
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 26th Jul 2005 11:20 Edited at: 26th Jul 2005 11:21
I've been playing around with this command too. What I found is the image used is scaled to the next highest power of 2 (if your not using a power of 2 size), then the images to be used of cut out of this image at a larger size than normal. After this, the cut images are scaled back down to the size it was meant to be cut out at and displayed in the animated sprite.

Heres the example program I used to determine this


In the download box is the source, project and image files used in the program.

Dejunai
18
Years of Service
User Offline
Joined: 19th Jul 2005
Location: Mentally: Manhattan; Physically: LA -doh
Posted: 27th Jul 2005 01:51 Edited at: 27th Jul 2005 02:19
@pizzaman That's it!!!

I was hearing power of two, and thinking the CUTZ need to be
power of two... But NO, the original IMAGE needs to be power
of two... Woot! Woot! Woot... Gonna go try it now...

@Grog

My experiments went sloppy at somepoint, I'll clean a few up
and post them...

Edit :
Damn, No Go...
creating tile sets of 256x256 cutting at 32 across and 32 down...
To make [1024] 8x8 tiles, has no affect... still blurry...
I thought we had it...

================
-Dejunai
================
DarkPhear
20
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Brazil
Posted: 27th Jul 2005 06:07
Argh. This bug is bothering me since the first day of DBP. Sadly they have already fixed it and broken it again a couple of times.

Download free games and demos at my page: http://darkphear.cjb.net
MultiJoy Plugin : use multiple joysticks / joypads in your program.http://darkphear.cjb.net
Dejunai
18
Years of Service
User Offline
Joined: 19th Jul 2005
Location: Mentally: Manhattan; Physically: LA -doh
Posted: 27th Jul 2005 06:56
Well here is a demo...
You can see even with slice across and slice down set to "1"
there is distortion...

When you run it,
it displays the original image for a second,
then the pieced together sprite...

The KEYCONTROLS are:
SPACEKEY = refresh current pattern
UPKEY = increase slices Y
DOWNKEY = decrease slices Y
LEFTKEY = decrease slices X
RIGHTKEY = increase slices X

You can clearly see distortion at 1x1...
You can clearly see the distortion get worse as you
increase away from a power of two, and get better as you
approach a power of two... But even at a power of 2,
the distortion is clearly noticable.

My system is Windows 2000 SP4+
2GB system RAM, 3.2GHz Hyperthreaded, nVidia 6600 8xAGP

The code included in the download is :



Anyone who can improve upon this demonstration please do...
Comments welcome...
Fixes needed...

================
-Dejunai
================
pizzaman
20
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 27th Jul 2005 10:47 Edited at: 27th Jul 2005 10:47
I tested your code. When I ran the program from the exe file I noticed the distortion, however I noticed you used the trial version of DBP to compile the code. Thats the problem because I recompiled the source code with DBP 5.8 and there was no distortion at all.

However, there is still a bug in this command and I think its what I said before thats the problem.

Dejunai the download box is the recompiled version of your code if you want to check the results I get.

Dejunai
18
Years of Service
User Offline
Joined: 19th Jul 2005
Location: Mentally: Manhattan; Physically: LA -doh
Posted: 27th Jul 2005 22:49
@pizzaman

Thanks You Very Much... I hope it is the trial and the
trial only, ( not differences in our machines ala JessTicular )...

I ran your EXE, and it was clearly less distorted, near perfect.
But it did have one nagging issue, the image when displayed
as a sprite appeared shifted to the right by some noticable amount.
Also the first tile at 0,0 appeared correct, 0,1 and 1,0 did not.
The rest of the tiles were aligned to the 0,1 tile...

Of course all this goes to prove is what we already know:
the command is bugged. Does any one following this topic have
ANY working a demo of a working workaround... I certainly like to
see it posted. I'd like it to include a compiled EXE and the source,
if you compile it on a full version. So I can tell if there is
a significant / consistent issue with the trial version.

I'll be honest, I doubt I'll buy this product at the end of my
Trial period, unless I can find a solution to this issue. My
current process with past image, is fine... but pasteing frames
of the sprite, is still near 20 to 30 times faster. And I want
that speed for under the hood calculations later.

Thanks Again...

================
-Dejunai
================
pizzaman
20
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 28th Jul 2005 10:53 Edited at: 29th Jul 2005 05:45
@ Dejunai

I tried the recompiled exe of your source code and I didn't see any shift, also the image was pixel perfect so I don't know whats going on with it shifting to the right.

Theres 2 work arounds for the moment, one is to reload the image used for the create animated sprite command, the other is keep to a power of 2 size - but you've had problems with that.

The download contains both workarounds in action, therefore the numbers should not be blurry if the workarounds work. Note the sizes of the animated sprites will be different due to how the images are structured, also the numbers are drawn slightly different for each image.

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Jul 2005 01:13
Quote: "I'll be honest, I doubt I'll buy this product at the end of my Trial period, unless I can find a solution to this issue. My
current process with past image, is fine... but pasteing frames
of the sprite, is still near 20 to 30 times faster. And I want
that speed for under the hood calculations later."


Even though I bought Darkbasic Pro not knowing that it had this bug it is still worth the cost. As with all programming languages there are always bugs that pop up. Because we know about this bug TGC will fix it eventually. Do you throw away your car if it gets a dent?... no... Darkbasic Pro is no different.
Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 1st Oct 2005 23:45
Two changes have been made for upgrade 5.9 -

* the image for animated sprite will now use the 1 texture flag by default

* the command will no longer crash if an invalid image has been used

Tested several examples and not yet seen the blurry effect that has been talked about previously.

Login to post a reply

Server time is: 2024-04-20 14:36:27
Your offset time is: 2024-04-20 14:36:27