Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Crimson Wizard

#241
This is a very big topic, but I would begin with saying that this topic consists of two large chapters:
1) Compressing resources.
2) Effective use of resources in game.

I put "compression" first, because it's easier to understand, imo. Also it's easiest to apply if you're already at the final stage of making this game.
But if you're making a high-resolution game, then the second part is also important; and not only for the game size on disk, but for runtime performance.

There was a topic in the manual dedicated to the resource management, but looking at it now it unfortunately turns out too short and generic, without going into many details, or real file format specifics, and does not fully explain everything it mentions:
https://adventuregamestudio.github.io/ags-manual/DistGame.html#managing-the-graphics-footprint
I believe it must be improved, and maybe this forum thread may help with that too, as it goes.

I will cover some things briefly for now.



1.1) Compression of sprites. AGS stores sprites as raw pixel data, but can apply an optional compression to that. This is controlled by option "Compiler -> Sprite file compression". As of 3.6.0 compression options are:
- RLE - this method is best suited for simple pixel gfx with low number of colors;
- LZW - this method is much better for quality high-resolution gfx with big number of colors. It's also always used for room backgrounds and cannot be changed there.
Switching compression should be safe anytime, so you may change, rebuild, record the size of the "acsprset.spr" file, change, rebuild and record the size again.
There's another option that controls sprite saving: "Enable sprite storage optimization". This option is best to left always on, the switch is there mostly for emergency/debugging purposes. If you're curious, what it does is that it secretly converts 32-bit sprites into 8-bit sprites with palette, but only when it's actually going to gain space. Then when the game is run, engine converts them back to 32-bit for proper display. This option is intended for 32-bit games that emulate old-school gfx with limited palette (like this game for example), and may reduce sprites size at most by ~4 times.

1.2) Compression of audio. I had never done any research, but hearing what some other people mentioned in the past, AGS games seem to be notorious for their developers using audio files of a way too high quality, usually unnecessarily high bitrate. This is probably because many games are done by hobbyists who do not have much knowledge in audio engineering, and so they may use downloaded free audio files without checking for specifics.
But having overly high bitrate may significantly increase the size of audio clips.

Unfortunately, I am not an expert in this either, so someone should give a hint, or point to some tutorial, but regardless I believe it's important to find a good bitrate which both ensures an acceptable quality and don't boost the size too much. There are tools that let convert audio in batch, changing bitrate and other parameters (such as ffmpeg for instance). After you found a good set of parameters, it may be worth converting all of your audio to these.



In regards to "chapter" 2, "Effective use of resources", that's again a large topic, so only to touch few  subjects.

2.1) Fullscreen animations. The size of gfx file depends on the sprite's resolution. Fullscreen frame is rather large, and if you have fullscreen animation, that means it's even bigger. To give some perspective: 320 x 200 x 32-bit is 320x200x4 = 256000 bytes. 1280 x 720 x 32-bit is 3686400 bytes (~3.7 MB). You may continue this calculation. E.g. a fullscreen animation in 720p of 10 frames would be 37 MB, 10-frame animation in 1080p would be ~83 MB. This of course does not account for the sprite compression, but should give an idea.

Depending on the purpose of a fullscreen animation, two ways of optimizing one are:
- If it's an animated cutscene, consider using OGV videos, which have far better compression that separate sprites (although the quality may be not as "sharp").
- If it's a background animation, consider splitting it up into parts that animate and those that do not, and use separate room objects to animate only parts of the room.
- If it's some kind of a screen effect, consider using a smaller sprite, place it on overlay and scale it up to the necessary size in script. Not saying this will work always, but if this is something that does not require perfect detail (like falling streams of rain, for example), it may actually be a solution.

2.2) Using low-res gfx in high-res game. Overall, remember that you may scale lower res sprites in game using object scaling (which has fast performance); if you do not need much detail to some gfx. If you are making your game with "old-school" pixelated gfx, do not resize sprites to high-res even if you want a high-res game for some reason (for example, for the purpose of having high-res "modern" guis and text fonts). Keep them low-res and scale objects, or zoom-in whole room viewport instead.

2.3) Changing character/object views. If you have too many variants of character looks, and required number of sprites skyrockets, you may consider two methods:
- Combine a character from two or more characters. E.g. one character is a body, another is "dress" or "shadow", and so on. This method was (still is?) widely used in arcade games, where character parts could have separate animations.
- Use dynamic sprites and change the looks in script at runtime, repainting the view frames.
#242
If you have a lengthy game, it's a common advice to create some kind of "teleport" function, which would setup a game state corresponding to the particular "chapter". This may make play testing easier, without relying on older saves.
#243
Quote from: Ghostlady on Fri 28/07/2023 22:02:19I have been playing and saving to find the errors from going from the old version to new.  Its been good with saves and loads until now.

This means that your game has 1 custom script module now, while the save was made with game which has 0 script modules.

In AGS saves are broken by almost any addition of anything.

https://adventuregamestudio.github.io/ags-manual/GameSavesCompatibility.html
#244
Updated to Beta 6
(Please use download links in the first post)

Changes in this update:

