Graphics, Characters, Text & Rooms

From Adventure Game Studio | Wiki
Jump to navigation Jump to search

Deleting characters (and other items)

Please refer to this entry.

Using 3D characters and backgrounds

Is it possible to use 3D characters/backgrounds in AGS?

AGS doesn't support 3D files itself, but you can, however, render all images as BMP files and import them into AGS that way. AGS is an Adventure Game Studio, made to fit the styles of the older Sierra/LEC games like King's Quest I-VII, Quest for Glory I-IV, and Monkey Island I-III; therefore, 3D files aren't supported natively and probably never will be. However, there is a 3D background module and plugin. There is also an Easy3D module. For realtime 3D support, try 3D Game Studio. It'll cost you a couple hundred dollars though!

For 3D characters, you may even try this plugin, but bear in mind that it's still in beta stage, and it current works only for the windows port.

Dithering and other mishaps in imported images

When I import my sprite/background image into AGS, it gets all screwed up! More specifically, it shows dithering (dots of colours instead of smooth gradients) where there were none before, and the colours are somehow...less detailed or plentiful. Help me!

Okay, okay, I'll help you. The most common circumstance in this case is that the image being imported was saved in high-colour (24-bit). There are usually two ways to reduce an image to 15-bit (what AGS uses): convert all colours that aren't in the predefined 16-bit palette into dithering gradients made up of colours that are, or convert them to the closest colour in the 15-bit palette. AGS uses the first method of conversion, thereby giving you the messy dithering effect, where you can clearly see the dots of colours going from one to the other. What you should instead do is convert your image down to 15-bit (or 32K/32,768 colours in Paint Shop Pro) and use the "preserve colours" or "nearest colour match" option available. This will convert your image to one that uses the predefined 15-bit palette and you will hardly notice the difference.

Starting from Version 2.6, AGS now supports 24- and 32-bit true-colour graphics natively. If you really want to keep the excellency of your killer graphics, you may try this new feature by changing the colour depth to 32-bit in the Palette tab of the Editor. Be warned that using true-colour graphics can increase filesize drastically and is more resource-hungry, so your game may run slowly on lower-end computers.

Error: "Cannot display message with extended character in SCI font."

Whenever I enter a conversation with a character in my game, AGS quits and gives me the error: "Cannot display message with extended character in SCI font." What does this mean??

Well, this means exactly what it says. You can't use an "extended character" in the SCI font. This means that the SCI font can only support 128 characters, whereas normal fonts support 256 and sometimes more. Therefore, foreign characters (letters with tildes, graves, accents, etc.) cannot be displayed unless they replace unused characters in the SCI font, like the dollar sign or a colon or other punctiation mark. If you look at the Fonts section in AGS, it will show you each and every character that can be displayed in that font. Even if you import a TTF font, it will still only support the first 128 characters (unless you use a translation, with which you can display up to 256 characters in the TTF set).

The solution? Simply replace that character (the letter, not the game persona) with another, similar letter, or simply remove it altogether.

Another problem could be that you are using the special ASCII quotes and/or apostrophes (i.e., “ ” ‘ ’ instead of " and '). Go through the string on the specified line and make absolutely sure that there are no special quotes or apostrophes.

The Digraphs and SpriteFonts modules allow characters beyond the 128 to be used, but also to be typed easily. Digraphs can also be used to replace something like "a/" with antoehr character that has been redrawn to look like an a with an acute accent.

Finally, check to make sure you are not displaying any blank strings. Might not be the problem, but it's worth checking. Also, the British Sterling Pound symbol is not supported, because it is not in the normal ASCII range. It might be on your keyboard (if you're in the U.K.), but it's not between ASCII 1 and 127.

Fixing oversized images

My images are too large/oversized! What do I do to fix them?

Are you using hi-res (640x400) mode for running your game? If you don't know, click on File, then Setup game... and check which checkbox is checked (wink). If it is in hi-res, then make sure that when you imported your sprites, that you had the "Import in 640x400 mode" checkbox selected. If you didn't and don't want to start over again, read the question below.

What to do if you imported a lot of images in the wrong resolution

