Jibble

Author Topic: [ABANDONED] AGS 3.3.1 Alpha 2 Turbo  (Read 15371 times)

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
[ABANDONED] AGS 3.3.1 Alpha 2 Turbo
« on: 11 Mar 2014, 11:25 »
Hello all,

I invite you to try...

AGS 3.3.1 Alpha 2

Download 3.3.1 alpha 2 as a .zip archive

Previous alphas:


ACHTUNG!
This is an early version of AGS 3.3.1.
Use at your own risk. Please back up any games before opening them in this version of AGS.
New settings in this version may make your project files unusable in 3.3.0 after saving with this version.

Last updated: 1st of August, 2014



Engine

Full Screen VSync for Direct3D

This feature was previously available (but always on) in Draconian editions of AGS. With AGS 3.3.1, it has been integrated into the mainline builds. It's now possible to toggle VSync using the "Vertical sync" checkbox in Winsetup.exe. If it's checked, the game starts with vertical sync turned ON. In DirectX 5 mode, you can still toggle this by setting System.VSync to true/false. In DirectX 9 mode, the System.VSync property is now read-only (as opposed to being useless previously).

Bug Fixes
  • The engine now moves the portrait with the speaking character when using BasedOnCharacterPosition if the speaking character moves between calls to Say
  • Fixed internal handling of defaults when they can't be read from the config file
  • Fixed precision loss when getting/setting a transparency value, e.g. player.Transparency
  • Fixed occasional pathfinding failure on straight lines with complex walkable areas (reported here)
  • Printing [ no longer consumes all of the backslashes before it (e.g. "\\[" should now print \[ as expected)



Scripting

For statement

In addition to a while loop, you can now use a for loop in AGS script. The syntax is:
Code: [Select]
for([initialisation];[condition];[increment])
{
    [loop body]
}
Example:
Code: [Select]
for(player.x = 0; player.x < 100; player.x++)
    Wait(1);
Important: You cannot declare a variable inside a for loop's initialisation section. For instance, "for(x = 0; ..." is fine, but "for(int x = 0; ..." is not valid. It might be valid someday.

Break statement

You can now break out of loops using the break statement. For example:
Code: [Select]
i = length - 1;
while(i >= 0)
{
    if(page[i] == target)
        break;
    i--;
}
Will halt the loop when a match is found or leave i as -1 if there was no match.

Continue statement

You can now continue to the next iteration of a loop using the continue statement. For example:
Code: [Select]
for(x = 0; x < 100; x++)
{
    if(x % 2 == 0)
        continue;
    Display("%d", x);
}
Will display only odd numbers between 0 and 100.

Do...While loops

The Do...While loop construct is now supported. For example:
Code: [Select]
x = 1;
do
{
    x++;
    Display("%d", x);
} while(x < 1);
Unlike While, Do...While runs the loop iteration *before* evaluating the condition. The loop above will run once.

Dynamic Arrays in Structs

Dynamic arrays are now permitted inside structs. You can declare a struct like so:
Code: [Select]
struct DieRoll
{
    int BaseModifier;
    int DieCount;
    int Dice[ ];
    import function GetTotalValueOfRoll();
};

function PrepareDice()
{
    DieRoll a;

    a.DieCount = 3;
    a.Dice = new int[a.DieCount];
    a.Dice[0] = 6; // d6
    a.Dice[1] = 6; // d6
    a.Dice[2] = 8; // d8
    ...
}
And the dynamic array "Dice" can be initialised and used like any other dynamic array.

Managed User Structs

In AGS parlance, a managed struct is a struct that can be created dynamically. You must use pointers to refer to them (similar to built-in types like Region or Hotspot). You declare them with the keyword "managed" and construct new instances with "new", like so:
Code: [Select]
managed struct Point
{
    int X;
    int Y;
};

Point *GetPosition()
{
    Point *result;

    result = new Point;
    result.X = 30;
    result.Y = 40;

    return result;
}
Important: Managed structs are currently VERY limited in that they can't contain pointers (including dynamic arrays). It is hoped that this restriction will be lifted in the future.

#define Improvements

#define can now refer to other #define'd constants. Like VC++, #define symbol expansion only needs to make sense at the time of reference. Also like VC++, the order of previously defined constants isn't important, making stuff like this possible:
Code: [Select]
#define RED    GREEN
#define BLUE   456
#define GREEN  BLUE
Display("%d", RED); // Prints 456
#undef BLUE
#define BLUE  123
Display("%d", RED); // Prints 123
Note: To prevent circular references, a #define cannot refer to itself or anything previously used to expand the #define symbol.

Static extender functions

You can now declare the first parameter of a function as a static identifier that corresponds to a struct, e.g.
Code: [Select]
function AbsInt(static Maths, int value)
{
    if(value < 0)
        value = 0 - value;
     
    return(value);
}
This works in the same way as the normal extender method syntax (e.g. this Character *) but for static methods. The above code will define a new method in the static Maths called AbsInt. You can then import it in a header:
Code: [Select]
import function AbsInt(static Maths, int value);And then use it elsewhere in your code just like it were a built-in Maths function:
Code: [Select]
int x = Maths.AbsInt(-3);
Extra Assignment Operators

The following C-style assignment operators are now supported:
*=   (Multiply by and assign)
/=   (Divide by and assign)
&=   (Bitwise AND and assign)
|=   (Bitwise OR and assign)
^=   (Bitwise XOR and assign)
<<=  (Bitshift left and assign)
>>=  (Bitshift right and assign)

Direction parameter for Character.ChangeRoom

This feature was previously available Draconian editions of AGS. The Character.ChangeRoom function now looks like this:
Code: [Select]
Character.ChangeRoom(int room, optional int x, optional int y, optional CharacterDirection direction)Where CharacterDirection is a new built-in enum defined for facings (eDirectionUp, eDirectionUpLeft and so forth).

Character.DestinationX and Character.DestinationY

Two new read-only properties that can be used to determine where a character is currently heading (via a Walk command). If the character is currently stationary, these values are the same as Character.x and Character.y, respectively.

IsInteractionAvailable() for Other Types

This is another feature from Draconian editions of AGS. The IsInteractionAvailable() method can now be called on Hotspots, Objects and Characters.

Audio Clips API

There are two new properties for dealing with audio clips in this version.
Code: [Select]
Game.AudioClipCountRetrieves the number of clips and
Code: [Select]
Game.AudioClips[n]Allows you to access a particular audio clip.

Plugin API

There is now a new function that can be used to detect whether a plugin has been loaded:
Code: [Select]
Game.IsPluginLoaded(const string name)Where name is the filename of the plugin

Dialog Options

The highlight colour for dialog options (default rendering) is no longer hard coded as yellow (14). You can use:
Code: [Select]
game.dialog_options_highlight_color = xxx;And set the dialog options highlight colour to whatever you like. The default is 14.

Code Regions

This was previously available in Draconian editions of AGS. You can define an arbitrary region for code folding in your script like so:
Code: [Select]
#region MyRegion
do stuff;
do stuff;
do stuff;
#endregion MyRegion
The AGS editor will allow you to fold and unfold this region as though it were a code block. This has no effect on compiled code.

Bug Fixes



Common

Extended WFN Font Support

Support was added for extended characters in WFN fonts (those with codes 128 - 255).



Editor

Padding for Text GUI Windows

Text GUI windows now have a padding property which lets you control how much space appears between the border and the text inside a text GUI window. Previously, this value was hardcoded as 3 pixels. It now defaults to 3 pixels.


Clickable for Objects

The Clickable property of objects is now exposed in the editor so that you can set it at design time. Previously, this value was embedded in the room file format but only toggleable via scripting.


Bug Fixes
  • Undo history will no longer be deleted when a tab changes its docked state
  • Fixed crashes under certain circumstances when a script editor is closed
  • Fixed crash if selecting a character without a normal view in the room designer
  • Ctrl+Tabbing now works the first time when cycling through open editor tabs
  • Go to Line... now goes to the correct line and doesn't select it
  • The project is now completely rebuilt whenever Enable Debug Mode in General Settings differs from the setting used for the last build
  • The sprite editor now highlights drop targets when you drag sprites around
  • Moving folders of scripts around in the Explore Project pane no longer screws up compilation



Please enjoy this build and use responsibly.

Contributors
Crimson Wizard
Tzachs
monkey_05_06
salty-horse
Me
« Last Edit: 27 Sep 2014, 17:51 by Gurok »

Joseph DiPerla

  • Joseph DiPerla, Adventure Game Creator Wannabe!
    • I can help with backgrounds
    • I can help with characters
    • I can help with play testing
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
Re: AGS 3.3.1 - Scripting Test Build
« Reply #1 on: 11 Mar 2014, 11:55 »
Nice job!
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Re: AGS 3.3.1 - Scripting Test Build
« Reply #2 on: 11 Mar 2014, 12:13 »
  • More settings will now have sensible defaults when they can't be read from the config file (hope I got this right, CW)
No, that just fixed how internal function works. Default values should stay the same.

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #3 on: 11 Mar 2014, 12:16 »
Okay, updated. Thanks, CW.

Snarky

  • Global Moderator
  • Global Moderator
  • Mittens Lord
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #4 on: 11 Mar 2014, 12:24 »
Nice! Look forward to trying this out!

Problem

  • Cavefish
    • I can help with animation
    • I can help with characters
    • I can help with making music
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Problem worked on one or more games that won an AGS Award!
    •  
    • Problem worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #5 on: 11 Mar 2014, 12:44 »
Great, these are some valuable additions to the scripting language! I'll try it out soon :)

Dropped Monocle Games

  • You can call me Sox
    • I can help with animation
    • I can help with backgrounds
    • I can help with characters
    • I can help with play testing
    • I can help with web design
    • Dropped Monocle Games worked on one or more games that won an AGS Award!
    •  
    • Dropped Monocle Games worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #6 on: 11 Mar 2014, 13:00 »
I'm not very good with coding, being more into graphics so a lot of this has gone over my head.. but hell yes to VSync!!! I spend alot of time on the art and then seeing the screen tearing brokes my little heart hehe, nice work! :)

Radiant

  • Mittens Knight
  • AGS Baker
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    • I can help with story design
    • Radiant worked on one or more games that won an AGS Award!
    •  
    • Radiant worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #7 on: 11 Mar 2014, 13:36 »
Thanks, this is a breakthrough that I've been expecting for awhile; please continue your work on this :grin:

Gilbert

  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
Re: AGS 3.3.1 - Scripting Test Build
« Reply #8 on: 11 Mar 2014, 14:08 »
It's not particularly important for me with for loops adding back as it's been removed for like a decade. It's of course nice to have it back.

But:
Audio Clips API
Sold! :=

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #9 on: 11 Mar 2014, 17:35 »
Audio Clips API
Sold! :=

I tried a couple times to implement something like this, but I kept over-complicating things (introducing new data types and such) to the point where I felt I couldn't justify all the changes. This is much more elegant and simple, and is a very welcome change. :)

tzachs

  • Mittens Vassal
  • AGS Baker
  • Parking Goat- games that goats like!
    • I can help with translating
    • tzachs worked on one or more games that won an AGS Award!
    •  
    • tzachs worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #10 on: 11 Mar 2014, 20:06 »
Running with this version and can confirm the text window padding works. :)

Re the audio clips API: Can you guys explain why you find those additions useful? One use I can maybe see is for playing random sound effects, but other than that, I'm drawing a blank. Is there another reason that got you sold, Iceboty?

Gilbert

  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
Re: AGS 3.3.1 - Scripting Test Build
« Reply #11 on: 12 Mar 2014, 03:07 »
It's tremendously useful. In fact I'm all for referring to every thing with numbers, rather than stupid object names. For example, I abuse the sprite numbers heavily for putting in the correct tiles to draw in a tiled engine.

Often times, there are occasions where a certain piece of asset is chosen by means of a formula.
For example (just some randomly made up junk, so don't mind whether this is really practical here), I have an interface with some piano keys(say, for simplicity, 8 keys, or, think the interface of LOOM) and a different sound clip will be played when a different key is clicked. If the clips are numbered #100 to #107, it's easy to code the game to play clip #100 + piano_key, than to assign a different clip by name to each key.

I haven't checked it yet, but will the numbering be changed if a sound file is removed from the project? In that case it's only half-done in the current situation. Ideally we should be able to change manually what number each sound file is assigned to, just like what we have for sprites.

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #12 on: 12 Mar 2014, 03:21 »
Re: Audio Clips API

I can't say terribly much about this because I don't have much experience with audio clips. It returns a flattened version of the audio clips tree. That's as much as I know. I would hazard a guess that there's no special numbering going on, but maybe Crimson Wizard can chime in as he'll know more.

Ghost

  • AGS Baker
  • Rottwheelers
  • Time to give up.
    • Ghost worked on one or more games that won an AGS Award!
    •  
    • Ghost worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #13 on: 12 Mar 2014, 06:18 »
Very interested in testing this, I especially like the loops. Can't say how often I've wished for those. Well played, Gurok!

Radiant

  • Mittens Knight
  • AGS Baker
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    • I can help with story design
    • Radiant worked on one or more games that won an AGS Award!
    •  
    • Radiant worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #14 on: 12 Mar 2014, 06:57 »
Re the audio clips API: Can you guys explain why you find those additions useful?
The old (AGS 2) music/sound system let you address everything by number, but it doesn't work with the new (AGS 3) volume controls; so this should do both. This lets you pull tricks like setting a variable cur_music for each room, then playing music[cur_music] if it's daytime, music[cur_music + 1] if it's night, without having to set up an array of pointers.

DoorKnobHandle

  • Mittens Serf
    • DoorKnobHandle worked on one or more games that won an AGS Award!
    •  
    • DoorKnobHandle worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #15 on: 12 Mar 2014, 12:21 »
Break statement

You can now break out of loops using the break statement. For example:
Code: [Select]
i = length - 1;
while(i > 0)
{
    if(page[i] == target)
        break;
    i--;
}
Will halt the loop when a match is found or leave i as -1 if there was no match.

This is really nitpicking but I think there's an error in this example. It halts the loop when a match is found (but it doesn't check the first element in the page[] array) or end up with i being 0 (not -1) if there was no match, right? What you probably wanted is >= instead of > in the second line.

Good work though, can't wait to try this! The for/break/continue stuff is neat but the audio clips are really useful to me as well!

Snarky

  • Global Moderator
  • Global Moderator
  • Mittens Lord
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #16 on: 12 Mar 2014, 12:30 »
It's better written as a for-loop anyway. :-D

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #17 on: 12 Mar 2014, 12:59 »
This is really nitpicking but I think there's an error in this example. It halts the loop when a match is found (but it doesn't check the first element in the page[] array) or end up with i being 0 (not -1) if there was no match, right? What you probably wanted is >= instead of > in the second line.

Good work though, can't wait to try this! The for/break/continue stuff is neat but the audio clips are really useful to me as well!

Yes, you're right. I'm too used to writing it the "proper" way ( while(i-- > 0) ) which AGS doesn't support yet. I'll update the example. Sorry about that! :-[
« Last Edit: 12 Mar 2014, 13:08 by Gurok »

Adeel

  • Cavefish
    • Adeel worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #18 on: 12 Mar 2014, 13:32 »
Nice going, sir. It's a very fine start. I especially like having the power to manually configure 'padding for Text GUI Windows.' :)
-

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Re: AGS 3.3.1 - Scripting Test Build
« Reply #19 on: 12 Mar 2014, 13:40 »
Umm... I just want to stress that this is still a collaborative effort. I appreciate the thanks and kind words from people, but Crimson Wizard and Tzachs have been contributing for a lot longer than me and are also contributing to this release. Audio Clips and some of the Draconian porting is CW's work. The undo history + editor crash fixes are Tzachs'.

I have a feeling that we won't get any feedback about the new scripting stuff until someone finds a bug. Regardless, it would be nice to read a "I tried the new version and it ran a for loop fine" from someone so I know that I didn't completely mess things up :).