Editor:
- Discontinued Source control integration functionality, removed "Put sound and sprite files in source control" option from General Settings.
- Export Game's Title into translations.
- Fixed Editor refusing to open a game if one of the translation files is missing.
- Fixed Game.agf was not created after importing a 2.* game project (regression in 3.6.0).
- Fixed Log Panel displaying recent messages with a delay.

Script API:
- Expanded interaction functions for Character, Object, InventoryItem, Hotspot and Region types: now they all receive respective object's pointer as a parameter, similar to GUI event functions, as well as a cursor mode this interaction was run with, if applicable.
- Added Object.AnimationVolume property, which works similar to Character.AnimationVolume.

Engine:
- Character.AnimationVolume now applies to the portrait animation too.
- Changed Object.SetView() to not play a frame's sound, which could lead to a duplicated sound play if Object.Animate is run right after.
- Removed few of the less important game messages from logging, because they may quickly clutter the log under some circumstances.
- Fixed deleted dynamic sprite leaving sprite slots marked as "taken" forever, which continuously increases the size of the sprites list at runtime (regression since previous 3.6.1 Betas)
- Partially improved performance of repeated creation and deletion of a large number of dynamic sprites on each game update (regression since previous 3.6.1 Betas)
- Fixed Buttons and ListBoxes using Translated property in reverse way (regression since previous 3.6.1 Betas).
- Fixed debugger (editor) log output did not receive initial engine messages.

Web / Emscripten:
- Fixed Safari cannot switch the game into fullscreen mode.



Regarding expanded interaction functions, these are functions connected to Look at, Interact, Talk to and other similar events. They all now may have 2 parameters: a pointer to object, and cursor mode, similar to the following examples:
Code: ags
function Ego_Interact(Character *c, CursorMode mode)
function oObject1_Look(Object *o, CursorMode mode)

Exceptions:
- Hotspot WalkOn and MouseOver events do not have CursorMode parameter.
- All Region events do not have CursorMode parameter.

The purpose of this addition is to improve situation where you connect same function to multiple events and/or multiple objects at once. In such case you will be able to distinguish object and mode for which the function is actually called.

These new parameters are optional. If you don't have them declared in script, they will be ignored by the engine, and your script is going to run as before.
#245
We had a thought to optionally support a Sierra-style speech view with character portraits in the default game templates. But for that we'd need to have Roger's portraits.

If anybody is willing to draw a portrait animation for the Roger character, something simple, consisting of < 10 frames, please contact us here in this thread, or here in this suggestion thread on github:
https://github.com/adventuregamestudio/ags-template-source/issues/36

Please keep in mind that the style should match the resolution and art style of the default template assets, more or less.

Perhaps, it would be a good idea to post this work in Critics Lounge first, to get peoples reaction.
#246
Quote from: Gal Shemesh on Fri 28/07/2023 00:44:31I also made a sophisticated Excel file for writing all the strings used in the game, along with formulas of direct links to the speech files of each line so you could listen to them directly from the Excel when doing either the English voice recording or voice-over

This seems similar to what the SpeechCenter plugin does:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/editor-plugin-speech-center-version-2-2-0/
#247
Quote from: BowsetteGamer on Fri 28/07/2023 01:19:54Exactly, but since I tell the GUI to show me the variable instead of the text, I am aware that "mylabel" is the example. but what do i have to write

No, you have a misunderstanding there. GUI's themselves cannot contain variables, they can only contain text. So the question is, how to create a text that shows variable's value (and whatever else you may need).

The "@SCORE@" is also a text, but the engine has a special behavior that automatically replaces "@SCORE@" with formatted score value at runtime. Same goes for "@OVERHOTSPOT@". This is just a placeholder for automatic behavior. But your own variables won't have automatic replacement, so you have to do that yourself, explicitly in script.

So in your script you have to create a text, formatted with the variable's value, and then set the text to the label. This is what String.Format is used for.

Supposing your label is called lblCoins, you write in script:
Code: ags
lblCoins.Text = String.Format("Coins: %d", coins);
// or just
lblCoins.Text = String.Format("%d", coins);
// depending on which format do you want
#248
Quote from: Ghostlady on Thu 27/07/2023 21:03:32I changed this on the global script and the global header script and in a room for one character.  I now get this error on the
GlobalScript.asc(350): Error (line 350): Parameter type does not match prototype

This means that there's still this function's declaration somewhere, which was not changed, and now it does not match the function body.
#249
Quote from: Ghostlady on Thu 27/07/2023 20:48:49room2.asc(147): Error (line 147): Type mismatch: cannot convert 'const string' to 'string'

I think you may fix this by changing the function declaration to have "const string":
Code: ags
SaySpecialN (Character *thechar, string message)
to
Code: ags
SaySpecialN (Character *thechar, const string message)

This has to be changed in both function and its declaration in the script's header (if you have one).
#250
Quote from: Ghostlady on Thu 27/07/2023 19:23:41What has changed with the function or text?  If I remove the "SaySpecial#" from the lines in the room script, the game will compile but the text doesn't go into the text gui.  If I keep it in the game won't compile.