Oh no! I've imported all of my sprites in the wrong resolution! I don't want to start from scratch and re-import them. What do I do?

For most cases, there is an easy way out. For this case, the only thing you need to do is, for each image, copy it to clipboard, then paste it back as the right resolution. First, right-click on the sprite. Choose Copy sprite to clipboard, the first item in the drop-down menu. Next, right-click on the same sprite, and choose the right resolution. It'll either be Overwrite with clipboard (320-res) or Overwrite with clipboard (640-res). These are 320x200 and 640x400 resolution, respectively. If your game is 320-res and you imported in 640-res, your sprite(s) will appear too large, and blocky/pixelated. If your game is 640-res and you imported in 320-res, they will be too small and maybe even barely visible.

Saving as 16-bit images in MS Paint

In MS Paint, there is no option to save as a 16-bit image. What now?

Not to fear. MS Paint does allow you to save as 24-bit. If you import 24-bit pictures in AGS, it will automatically convert it to 32K-colours. It might not look so good if you used a lot of colors. But since you can't really use colors you don't select yourself in MS Paint, this might not present much of a problem.

Addition note: since hi-colour graphics formats are not considered standard, AGSEdit may not even be able to import 15 or 16-bit image files, so even if your game's colour depth is hi-colour, it's advisible you save the images as 24 or 32-bit true-colour before importing.

Importing .CHA files from Photoshop/Paint to AGS

I saved my character's animation images as *.CHA files in MS Paint/PSP/PhotoShop, but they won't import into AGS. What did I do wrong?

The .CHA format is not just an image. AGS has the ability to export entire character animations, settings, and images into one file. The .CHA file format is used primarily for distributing entire character packages among AGSers, like on the RON (Reality On the Norm) web site here. To create your own characters, read the question below.

Creating your own characters

How on Earth do I create my own characters!?

  • Go to the 'Characters' pane of the editor.
  • Press the 'New Character..' button, enter a name in the popup box and click 'OK'.
  • At the top of the screen, give your character a Script name - this will create the Script-o-name, which is how the character will be refered to when you're scripting.
  • Congratulations! You've just made your own Character.

Now, the hard bit... The character you just created probably looks like the default character, Roger - he's not a bad looking chap, but a game full of him would be a bit much. So, you'll need to perform a little cosmetic surgery:

  • First, you'll need to create the frames for your character animation (e.g. walking and talking) in an art program of some sort. The Critics Lounge on the AGS forums has threads of recommendations for programs, as well as templates to help you with the animation.
  • Import your Sprites in to AGS, in the 'Sprite manager'. AGS can import graphics in .BMP, .GIF, .PCX, .PNG and .TGA formats. There are options to bulk import sprites, and to import all frames from an animated .GIF or .FLC animation file. Alpha channels are supported for .PNG and .TGA files, if your game is 32-bit colour.
  • Assign your imported sprites to a View. You can do this one at a time in the 'View' pane of the editor, or assign multiple sprites at once in the 'Sprite manager' - Select them, right-click and choose 'Assign to view...'. Views are Made up of Loops - sequences of sprites that animate the character when it's facing a cetain direction. Most Views will have 4 Loops, or 8 for diagonal movement, ordered like this:
  Loop 0 - down (towards screen)
  Loop 1 - left
  Loop 2 - right
  Loop 3 - up (away from screen)
  Loop 4 - diagonally down-right
  Loop 5 - diagonally up-right
  Loop 6 - diagonally down-left
  Loop 7 - diagonally up-left

