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.

2D All the way! / 2D sprite problems

Author
Message
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 10th Nov 2005 23:14
Sorry for the n00b questions but I'm stuck.
I am rendering a short animation in 3DS max to use as a 2D sprite animation in my game. I export it as a jpeg with a light green background and then load it as an animation in Macromedia fireworks, taking out the green frame by frame. I then save it as an animated gif with index transparency. Is this the best way to have it? It seems like DBPro doesn't support gifs, but I don't know how else to save it to maintain animation and transparency! So far when I've played around with the code, it doesn't move and/or doesn't utilize transparency. Help! What is the simplest way to accomplish this? Thanks!

coming soon.... sorry mods
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 11th Nov 2005 00:25 Edited at: 11th Nov 2005 00:29
First, DbPro doesn't support .gif.
You should do a sheet of the character with its approtpiated frames of animation, then load each image and the , either manualy change the image the sprite has so to acomplish the animation, or use the play sprite command. The problem with the play sprite command is that all frames have to be of exact size.

The transparency is worked out in DbPro. Check the set image colorkey for more reference. You define what color will be transparent. Have in mind you MUST do this before loading the images, else it won't do it.

Here's an example of how to do the sheet...

Oh , and save it as a png because jpg format changes somewhat the image...
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 11th Nov 2005 02:46
hmmmm... that kinda blows.
is there a reason DbPro doesn't support gifs?
and what program can I use to make that sheet thing without just copying and pasting?
and then I'm gonna use:
set image colorkey (0,0,0) for black
load image "image.png",1
create animated sprite (whatever the parameters are....)
play sprite
?
that'll loop it forever? is there a way to make a sprite like one character but have different animations appear based on the key without making a new sprite every time? and is there a way to make a sprite wait until the end of its animation before it goes to a different one?
thanks for the help!

coming soon.... sorry mods
BlinkOk
22
Years of Service
User Offline
Joined: 22nd Oct 2003
Location:
Posted: 11th Nov 2005 03:38 Edited at: 11th Nov 2005 03:50
here's an example, you use play srite to animate the sprite. you have total control over which frames are displayed using set sprite frame. you can also make it loop through a particular range of frames by changing the values of the play sprite command
(images are attached)

P4 2.8Ghz, 2Gb, 128Mb Radeon Pro, Dark Basic PRO
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 11th Nov 2005 03:48
I don't know that much about play sprite command , as i had to build my own set of sprite animation in order to work with my game's main idea.

Quote: "is there a way to make a sprite like one character but have different animations appear based on the key without making a new sprite every time?"


er... you don't have to change between sprites to have the animation going, just change the image set to the specific sprite. Such as....



...that is a very simple (and somewhat stupid way of using it).

