Trying to find a way to import GIFs into AGS – Desperate.

This is a public forum, where you can find out everything you wanted to know about making games. Please don't use this forum as a place to recruit new members.

Moderators: adeyke, VampD3, eriqchang, Angelus3K

Post Reply
Message
Author
Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

Trying to find a way to import GIFs into AGS – Desperate.

#1 Post by Akril » Sat Sep 18, 2004 5:46 am

I have been working on a fangame for several years as of now. I have completed many backgrounds, animations and dialogue. With my more or less absent programming smarts, Adventure Game Studio seems like my only option for piecing this game together.

However, I just found out that AGS doesn't allow the importing of GIFs, animated or otherwise. The animations have to be broken apart into individual frames, adjusted so that they will be transparent in AGS, then imported, one frame at a time. This is a very big problem for me, since my game is very large, and it has numerous multi-frame animations. In one scene, I have a half dozen animations that have an average of 23 frames each. A single character's walk cycles, at six different angles, 9 frames each, total about 54.

I must be honest and admit that I nearly broke down crying when I realized that I had to import my animations in this tedious, menial way. Even using Animation Shop Pro, which numbers individual frames when it exports them, doesn't take the edge off the work. I just can't fathom spending hours at the computers, breaking up animations I so carefully made, going through every frame to specify a background color, and importing them one by one by one.

I've had to drop a few features from this project so far. After asking many people whether there was an easy-to-use, 2D lip-sync tool out there and finding nothing that fit my needs, I decided to drop lip-syncing, except in the cutscenes. It was a bit painful, but I had no other choice. I truly do not want something similar to happen with AGS now. With limits like this, I would most likely begin crushing my most pleasing ideas before they even were made real (“No, no, I can't make that animation. Too many frames to import. I'll just erase the sprite and have the dialogue box say he disappeared in a spectacular cloud of smoke. Too much work to animate”). I'm afraid that my four years of work might have ground to a halt because of a limitation of the only game engine I can use.

There has to be some way to import animated GIFs into AGS. The add-ons on this page seemed promising at first, but I couldn't find anything that resembled a GIF import tool. I'm a little hesitant to inquire about this on the AGS message board, since I'm afraid of just getting brushed off with a “You can't do that, import the frames one at a time like everybody else” reply. Does anyone here know of a add-on or plug-in that allows GIFs to be imported into AGS, or where I should look for such a thing?

Thank you very much,


Akril

Erpy
Forum Administrator
Posts: 11434
Joined: Tue Sep 25, 2001 8:28 pm
Location: The Netherlands

#2 Post by Erpy » Sat Sep 18, 2004 8:38 am

I'm afraid of just getting brushed off with a “You can't do that, import the frames one at a time like everybody else”
Nobody does that anymore by now. Trust me. :)

Here's what to do.

1) Open your gif in animation shop. Select all frames and save them as bmp's.

2) Go to AGS and open the target folder in the sprite manager. Right-click on the right section where the sprites are stored and select "Quick import multiple sprites". In the window that appears, select the first bmp, hold down shift and use the arrows to select all bmp-files. Click open. AGS will mass-import them for you.

3) In order to add them to loops, go to the "views"-section and create a new view. Select all the sprites of a certain direction and right-click. Click on "assign to view". In the window that appears, select the view you just created. Select the loop you want them to be assigned to. (they'll be assigned in the order they're listed in the sprite manager) Click OK after picking your favourite settings.

Presto! No need for any GIF-plugins or whatever.
The animations have to be broken apart into individual frames, adjusted so that they will be transparent in AGS, then imported, one frame at a time. This is a very big problem for me, since my game is very large, and it has numerous multi-frame animations. In one scene, I have a half dozen animations that have an average of 23 frames each. A single character's walk cycles, at six different angles, 9 frames each, total about 54.
Most of the time, AGS determines the transparent color by taking the pixel in upper-left corner of the sprite. (this can be changed, but this setting will be applied to all mass-imported frames) So simply make certain there's a pixel of the transparent color in one of the corner on all the sprites. AGS anchors characters at the bottom, so adding a row of transparent pixels to the top won't influence the way the characters are displayed.

Image

Alias
Royal Vizier Status
Posts: 1614
Joined: Sat Aug 28, 2004 11:08 pm