So what errors are there during compilation? Fixing these errors would be the right way to go.
#251
Each GUI and each gui control (label, button, and so on) has a Name property. This is how this gui or control may be addressed in script. Same as with Characters, and almost everything else.
"mylabel" in the above example is a label's Name.

#252
This is covered in Frequently Asked Questions in the manual by the way:
https://adventuregamestudio.github.io/ags-manual/FAQ.html

Look for "How do I put a variable on a GUI label?".

In general:
Code: ags
mylabel.Text = String.Format("Coins: %d / %d", current_coins, total_coins);
to keep this updated, either run this in function repeatedly_execute, or when the variable changes. Usually it may be convenient to make a custom function for changing a variable, which would also update the label at the same time.
#253
Quote from: Ghostlady on Thu 27/07/2023 03:37:04It kept highlighting one of the other games so when I hit continue it would open one of them.  That menu is what I couldn't get past so I created a new game to get past the menu.

When you select "Continue an existing game" and press Continue, then the list of games is ignored, and a Browse files dialog is opened instead.
The list of games is only active when you select "Continue a recently edited game".


Quote from: Ghostlady on Thu 27/07/2023 03:37:04There was tons of dialog I had to convert from SaySpecialCharacter to Character.Say.  So now what I am seeing is my dialog text is no longer in the dialog gui but splayed across the top of the screen.

AGS never had a function called SaySpecialCharacter, that had to be a custom function from your global script or one of the script modules. Is it still there in the script or not at all? (Since you said that you  had an original game folder with everything in it, I supposed that global scripts should stay intact? maybe I misunderstood something.)

Character.Say works only in few standard styles; this style may be selected in General Settings (Dialogs -> Speech style), but neither of them displays speech on the gui dialog's label. This is something you should script yourself.
#254
Quote from: Crimson Wizard on Thu 27/07/2023 01:50:54
Quote from: Ghostlady on Thu 27/07/2023 01:35:50I did try that but it wouldn't let me past that menu screen. 

Why not, what had happened?
Nothing, I couldn't get past that menu window.  It just sat there not letting me move.

Oh, you needed to click on Continue button after selecting that option.
#255
Quote from: Ghostlady on Thu 27/07/2023 01:35:50I did try that but it wouldn't let me past that menu screen. 

Why not, what had happened?

Quote from: Ghostlady on Thu 27/07/2023 01:35:50Maybe you can help me with some of this conversion stuff.

There's something weird about this, the macro name does not work in the contemporary versions of AGS if it starts with underscore.
Changing the name to "THE_NUMBER_OF_OBJECTS_YOU_HAVE" makes that work.
#256
Quote from: Ghostlady on Wed 26/07/2023 22:02:58I downloaded both of these versions of AGS and they do not recognize the game in AGS.  It should be finding Oakhaven.

The Recent game list contains games that you have opened in this particular version or earlier versions. If you have opened a game in AGS 3.6.0, then it won't be mentioned, for example, in AGS 3.5.1 or 3.2.1.

If it is not there, then simply use "Continue an existing game" and point to where the game is. You do not have to create a new game for that.
#257
Quote from: SirLean on Wed 26/07/2023 18:51:09I tried with other click modes and it plays (like for example "Look at")

Of course there's no relation between a click mode and a sound playing or not playing.

If exactly same command works in one click mode but not another, then something is wrong with the click mode. So focus on that instead.

Replace the Sound.Play with a more common function, like Display, and see if it works. If it does not, that would mean that the interaction itself is not run.

Do "Interact" clicks work in other cases, for other objects in your game?
If yes, then double check that you have this particular "object_Interact" function name in the object's event table.
If no, then this is a problem with how your on_mouse_click is scripted. Which game template do you use?
#258
I am not really certain about this case, but there are another 2 known reasons why AGS may not be accessing files:
* Anti-virus does not like AGS for some reason, and is blocking its attempts to write or move files;
* Windows explorer may sometimes block the changes to compiled files, if you have the folder opened while AGS is working. But this usually happens with Compiled folder only, during game compilation.

Besides that, I've been testing the old game import process in 3.6.0, and apparently 3.6.0 has some error where it cannot save the imported game properly. I may suggest trying to import into an older version first, like 3.5.1, or even 3.2.1 (the latter may be got from here), and then proceed with the 3.6.0.

I do recommend making manual copies of the old project of course, just in case, before doing any import or upgrade to a newer version.
#259
Please tell which version of AGS you are using now?

Also when importing, did you choose to "Backup files"?
#260
Quote from: Ghostlady on Tue 25/07/2023 22:50:41I can open the game with AGS 2.70 but when I try to save I get a write error.

You mention AGS 2.70, but the error screenshot indicates it happens in AGS 3.*, and that it happens during not saving, but an import process.
Could you please clarify what are you doing?


In regards to error itself, do you have this project open in more than one program at the same time, maybe? (like - the old editor and the new editor)

If not, do you actually have an access to that folder? Like, what happens if you try to create a file there by hand?
What if you run the Editor "as administrator"? Or try to put the game files in some another place?
SMF spam blocked by CleanTalk