Quote: "there a way to make a sprite wait until the end of its animation before it goes to a different one?
"
yes, and that is by setting either a timer(i don't recomend that), or making images appear every time a certain period of time is met.

Now, why doesn't DbPro support .gif?, beats me, maybe its because some stuff in it's code can't be decoded or maybe it just has to do with law stuff, but i practically have no idea.

Quote: "and what program can I use to make that sheet thing without just copying and pasting?
"
one word... Paint (MSPaint, the one that comes along with windows)
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 11th Nov 2005 04:26
oh man, that code was way above me blink but I'll try to figure it all out tomorrow, thanks.

and zergei, I don't understand what you mean by making images appear every time a certain period of time is meant...
I also don't understand how paint helps me... I open up an animated gif and it just shows me the first frame... I wanna open up an animation and the program to make it all into one big pic for me... like Adobe Premiere's filmstrip export....
I don't really understand most of this so far, but I guess as I see some progress and play around with it and get the basics to work, I can worry more about the complex things....
thanks for all the help!

also, 3ds max backgrounds have RGB values plus saturation and some other settings... do I have to worry about those, or does only the RGB value matter? also, what is a good color to use?

coming soon.... sorry mods
BlinkOk
22
Years of Service
User Offline
Joined: 22nd Oct 2003
Location:
Posted: 11th Nov 2005 05:09
if your paint program supports .png transparency then you can export the images as 32bit .png with alpha. then the transparent color won't matter. i think most people will use black or pure blue though

P4 2.8Ghz, 2Gb, 128Mb Radeon Pro, Dark Basic PRO
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 11th Nov 2005 07:32
no, the point was I need a program that takes an animated file and turns it into a really high-res file with all the frames layed out next to each other in sequence so I can use them in DBPro...
look at Zergei's first post for an example.

coming soon.... sorry mods
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 11th Nov 2005 13:31 Edited at: 11th Nov 2005 13:32
Ok, i can't recall any program i used doing that, but Div2 GamesStudio had some sort of advanced paint or something built in it that allowed you to do what you want. Thing is that it only works in MSDOS, so having XP won't run.
Now i ask, whats the problem for doing it manually?, i meant to say paint because its easy to use and if you work with pixel images, then it comes right allong, however, if you wish to work the same but with more detailed pictures, use photoshop at some point.

By the time thing i meantioned earlier i was just giving an example of my timing settings on my "game". Basically, between certain frames there has to be a certain amount of time met before changing. So to give an example.... Zero running has a delay between frames of 0.200, but in its stand sequence he has a delay of 0.150 and in 2 specific frames a 0.075 delay. Of course this delay depends on how you set the sync command, but it also comes in handy to know.

Quote: "also, 3ds max backgrounds have RGB values plus saturation and some other settings... do I have to worry about those, or does only the RGB value matter? also, what is a good color to use?"

in a pic, rgb is all that matters. Are you stating here that your images come from a 3d model? Just asking...
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Nov 2005 19:51
Quote: "no, the point was I need a program that takes an animated file and turns it into a really high-res file with all the frames layed out next to each other in sequence so I can use them in DBPro...
look at Zergei's first post for an example."


I use a program called Animation Shop. It's made by the same people who made Paint Shop Pro. It's rather primitive though... but it does have the ability to load a .gif animation with each frame as a separate image.

Here you can download a trial version:
http://www.corel.com/servlet/Satellite?pagename=Corel3/Products/Display&pid=1047024390003
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 11th Nov 2005 20:27
I actually remembered I have it and tried it out today, it worked but I could only get it to make the sheet one long row of pics, and for some reason when I loaded the animation into DBPro it looked incredibly low-res, as if DBPro was taking the imported sheet and making it really small, then taking each frame and blowing it up - each frame is over 300 x 300 and that's how big I'm displaying it, so it should look sharp...
And how would I even do it manually? Open up each frame, copy it, and try to line them all up on a big image? That would take hours!

Also, how do I get the transparencies to work best? I don't want the stupid light line around the non-transparent parts - how should I set the magic wand tool? anti-aliasing, hard, feather, tolerance, what?

And yes, I am using 3ds max to make the images. Do I want anti-aliasing on here or not to make the transparency work well?

Thanks.

coming soon.... sorry mods
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 12th Nov 2005 02:05
If the image is smaller the size you want making it bigger isn't going to make the image look sharp. I use that program and Paint Shop Pro together. I just copy the frame in Animation Shop and copy it into a big image in Paint Shop Pro. Add the images in a line till all the frames are in the big image. Then save the image as a bmp. All you need is black (0,0,0) as the background color to be transparent... if you want to be fancy you can use pngs that support multiple transparencies.
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 12th Nov 2005 02:42
no no no.... animation shop does it automatically. you just open up an animation and go export - tube or whatever and open that in psp and it is there...

here's my situation:
i render the animation in 3ds max at size 640*480 as jpegs
I open them all up in fireworks as an animation and save it as a gif after taking out the background.
i open the gif in animation shop and save it as a tube.
i open that in paint shop pro and save it as a png.
the png is like 8400*480 and when I load it in dbpro and say
create animated sprite 1,29,1,1 or whatever (sprite#,columns,rows,image#) it shows up very blurry even though as a png it is very sharp... what is the problem? the transparency works, though. that's progress.

coming soon.... sorry mods
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 12th Nov 2005 03:20
Another thing, when using the get image or the load image command, remeber to add a last ,1 if your pic is pixel perfect, or something, 'cause if not it will blurr the image.

About the allignment stuff, well i spent some time working on it. I also made a little program that will automatically ripp images of a pre-setted character sheet, and then lets you adjust the allignment for each of them. Yes, it takes time. After that you can save in 2 .dat files info. One contains the coordinates of where to grab the images from the sheet, and the other one has the offset values for each frame. So when in the game, i just load them to an array and make sure i add those values to the sprite, acordingly to the frame wich is showing (wich it's not as dificult as it sounds).

Now if what you where talking about has nothing to do whith this, then have in mind someday you might need it.
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 12th Nov 2005 05:31
Quote: "remeber to add a last ,1 if your pic is pixel perfect, or something, 'cause if not it will blurr the image."


what does the last 1 represent? and does that apply to create animated sprite also? does dbpro have a max image size, so it is scaling down and then enlarging my image again? i mean, my image looks really bad.... what could be the problem?

coming soon.... sorry mods
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 12th Nov 2005 14:44
Right now i can't remember what it means, i just now that adding it will disable some blur effect or something in the pic.
Why don't you show us some pics about the image your having problems with. Show how it looks in DbPro and in another program, so we now better where the mess is....
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 13th Nov 2005 05:15
here it is the best I have gotten it to look in DBPro...

and here it is as an image file...


any ideas? as I change the size of the original the blurriness changes...

coming soon.... sorry mods
MiR
22
Years of Service
User Offline
Joined: 13th Jul 2003
Location: Spain
Posted: 13th Nov 2005 10:03
Probably a dumb response as I haven´t read the rest of the posts but you have dsable mipmapping for the image right?

My signature has been erased by me because it's LARGE.
Thank you for the votez!1!
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 13th Nov 2005 14:17
Quote: "Probably a dumb response as I haven´t read the rest of the posts but you have dsable mipmapping for the image right?
"


Thats what the ",1" at the end does...
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 14th Nov 2005 02:38
hmmm i'll go play around with it some more tomorrow.... I can't remember if I actually got around to trying that but I'll keep you posted, feel free to leave me some more tips of that nature.

coming soon.... sorry mods
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 15th Nov 2005 02:45
I rebuilt the whole thing and still no luck. I saved it all as a zip so you can see it that way. I could be wrong, but it seems like it looks a TINY bit better if I make the animation 2 rows instead of 1 - but that doesn't make any sense. Each frame is still the same size.
In the code it has the .png loaded, but I included the .jpg as well. I can't get any transparency with the png but I can get terrible transparency with the jpg. See what you can do with it.

coming soon.... sorry mods
BlinkOk
22
Years of Service
User Offline
Joined: 22nd Oct 2003
Location:
Posted: 15th Nov 2005 04:02
i think the image is just too big for a sprite. i recommend having separate images and then just pasting them in sequence. i tried it and it looks ok.
ps: i can't believe 3dsmax doesnt export .png with transparency. you could export those images straight outta 3dsmax with transparency then use load image to load the images in separatly and then paste them in sequence

P4 2.8Ghz, 2Gb, 128Mb Radeon Pro, Dark Basic PRO
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Nov 2005 04:22 Edited at: 15th Nov 2005 04:25
Quote: "I rebuilt the whole thing and still no luck. I saved it all as a zip so you can see it that way. I could be wrong, but it seems like it looks a TINY bit better if I make the animation 2 rows instead of 1 - but that doesn't make any sense. Each frame is still the same size."


Edit: BlinkOk posted while I was experimenting.

I experimented a little with your images... it looks like it's just too big for "create animated sprite" to handle... it may even be a bug in the latest update of Pro. I took it down to 5 frames and it looked less pixelated. Maybe you should try to avoid using "create animated sprite" and do it the hard way. Load 22 images for each frame of animation and just change the image used in the sprite command.

Quote: "In the code it has the .png loaded, but I included the .jpg as well. I can't get any transparency with the png but I can get terrible transparency with the jpg. See what you can do with it."


Jpgs don't save the colors exactly the way it was made... as a result you see only certain areas as transparent (only the areas that are still true black).

I'm attaching the png changed to a transparent background... the character needs to be redone as the black areas of the character aren't there anymore.
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 15th Nov 2005 14:28
Hey, i noticed, that you have useless frames there. I mean just look at it, you can easily see how the first half of the animation is once again done but the other way around. Its like doing "3-2-1-0-1-2-3" , when you could simply just do "3-2-1-0".
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 15th Nov 2005 21:58
alright, i'll try that all out.
can you explain the loading each image "hard way"?
and zergei, the ending is timed differently than the first, I believe, but you were almost right.
I'll look into 3dsmax exporting pngs with transparency... i know it can do quicktime movies...
any idea what a max size is? or who i can ask to find out?

coming soon.... sorry mods
BlinkOk
22
Years of Service
User Offline
Joined: 22nd Oct 2003
Location:
Posted: 15th Nov 2005 23:24
in general sprites are pretty small but by any standard that is one huge image (the sprite sheet). i have has similar problems in the past with smaller image sizes but i'm not sure wht the maximum size is.
the attached code is what i used to display your animation. the files were named g0001.png, g0002.png...

P4 2.8Ghz, 2Gb, 128Mb Radeon Pro, Dark Basic PRO
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Nov 2005 00:00
Quote: "can you explain the loading each image "hard way"?"


Instead of having one huge file with all the frames... make each frame a seperate file. Load all the images... then when you want to animate it change the sprite image with a variable.



I attached a zip to this message with 5 of your frames (in png format) with the above code.
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 16th Nov 2005 02:38
oh man that sucks.... i mean, is this really the best it gets? i'm gonna track down some tech support to find the max size... or just give up. well, I guess you can make that whole thing a function and kinda treat it like a sprite? because I can't really see that being realistic tring to use collision detection and movement and tons of sprites... is this how most 2d db games are made!?

coming soon.... sorry mods
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 16th Nov 2005 03:21
Quote: "because I can't really see that being realistic tring to use collision detection and movement and tons of sprites"


Woho, wait a sec, im confused with your way of understanding something... (or it may be just me)

As i understand, you think you are using tons of sprites for the same "character" (lets say), when your not. Your using the same sprite (sprite 1 for example), you just change the image the sprite is supposed to show. (say,... sprite 1--> show pic number 1 (10 sec later) sprite 1--> now show image number 2).

Now if i misunderstood everything... well, it wouldn't be the first time...
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 16th Nov 2005 03:44
Since sprites are hardware accelerated in DBPRO under dx9, the onus of the rendering falls directly on top of what your video cards actually supports. If it doesn't support loading images of that size, the frames will be scaled to an acceptable range (rather than just fail). I suspect that's what occurring with your animation here.

Also, while i'd say the majority of the modern (and semi) cards support larger none square textures, it's possible that many still don't. So i'd be generating your frames in a square format to begin with. Like 512x*512y. Just smaller you can make the frames the easier it's going to be on memory.

Kevin Picone
[url]www.underwaredesign.com[/url]
Play Nice!Play Basic (Release V1.089 Out Now)- Play Extreme with Play Basic FX {TBA}
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 17th Nov 2005 02:51
so if all of you make 2d games, how do you personally make your animated sprites? do you really just copy each frame and try to paste it and line it up on one big document?
and there are a bunch of characters in this game.... but will collision detection work well if I'm using single images like this? it won't slow down the game a lot since it has to check every frame along with everything else that is going on?
and can a sprite be treated like a single image? i mean, do i get to tell the sprite to move in general w/o worrying about what images it is showing?

coming soon.... sorry mods
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 17th Nov 2005 03:46 Edited at: 17th Nov 2005 03:48
Quote: "do you really just copy each frame and try to paste it and line it up on one big document?
"

I have all the character sheet in one document (individualy), and the lining up thing i worked it out trhought another program i did, in which one can allign it there, save in a .dat file the offset values, and then use those values in the main game.

Quote: "but will collision detection work well if I'm using single images like this? it won't slow down the game a lot since it has to check every frame along with everything else that is going on?"


Well, that really depends on how skilled you are.

Quote: "and can a sprite be treated like a single image? i mean, do i get to tell the sprite to move in general w/o worrying about what images it is showing?
"


Actually, the sprite command is quite much what your asking for, and yes, you can move the sprite whithout changing its image.


I'm willing to give ya my recently started project of Zero, but it may confuse you my way of working things out.... still, you may get an idea of what it does. It still doesn't work collision, but does the image, timing and movement stuff, thought in a very primitive way.
kombucha
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: n00b-land
Posted: 17th Nov 2005 04:43
well obviously my skills are very low and this is starting to sound like much more trouble than it was worth (i was doing this just to get the hang of the language) so maybe I'll just give up.

any chance you are gonna share that aligning program of yours? does it work well or is it hard to use?

but really, this might not be worth the bother. i've had too many 2d problems, too many 3d problems, and no game in mind, so I guess this is all kinda pointless. we'll see what tech support has to say tomorrow.

coming soon.... sorry mods
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Nov 2005 05:12
Quote: "so if all of you make 2d games, how do you personally make your animated sprites? do you really just copy each frame and try to paste it and line it up on one big document?"


That sounds about right for those of us that aren't artists (including myself).

Quote: "and there are a bunch of characters in this game.... but will collision detection work well if I'm using single images like this? it won't slow down the game a lot since it has to check every frame along with everything else that is going on?
and can a sprite be treated like a single image?"


Yeah. Using a sprite and changing the image the sprite uses is the way it was done before the "create animated sprite" command. Using that method is just as good as an animated sprite would be. I'm guessing the only reason why we can make animated sprites is because TGC wanted to make it easier for us... rather than using the "hard way" all the time. Unfortunately your sprites seem to be hitting the size limits of the command (it could be a bug though).

Quote: "i mean, do i get to tell the sprite to move in general w/o worrying about what images it is showing?"


If you ran the code I provided you'd notice that the sprite moves to the mouse... and it animates the whole time it's moving. It also has a timer to change the image so it doesn't change at every loop (basically the same as the timer at the end of the "play sprite" command).
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Nov 2005 05:16
Quote: "well obviously my skills are very low and this is starting to sound like much more trouble than it was worth (i was doing this just to get the hang of the language) so maybe I'll just give up.
"


Giving up is a sure-fire way to not learn anything from this. Consider the "hard way" a workaround. Exactly how do you think people make animated sprites in Classic?... answer... the "hard way"... it's the only way they can.
Reaperman
22
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Kent, England
Posted: 17th Nov 2005 15:55
kombucha:

I took a look at the picture you posted and the problem is that your antialising your sprite. Notice the green tint around the composite edge? That’s because the computer smoothed out the edge of the man with the green background.

You need to switch that off in your modelling package before you save the picture of the man.

Also when you asked “what does the last 1 represent?” what it tells the computer to do is to preserve the image exactly as you created it. In other words, if you don’t use the 1 then your image will not look as good.

Hope this helps you.

Cheers
Reaperman

Login to post a reply

Server time is: 2026-07-06 20:50:20
Your offset time is: 2026-07-06 20:50:20