#3 Post by Alias » Sun Sep 19, 2004 8:17 pm

Theres a new AGS beta thats supports animated GIF's and GIF backgrounds. I cant remeber the link but have a look at the AGS site. :D

Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

#4 Post by Akril » Sat Sep 25, 2004 3:32 am

Rog, I think you've just solved a problem that has caused me much anguish these past few months. Thank you so much.

Now I'll have a lot more free time to deal with all the other hair-pulling problems AGS gives me...I can't even figure out how to animate background objects... :( And I'm afraid even threads like this don't make the waters any less muddy.


Akril

Erpy
Forum Administrator
Posts: 11434
Joined: Tue Sep 25, 2001 8:28 pm
Location: The Netherlands

#5 Post by Erpy » Sat Sep 25, 2004 10:15 am

Let's assume you want to create a flowing waterfall. Let's assume there's 4 frames of animations.

1) Import these 4 frames into the sprite manager.

2) Create a new view in the "views"-section.

3) Assign the 4 sprites to this view. (either by double-clicking the black text in a view and select the sprite or select the sprites in the sprite manager and use the "assign sprites to view" from the right-click menu)

Let's assume the view you put them in is view 2 and you've put the frames in loop 0 of that view.

4) Go to the room the waterfall needs to be placed in and create a new object. Click the "change object graphic" button, select the first frame of the waterfall animation and then drag the object to the right place. Let's assume that this is object 3 in the room.

5) In the room-section, click the I-button (for interactions) and right-click the "enter room (before fadein)" section. Add an interaction called "run script". Type the following code in the script:

Code: Select all

SetObjectFrame(3,2,0,0);//this sets object 3 to the first frame of loop 0 in view 2.

AnimateObject(3,0,1,1);//this animates object 3 by running loop 0 with speed 1. The last 1 means the animation keeps repeating.
Image

Alias
Royal Vizier Status
Posts: 1614
Joined: Sat Aug 28, 2004 11:08 pm

#6 Post by Alias » Sat Sep 25, 2004 1:52 pm

Your Welcome Akril. ;) :D

User avatar
Fribbi
The Icelandic Guest
Posts: 1696
Joined: Thu Aug 09, 2001 7:49 pm

#7 Post by Fribbi » Sat Sep 25, 2004 3:03 pm

Theres a new AGS beta thats supports animated GIF's and GIF backgrounds. I cant remeber the link but have a look at the AGS site.
And here it is. You are welcome.

http://www.agsforums.com/yabb/index.php?topic=15375.0

Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

#8 Post by Akril » Sun Sep 26, 2004 5:54 am

I already downloaded the new version after Rog informed me of its existance, but thanks anyway, Fribbi.

And Erpy, I'm afraid even that simple bit of scripting isn't working for me.

I've been trying to loop an object in View 2, Loop 12. I place the object where I want it in the room, go to the room's interactions panel, create a "Run Script" action under Player enters screen, paste the code you provided me with in the script, adjust the numbers so that they read:

SetObjectFrame(0,2,12,0);//

AnimateObject(0,12,1,1);//


Then I test the game, the game crashes and I get the message "Error: AnimateObject: object has not been assigned a view." I've gotten this same message before when I tried using a different code from another source. What am I doing wrong?

Also, the pictures I'm using for BGs in this game are 480x360. Doubling their dimensions at a screen resolution of 1024x768 gives me an image that seems to be a perfect fit for that resolution, but whenever I test the game, the game is either huge (so large that only part of it is visible) or small and cramped up in the right corner. Why aren't the dimensions of the in-game background consistant with the dimensions of the actual background?


Akril

dreammaster
Royal Servant Status
Posts: 97
Joined: Fri Aug 10, 2001 11:18 am

#9 Post by dreammaster » Sun Sep 26, 2004 8:26 am

SetObjectFrame simply sets the active graphic of an object to the specified view/frame/loop - it doesn't set the view of the object. If you want an object to be animated, use the SetObjectView method to first set the view for the object before you use the AnimateObject method.

navynuke04
Honorary AGD
Posts: 5378
Joined: Fri Sep 13, 2002 1:19 am
Location: US of A
Contact:

#10 Post by navynuke04 » Sun Sep 26, 2004 1:34 pm