(Diagonal movement isn't required, so if you don't have those sprites - just don't create those Loops.)

  • Go back to the 'Character' pane of the editor, and set your character to use the Views you just set up for it.

There are a lot of other options in the Character editor, which are explained in the manual.

Character speech problems; Creating talking views

I have a problem with my character's speech. OR, How do I create talking views for my character?

You create talking views almost the same way you create walking views. If your game will be in LucasArts-style (speech over character's head, character animates while talking), then the talking view should be frames of the entire character's body with just the mouth moving, or anything else you'd like (for example, Stan from Monkey Island 1, where his entire body moving when he talks). If your game will be in Sierra-style (speech beside a separate animation of the player's head or whatever), then the talking view should be frames of whatever you want to appear separately from the character's body. Then, once you create the frames, go to Views and create a new view and, if using LucasArts-style, you'll need one for each direction the character can face. Or, if you're using Sierra-style, then only one loop is required, as this will play no matter what direction the character is facing. Then, select the view number in the Characters pane.

First-person perspective games (a la Nancy Drew, Myst, etc.)

Is it possible to make a game in first-person perspective, like in Traitor's Gate, Nancy Drew, and Myst?

Absolutely! For each room you create, go to the Room/Settings pane and make sure the Hide player character checkbox is selected. You don't even have to make any walking animations! And, since the Walk cursor will be disabled in every room with this feature turned on, you can simply have the player interact with an object/hotspot/etc. to change rooms. Since there's technically no use for a Walk mode, Interact will do just fine. And if you must have a Walk mode, like in Nancy Drew, then do the following.

To use a Walk mode while the character isn't visible, simply use Mode 8 (or 9 if 8 is being used) as your Walk mode. Name it "Move to" or something like that, give it the Walk cursor, and in the Sierra toolbar GUI, make the Walk cursor change to Mode 8, instead of Mode 0.

Strange things when character walks through/over a certain area

My character does strange things when he walks in a certain area. Whatever could be the problem?

Well, check to see that the walkable area is at least 3 pixels wide. Anything less might cause the character to do strange things, like walking right through areas that (s)he isn't supposed to walk through. The same is also true for non-walkable-areas (value of 0). Make sure that both walkable and non-walkable areas are at least 3 pixels in width.

Furthermore, keep in mind that character speed has to do with this as well. If your character is moving too fast, (s)he might very well skip over the non-walkable area and "jump" areas.

Scrolling room image size limits

How large exactly can my scrolling room be? Is there a limit?

Prior to AGS 3.1, the maximum room height was 1,400 pixels (at 320x200 res) or 2,800 pixels (at 640x400). There is no restriction on width. At least...I don't think so...

As of AGS 3.1 and later, there is no hard limit on the size of rooms. Note that pathfinding for walkable areas may be slow if the room is large enough.

How to end your game (win/lose/die) or kill off your character

How can I kill off my character, or end the game? Can't have a game without dying and an ending, you know...

Indeed. These are very easy. While there isn't a built-in function to die or endgame (and how could there be? people want to do it different ways), you could easily do this yourself.

For a death scene, simply create a new room and go there every time the player does something to kill him/herself off, and do whatever you want there. For example, have three hotspots with "Restore/Restart/Quit" on it, and put the code inside accordingly (see the manual for these). Of course, don't forget to add a SetRestartPoint() at the exact place where you want the player to restart from. For example, if you want your player to restart at Room #3, then in that room's "Player enters screen (after/before fade-in)" interaction, create a script and enter SetRestartPoint(). This will mark that section of the script as the exact place that the game will start from when the player restarts the game.

For a proper ending, you might want to have an ending cutscene, some credits, and a "Restore/Restart/Quit" option at the end as well. It is best to switch to a new room and make sure there is no way to return to any other room in the game by accident...unless you want to, of course.

And if you don't know how to quit the game, you can either choose the "Quit game" interaction command, or use the QuitGame() scripting command. Look up the QuitGame() command in the manual, however, because you can make your game prompt the user, or you could have it quit immediately if making your own Quit GUI.

Finally, if you want the game to end once a certan amount of points were obtained (altough it doesn't make any sense to do it that way), you could place the following anywhere in your global script, provided it is outside all other functions:

 function on_event (int event, int data) {
   if (event == GOT_SCORE) { // Called whenever score changes
     if (game.score >= game.total_score ) { // fairly self-explainatory
       Display ("Congratulations, you've won.");
       // Or whatever you want to happen here

If you already have code in your on-event function (if it exists yet), then adjust the code to add it in. Thanks go to Ashen for the above code.

Above I mentioned that it doesn't make any sense to end a game once a certain score had been obtained. This is because a game usually ends when a certain point in the story has been reached -- usually the ending. Then, the score is displayed and the player is usually told how many points he missed, or if he got all the scores. I suppose this would work for non-adventure games or some unorthodox types of adventure games. But hey, it's your game; do whatever you want! ;)

Character pops up in weird place or not on walkable area from room to room

My character is going from one room to the next, and he isn't landing on a walkable area, OR he's popping up in weird places. What's wrong?

You're probably not specifying the exact coordinates that the character will start on in the new room. There are several ways to do this, but one easy way is to just call NewRoomEx() (or cEgo.ChangeRoom() for AGS V2.7 and above) when the character walks off the screen edge or stands on a region.

Another way is to set up the Player enters room (before fadein) interaction in the new room to check player.PreviousRoom to see which room they just came from and set their x and y coordinates appropriately. This can also be done in the global script in the on_event function if you check for the room entering event and the current and previous rooms.

Character does not walk on any walkable areas

My character won't walk on any walkable areas! What could be the problem?

Well, there might be several solutions to your problem. First off, make sure that you didn't confuse the hotspots, regions, walkbehind areas, and walkable areas. It is common to draw what you think is Walkable Area 1 and then you come to find out that it was a hotspot you were drawing all along. This way, the character never walks anywhere, because you didn't really draw a walkable area.

Also, keep in mind that the four kinds of interaction areas of AGS (hotpots, regions, walkable areas, walkbehind areas) are not connected to each other in any way. In other words, Walkable Area 1 has nothing to do whatsoever with Walkbehind Area 1. Use them independent of each other.

A sceond problem that could be the cause is that your walkable area is too narrow. This might not be the main cause, but keep this in mind anyway.

Try testing out your walkable area and make it take up the entire room. If it still doesn't work, then make sure that the character is set as the player character in the settings, and that "Don't automatically move character in walk mode" is not checked.

Size requirements for character sprites

What size do my characters have to be? Do they have to be the size of Roger? Is there a required size for characters?

The rule of thumb is to make your character a little smaller than the height of the doorways (if any) in your game. For example, if the average door is 100 pixels tall, make your character's sprite about 90 pixels tall. If there are no doorways (what! no doorways?), then the other rule of thumb is to size them as large as they will ever be in the game.

By importing bigger sprites (images), you can resize the characters to whatever size you want. Although you can technically scale characters to values above 100%, up to 200%, doing so will result in blocky-lookng characters. If your character will never be larger than half of the game's screen height (say, half of 480), then you must scale your character to be about 240 pixels tall.

Controlling non-player inventories

How do I control the inventories of non-player characters (NPC's)?

To manipulate NPC inventores, use the character[NAME].inv[N] global variables. For each character character[NAME], there is a set of inventory items inv[1] and up. Treat it like you would with any other int variable. For example:

 character[BOB].inv[5] = 1;   // BOB now has 1 of inv. item #5
 character[BOB].inv[3] = 0;   // remove item #3 from BOB's inv.
 character[TIM].inv[7] = character[TIM].inv[7] + 1; // add 1 more #7 to TIM's inv.
 character[TIM].inv[7] += 1;   // same, but shorter
 character[TIM].inv[7] -= 1;   // remove 1 of item #7

For information on more types of built-in global variables, look up "global variables" in the AGS Manual.

Displaying the left bracket ("[") in speech/messages

How do I display the left bracket ( [ )? Do I have to encapsulate this character or use some other special characters to show it?'

If you're using AGS V2.62 or earlier, it's not possible, we're afraid. Since "[" is used to add a line break, you can't normally display the left bracket symbol. You must sacrifice one of your characters in that font to use as a left bracket.

If you're using AGS V2.7 and above, simply precede the [ with a backslash: \[. For more on "escaping" characters, see String formatting

Having multiple characters in your game

I want to have multiple characters in my game that the player can play as. Is this possible? And if so, how would I go about doing such a thing?

It is indeed possible and quite easily so. If you do not have a decent grasp on scripting in AGS, then please follow a few tutorials now, as this feature requires scripting.

First off, in order to switch from one character to another, simply use the SetPlayerCharacter() (cEgo.SetAsPlayer() for AGS V2.7 or above) script command. Since AGS allows every character to have his or her (or its) own separate inventory, you will be able to access this new player character's inventory as you normally would with any other.

If you want to detect which character is the player character (for certain character-specific interactions or reactions), simply use an "if" command block, like so:

For AGS V2.62 and below:

 if (GetPlayerCharacter()==ROGER) {
   Display("Roger, you idiot, that's a couch!");
 } else if (GetPlayerCharacter()==IDIOT) {
   Display("That's a...uh...buffalo. Yeah...! That's the ticket!");
 } else {
   Display("That's a couch.");

For AGS V2.7 or above:

 if (player==cRoger) {
   Display("Roger, you idiot, that's a couch!");
 } else if (player==cIdiot) {
   Display("That's a...uh...buffalo. Yeah...! That's the ticket!");
 } else {
   Display("That's a couch.");

Yessiree, that's all there is to it. Just search for one of the aforementioned script commands in the AGS manual and look at the related script commands it shows.

World map feature (with hidden locations) in your game

I need to include a world map type of feature in my game. I want certain locations to have the ability to be toggled on and off. I also need all locations to go to a different room when clicked on. How do I implement this?

This is a rather simple thing to implement, and it involves basic knowledge of AGS, including objects, hotspots, GlobalInts, and some basic scripting.

First, your world map screen must be an independent room (this works better than a GUI if you want toggle-able locations). Any locations that are fixed (that is, will not be toggled on or off) should be drawn onto the background. Just assign hotspots to them so that, when clicked, will lead to a new room.

For all the locations that are toggled, create them as objects. Assign a sprite to each of them that corresponds to the location it represents. Then, when clicked, these objects will also lead to different rooms.

As for the GlobalInts, you must assign one to each of the objects (toggle-able locations) in the world map room. Each will store "1" for on and "0" for off. For example, Object 0 will be controlled by GlobalInt #20, object 1 will be #21, etc. Then, everytime the world map room loads, you must check each GlobalInt and use the data there to determine whether each object should be on or off. This is necessary because you cannot (at this time) control object states from other rooms.

Each time an event somewhere else triggers a certain location to be toggled ON, simply set its corresponding GlobalInt to "1". Then, when the world map screen loads, AGS will check that location's object's GlobalInt value and turn it on if it's "1". That's it!

White lines around character sprites

For some reason my characters' sprites have a white border around them. I can't see this outline in the actual image I made of him/her. The same is true of all my sprites. What is the problem?

This occurs if you draw your images with any anti-aliasing tool. In other words, if you used paintbrush tools and fill tools that smoothen the edges of whatever you draw, then outlines that are the colour of your background will appear. Why? Because when AGS imports images, it allows you to set a specific colour to use as a transparency. However, AGS doesn't detect a range of these colours; it only detects the exact colour. So because you have anti-aliasing (smooth edges) in your images, AGS will leave out the colours closer to the edges, because they are not the exact colour that is in the rest of the background.

The solution? Simply edit your images and make sure that what you think is the background of your images is all the same exact colour. Or, simply re-draw the affected images with tools that will not smoothen or blur the edges. This is especally true of images created in advanced programs such as Jasc Paint Shop Pro or Adobe PhotoShop. Good ol' Microsoft Paint will not anti-alias anything, so that's your best bet, unless you can use PSP/PS at its simplest operation.

Also, bear in mind that you didn't save the images as JPEG or any other lossy formats during a step in the creation of them, since those lossy compressions will alter your images so flat colours may not be flat anymore.

Alternately, since AGS currently supports Alpha-blended sprites when running at 32-bit colour mode, you may just save your images as PNG format with transparency, and then just import them, to save you from having to do all the hard works of refining the edges.

Disabling diagonal walking altogether (only walk up/down/sideways)

How can I make it so that my character can ONLY walk in perpendicular directions (up/down/left/right)? In other words, disable diagonal walking altogether?

Well, this is a tough one. Although it is currently not an option in AGS, it is being worked on and can be found in the AGS bug/feature tracker. Please check there frequently about this feature's status.

Now, with most things not officially supported by AGS, there is probably a way to do this using some very advanced, troublesome, and frustrating script that even *I* don't know. Your best bet is to either search the Technical Archive or ask somebody in the Technical Questions forum about a script that will not allow any walking outside of pure up/down/sideways.

Animating your background images

I have a room in my game that I would like to constantly animate, without any additional objects or sprites added to the room. How would I go about doing this?

First, create your room normally, with the first of your images as your background image. Then, on the room settings screen, click "Animate Backgrounds". Add the other room images as frames of the animation. This will cause the room to animate repeatedly. It can be controlled with scripting commands, such as SetBackgroundFrame() (you can look it up in the AGS manual) and GetBackgroundFrame(). Remember that the frames are numbered 0-4, not 1-5.

Having a character continuously animated in the background

Please refer to this entry.

Jerky character/sprite animation

When I animate my character or object, it jerks around from left to right all the time. I've checked everything, and all of my frames were imported correctly. What could be the problem?

Well, the most common cause for this problem is that each frame of this animation has a different width (bear in mind that the character sprites are all pivoted at the centre of the base). Resize all the images to the same width (I would recommending finding out the largest width out of all the images and resize them all accordingly). You might have to play around with moving each frame from left to right to get them aligned. Jasc's Animation Shop is perfect for resizing (cropping) and alterations like the above.

Using more than one loop per direction of a walking animation

I see that I can have one loop of a view taking up more than one row. Can this be used for walking animations, too?

Quite simply, no.

For walking animations, you must use only one loop per direction. If you need more frames, either ask CJ (Pumaman on the forums) for a limit increase, or try and reduce the frames used. Besides, the more frames you use for your characters' walking animations, the more memory your game will use up. Consider your players.

Working around the room object limit

I'm making a room that requires TONS of objects, but the limit is too low for me to work with. Is there any way I can increase the number of objects per room? Or am I forced to...(gulp) around my problem?

Have no fear, my friend. Working around your problem is simple and there are two ways to do it...

  1. If some of your objects don't necessarily appear all at once (e.g., object 2 only appears at a certain point, as does object 3, OR object 3 won't appear until objects 1 and 2 are "gone") and certain objects never appear at the same time, you can combine them into one object. You can then re-use that object for your purposes. You will, however, have to use some scripting to keep track of which object is in that slot. You will also have to use some functions that change the on/off states of the objects and what sprites they're using.
  2. You could also use characters as workarounds for some of the objects. This is a simpler method. Plus, the character limit is much higher than the room-object limit.

If none of the above workarounds will work for you, then you may have to send a private message to Pumaman (Chris Jones) and request that he increase the room-object limit. You must, however, show that you have considered the above two workarounds and show why they would not work for you.

As a sidenote, I remember the days when the object limit was 10, and that was good enough for some people. What are you making, the next Myst clone? :-P

LucasArts style speech is barely visible over background

I am using LucasArts-style speech (words above the character's head) and my own special font. However, over certain parts of my backgrounds, the text is barely visible and very hard to read, no matter what colour I try to use. What should I do?

The only thing you can do... use AGS's built-in font outlining feature. In the Fonts pane, click the "Automatic outline" option for custom true-type fonts, or if you are using an SCI (bitmap) font and you already have a matching outline font to use with it, click the "Use with outline font" option and select which font it is.

For more on fonts, look in the AGS manual (AGS.CHM file, or F1 inside the Editor) and search for "Fonts".

Adding an intro/cutscene to your game

How would I add an intro and/or a cutscene to my game? Like with characters walking around, talking to each other, animating, and moving the story along?

First off, this is an easy one, only because it's not that hard to figure out on your own. If you want your characters to animate and talk and all that, just do it! If you want to add an intro, make it so that the starting room of the player character has the intro/cutscene in the "Player enters room (after fade-in)" interaction. Scripting is a better choice than using the pre-made interaction commands, because it gives you better control and it's better organized that way. Check out all the scripting commands in the AGS manual, such as MoveCharacter(), DisplaySpeech(), and AnimateObject() (cGuy.Walk(), cGuy.Say(), and oBird.Animate() for AGS V2.7 and above). Using those commands and others like them will greatly help you with your cutscene.

As for non-intro cutscenes, simply add the cutscene script to whatever event will trigger it. For example, if you want a cutscene to occur when you talk to character "OLDMAN", then go to his interaction editor, add an interaction under the appropriate event, and add the script there.

Now, say you want to have a starting screen with "New Game", "Intro", "Load Game" and "Quit"... the usual menu buttons. Well, the easiest way to do it (if you want non-interactive buttons) is to draw them as part of the starting room's (usually INTRO.CRM or ROOM1.CRM, whichever you prefer, note that you have to use ROOM0.CRM instead of INTRO.CRM since AGS V2.7) background. Then, create hotspots to represent each of the buttons. For "any click on hotspot" interaction, use code for each button. First of all, however, decide in which room the intro starts, and in which room actual gameplay begins. Let's say the menu screen is INTRO.CRM, the intro begins with Room #1, and actual gameplay begins in Room #6...

For the "New Game" button, make it so that it moves the player character to room #6. For "Intro", move the player character to room #1. For "Load Game" look up RestoreGameDialog() in the manual, and for "Quit" check the manual for QuitGame().

That's basically it. It's pretty much common sense and very rudimentary scripting knowledge.

Naming your character and using that name throughout the game

Is it possible to let the player choose the main character's name, and have that name be used throughout the entire game?'

It is indeed possible, and very easy. First off, to ask the player for the name... For AGS pre 2.71:

 // Declares a string to store the player's reply
 string buffer;    
 // Asks the player for name   and stores it in "buffer"
 InputBox("What is your name?",buffer);
 // Transfers the content of "buffer" (the name) to the global variable character[...].name
 StrCopy(character[EGO].name, buffer);

For AGS 2.71 and later:

 player.Name=Game.InputBox("What is your name?");

Be sure to understand the above script in case you make an error and it does not work for you. Then, to call the name in, say, a Display box, just call up the character[EGO].name variable in any script, like so...

 DisplaySpeech(EGO, "My name is %s!", character[EGO].name); //V2.6 and below
 cEgo.Say("My name is %s!", character[EGO].name);//V2.7+, or...
 Display("Your name is %s.", character[EGO].name);

It's as simple as that!

Changing the size of imported fonts

How can I change the size of one of my fonts after I've imported them?

You can't. You have to re-import the font as a different size in order to do that. Cumbersome, I know, but it's necessary.

Intermittent crashing in full-screen mode

Whenever I run my AGS game in full-screen mode, it crashes suddenly and only on occasion. What is going on?

Most users with a GeForce video card have experienced intermittent crashing problems when running AGS games in full-screen mode. It seems to be a bug that hasn't yet been resolved. Some users claim that it only happens the first time during your game-testing session and that pressing CTRL+ALT+DEL after the first test will get out of it, and testing it again might not crash.

Alternatively, you could simply test in windowed mode, or place a shortcut to your game's EXE file on your desktop and run that after saving instead of testing within the AGS editor.

Note:This bug is probably fixed in recent versions of AGS, if the problem persists, you may report it in the Technical Forum.

Objects don't align properly in high-res mode

My game is in high-resolution (640 x 400, 640 x 480 or 800 x 600 graphics), and most of my objects do not align properly on my background images like I want them to. They're usually off by a pixel or two, and this occurs with scripting and manually. What am I doing wrong?

Nothing. AGS uses a low resolution grid (320 x 200, 320 x 240 or 400 x 300) even for high-resolution games. Therefore, you can only place objects on every other pixel (even-numbered, if going from 0 to 319 or 239). You will have to keep that in mind when designing your backgrounds and object placement.

However, with characters, the Character.LockViewOffset function does allow an offset in actual pixels to be specified for X and Y, so this may offer a way around the problem. Also, you can have high resolution masks for the walkbehind areas, but not for the other types of masks.

There is an entry in the AGS Bug/Suggestion Tracker about a more accurate positioning system. In the mean time, if you grab images from your background using a rectangular marquee/selection tool, remember to make sure that the program's status bar shows even-numbered pixels for your starting and ending points (and height/width as well).

Imported sprites show unwanted purple areas

Whenever I import sprites (usually with a black background), bright purple areas appear in unwanted areas, such as borders I create for my characters. What went wrong?

Basically, that bright purple is transparency. If you selected "Use pixel 0 as transparency" (or whatever the checkbox is called now) in the Sprite Import dialog, it'll make all areas that are like pixel 0 (the upperleft pixel) transparent. So if you have a black background, there's no way for AGS to distinguish the black in the background from the black in the outlines and other black pixels. Know what I mean?

I'd suggest using a different shade of dark gray for the background, this way only the background will be transparent. Or just use a different colour altogether -- it won't show up in the game anyway. I suggest using a bright neon green (RGB value: 0, 255, 0) so that you'll be able to tell whether or not AGS made everything you wanted transparent. Sometimes there are parts that weren't exactly the same colour as the background -- for example in anti-aliased outlines and edges -- and are therefore left in the image.

Simulating the letterbox effect, animiating it in and/or out

I want to simulate a letterbox movie effect, with the black bars at the top and bottom of the screen. However, I want them to animate going into the picture (as though the room picture is being cut from the top and the bottom), and also coming back out. How can I do this?

There are several ways to go about doing this. Using the RawDraw functions would work going in, but going out you'd have to redraw the background after every rectangle is drawn, because the background is being revealed again, little by little. Another way, as suggested by Scummbuddy and Gilbot V7000a, is to use two all-black GUIs (one for the top and one for the bottom), to have them move inward or outward from the center horizontal coordinate, depending on whether you're going inward or outward with the effect. Since GUIs are merely overlays and the background doesn't need to be redrawn when they are moved away, this would work perfectly for you. Learn more about moving GUIs in the manual.

Getting an AGS palette code from an RGB colour value

How do I get from a RGB colour value (say 128, 255, 48) to an AGS hi-colour palette code (like 234892)?

The formula to work out the RawColour number goes as follows:

 r1 = fullred / 8;
 g1 = fullgreen / 8;
 b1 = fullblue / 8;

This is because AGS doesn't use all 16+ million colours available (RGB values of 0-255). Instead, AGS uses RGB values of 0-31 for each red, green, and blue channels, giving a total of 32,768 colours (15-bit colour). Now that we've converted RGB to a 32-step scale, let's get the palette code number:

 rawcol = (r1 * 2048) + (g1 * 64) + (b1);

WARNING: You would think that, under this scheme, that colours 0 through 31 would be shades of pure blue. However, AGS also uses the original 8-bit DOS colour scheme for 0-31. 16-31 are shades of gray, while 0-15 are listed below:

0. Black

1. Dark Blue

2. Dark Green

3. Dark Cyan

4. Dark Red

5. Dark Purple

6. Dark Yellow

7. Gray

8. Dark Gray

9. Blue

10. Green

11. Cyan

12. Red

13. Purple

14. Yellow

15. White

So keep this in mind when finding out palette colour codes.

Imported background images just won't show up in the editor

Whenever I import my background image into AGS, it doesn't show up. What am I doing wrong?

Probably nothing, albeit unintentionally. If your .BMP file was saved as a 16-bit image (which it probably was), save it as a 24-bit image instead. That should work. Even though your game might be set to 16 bits, AGS will still import 24-bit images.

Why isn't JPEG supported?

Why is it not possible to import JPEG images as backgrounds? That would really help to keep games small and downloadable.

It is because the backgrounds in room files are all compressed with one single lossless scheme, no matter what format of images you used for import the resulting file size of the room is still the same. So there's no advantage in using JPEG at the time being (unless of course the room files can also store lossy native JPEG compressed images as bg, which is not implemented at the moment). Moreover, JPEG compression is lossy, storing an image which had details lost in a lossless format is not encouraged.

So, using different image formats only affects your working files, not the resultant filesize. If you're really low on hard disk space, just save your working files as PCXs and PNGs.