I recommend using the SetObjectView and AnimateObject commands in the Before Fadein section to ensure that everything is going before the screen fades in.

Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

#11 Post by Akril » Mon Sep 27, 2004 2:47 am

I'm not entirely sure if I understood these instructions...

I edited the script so that it now reads:

// script for room: Player enters screen (after fadein)
SetObjectView(0,2);
AnimateObject(0,12,1,1);//


Again, I am trying to animate object 0 with loop 12 of View 2 so that it repeats. When I changed the script and tested the game again, I got the same error message. What am I doing wrong this time?


Akril

Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

#12 Post by Akril » Tue Oct 05, 2004 5:14 am

Sorry for being impatient, but does anyone have an answer for my questions? I wish I knew what I was doing wrong.

Akril

Erpy
Forum Administrator
Posts: 11434
Joined: Tue Sep 25, 2001 8:28 pm
Location: The Netherlands

#13 Post by Erpy » Tue Oct 05, 2004 6:57 am

I'm afraid I fail to see what's going wrong. Both options offered to you were syntactically correct. (Dreammaster, SetObjectFrame DOES set the view. It's more or less a more enhanced SetObjectView function that doesn't make the first frame of the view blink)

You could try it step by step, to see if the first command is carried out succesfully.

Put the "SetObjectFrame(object,view,loop,frame);" part in the "look at object"-interaction and the "AnimateObject(object,loop,delay,repeat);" in the "interact with object"-interaction.

When you start the game, click the eye on the object first and its sprite should change. (unless the frame you set the object to is identical to the sprite you assigned to the object in the editor) Then click the hand on the object and it should start animating. Consider this more or less a check to see where it goes wrong.

Image

bartonjo2
Knight Status
Posts: 367
Joined: Sun Apr 20, 2003 6:55 am
Location: Ferry Boat
Contact:

website

#14 Post by bartonjo2 » Tue Oct 05, 2004 10:17 pm

hey akril wuts your website?

dreammaster
Royal Servant Status
Posts: 97
Joined: Fri Aug 10, 2001 11:18 am

#15 Post by dreammaster » Wed Oct 06, 2004 12:09 am

Thanks for the correction Erpy. I guess I still have more to learn about AGS. :rollin

Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

#16 Post by Akril » Wed Oct 06, 2004 12:43 am

bartonjo: Do you mean what my webpage's address is? I have several. Did you have one in mind?

Erpy: Thanks for replying. I think I finally got it, it was an accident I made with the player character that was causing the problem.

Does anyone have an answer to my other question about the background dimensions?
The pictures I'm using for BGs in this game are 480x360. Doubling their dimensions at a screen resolution of 1024x768 gives me an image that seems to be a perfect fit for that resolution, but whenever I test the game, the game is either huge (so large that only part of it is visible) or small and cramped up in the right corner. Why aren't the dimensions of the in-game background consistant with the dimensions of the actual background?

Akril

bartonjo2
Knight Status
Posts: 367
Joined: Sun Apr 20, 2003 6:55 am
Location: Ferry Boat
Contact:

website

#17 Post by bartonjo2 » Wed Oct 06, 2004 1:03 am

any one of them is fine,

i think theres a button that fixes the picture to the background or stretches it, its worth looking up in the pretty health ags help file.

navynuke04
Honorary AGD
Posts: 5378
Joined: Fri Sep 13, 2002 1:19 am
Location: US of A
Contact:

#18 Post by navynuke04 » Wed Oct 06, 2004 1:28 am

When you first created the game, AGS asked you what dimensions you wanted to use. What did you select?

Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

#19 Post by Akril » Wed Oct 06, 2004 5:54 am

I'm using 800 by 600.

The only button I could find that stretches the BG is part of the runtime engine, and I can't seem to access that.


Akril

Akril
Royal Servant Status
Posts: 52
Joined: Mon Feb 04, 2002 8:08 am
Contact:

#20 Post by Akril » Mon Nov 22, 2004 6:59 am

Hello --

It's been more than a month and I haven't gotten an answer to my question about the inconsistant background sizes I've been encountering. Even though I'm still in a rut now and AGS has been causing me a lot of problems, I'd appreciate it if somebody could please give me a hand with this perdicament so I could have it out of my way, if nothing else.

Thanks,


Akril

Post Reply