AGS 3.5.0 - alpha 13 - next WIP version

Started by Crimson Wizard, Wed 21/02/2018 13:52:21

Previous topic - Next topic

Crimson Wizard

#240
Ok so soon here's another small update, but it has critical bug fixes from AGS 3.4.3 patch 1, and also an important ammendments to new Room Viewport & Camera API.

AGS 3.5.0 - Alpha 11


Zip archive: http://www.mediafire.com/file/l6rtpsjq94fo5m1/AGS-3.5.0-alpha11.zip/file


Changes since 3.5.0 alpha 10:

- Have merged critical bug fixes from AGS 3.4.3 Patch 1

Editor:
- Fixed few mistakes when converting interaction scripts from very old games (regression)

Script API
- Moved new room camera and viewport API into API version v3.5.0.7 (was v3.5.0).
- All functions that find room objects under screen coordinates are now being clipped by the viewport (fail if there's no room viewport at these coordinates).
  This refers to: GetLocationName, GetLocationType, IsInteractionAvailable, Room.ProcessClick, GetWalkableAreaAt and all of the GetAtScreenXY functions (and corresponding deprecated functions).
- Added Character.GetAtRoomXY, Hotspot.GetAtRoomXY, Object.GetAtRoomXY, Region.GetAtScreenXY, replaced GetWalkableAreaAt with GetWalkableAreaAtScreen and added GetWalkableAreaAtRoom.

Please take a notice: if this new behavior breaks your game, either switch to using GetAtRoomXY functions, or switch down to Script API Level v3.5.0 in General Settings.



KNOWN ISSUES:

- Reported by Snarky: need to find out which components need to be added to use AGS 3.5.0 on fresh Windows installation.
- Some weird sprite scaling bug in the room editor described in the posts above. According to user reports it may be fixed by restarting the editor. Unfortunately I was still unable to reproduce it on my own...
And of course the ones noted at github issue tracker: https://github.com/adventuregamestudio/ags/issues?q=is%3Aissue+is%3Aopen+label%3Abug


EDIT: I had to reupload the package because of the small but serious bug. Download link is the same.

Monsieur OUXX

I'm worried by the clipping behaviour but I don't know if it's justified or not.
 

Crimson Wizard

#242
Quote from: Monsieur OUXX on Wed 27/02/2019 16:28:52
I'm worried by the clipping behaviour but I don't know if it's justified or not.

I was planning to post detailed explanation but did not find time yet.
This change may complicate certain actions a little bit, but also makes interaction between screen and room more logical (especially now when you may have custom viewport and camera sizes, room camera scaling, and maybe even rotation in the future).

IMHO there are following common situations where you would like to find an object using some coordinates.

1) You are processing player's input and need to find an object or location under or near mouse coordinates. In this case only what you see on screen (or rather inside room viewport) is important, and clipping won't bother you (it will even help you if your viewport is smaller than the game screen).

2) You want to find an object or location that may be located anywhere in the room, even outside the visible area, using screen coordinates (dummy example: you want to find nearest object and move them to the mouse coordinates).
This is where new ScreenToRoom function comes to use. Such function would be useful even in old AGS, but the coordinates conversion was very simple then (adding or subtracting result of GetViewportX/Y) so we did not have it built-in.
It works like this:
Code: ags

Object *FindNearestObject(int mousex, int mousey)
{
    Point *roompt = Screen.ScreenToRoomPoint(mousex, mousey);
    Object *obj = null;
    for (int i = 0; i < MAX_OBJECTS; i++)
    {
        // continue searching using room coordinates roompt.x and roompt.y
    }
    return obj;
}


In an extreme case, if you want to use screen coordinates that are (or may be) outside of the visible screen, you may explicitly "pass" the point through the main viewport:
Code: ags

Viewport *viewport = Screen.Viewport;
Point *roompt = viewport.ScreenToRoomPoint(-1000, -1000, false); // "false" here means "no clipping"
// this will find room coordinates that are at (-1000,-1000) screen coords if seen through main viewport


3) You want to find some object or location relative to another object or location (like player character). This is where all the new GetAtRoomXY functions come useful (and that's the reason they were added).
For example:
Code: ags

Hotspot *h = Hotspot.GetAtRoomXY(player.x - 20, player.y); // check if there's a hotspot 20 pixels away from player
int walk = GetWalkableAreaAtRoom((player.x, player.y); // find walkable area under player's feet



If you find any case that is not covered please report and we'll fix it.

Monsieur OUXX

Thanks! I didn't see that there was a "clipping=false" extra parameter in order to disable it. So it's perfect.

I was worried that people would have to rack their brains to tell the difference between a return value that means "there's nothing there in the room at the coordinates you asked -- outside of the viewport" and a return value that means "you asked for coordinates outside of the viewport but I'm teling you that there's nothing there at the force-clipped coordinates at the boundary of the viewport" -- thus causing human mistakes.

All is well.
 

Crimson Wizard

Quote from: Monsieur OUXX on Thu 28/02/2019 08:01:00
I was worried that people would have to rack their brains to tell the difference between a return value that means "there's nothing there in the room at the coordinates you asked -- outside of the viewport" and a return value that means "you asked for coordinates outside of the viewport but I'm teling you that there's nothing there at the force-clipped coordinates at the boundary of the viewport" -- thus causing human mistakes.

If you need to distinguish "no viewport"/"no room object" you may first do "Viewport.GetAtScreenXY()" and that will return Viewport* or null.

I want to underline that unless you are explicitly changing room viewport you normally should not be bothered about all this, since by default viewport is covering whole screen, as before. So you need to solve additional issues either if you have custom viewport (then you should be prepared), or if you want to use screen coordinates outside of the visible screen area for some reason (which is not a common thing to do).

And yes, games compiled with older script API (or in older AGS) will work as before.

Ghost

Just to let you know, AGS has never been this sexy. And this comes from a man who refused to go beyond "the last CJ build" for a decade. Good stuff there, especially the camera functionality should be fun to play around with!

Crimson Wizard

#246
I think we are approaching beta stage, but it's not just there yet, some planned cruicial functionality has still not been added. Maybe soon...

AGS 3.5.0 - Alpha 12

WARNING: some things were changed in room format again. Please make a full backup of your project before upgrading to this version and report if you notice anything wrong with how your rooms are saved and loaded in the editor and run within the game.


Zip archive: http://www.mediafire.com/file/8ktezbit4uuffab/AGS-3.5.0-alpha12-rebuild.zip/file


Changes since 3.5.0 alpha 11:

Common features:
- Deprecated relative assets resolutions: now sprites, rooms and fonts are considered to match game's resolution by default and not resized, unless running in backwards-compatibility mode.

Editor:
- Added "Allow relative asset resolutions" option to "Backwards Compatibility" section. Disabled by default, it makes game treat all sprites and rooms resolution as real one.
- Sprites have "Real" resolution type by default. "Low" and "High resolution" are kept for backwards compatibility only. When importing older games resolution type will be promoted to "Real" whenever it matches the game.
- Added MaskResolution property to Rooms. It ranges from 1:1 to 1:4 and lets you define the precision of Hotspot, Regions and Walkable Areas relative to room background.
   Warning: if you change this to lower precision (e.g. from 1:1 to 1:2) your mask may loose some pixels!
- Added "Default room mask resolution" to General Settings, which value will be applied to any room opened for editing in this game for the first time.
- Removed "Fonts designed for high resolution" option from General Settings. Instead added individual SizeMultiplier property to Fonts.
   NOTE: this is mostly useful for bitmap fonts. When using TTF you better just reimport them with higher point size.
- Fixed property pane displaying properties for room object when the character editor is active - if you changed character's StartingRoom outside of room editor.
- Fixed script compiler could leave extra padding inside the compiled scripts filled with random garbage if script strings contained escaped sequences like "\n" (this was not good for source control).
- Fixed crash when editor was updating file version in compiled EXE but failed and tried to report about that.

Script API
- Added Screen.RoomToScreenPoint, which returns the point on screen corresponding to the given room coordinates relative to the main viewport.
- Added SkipCutscene() and eSkipScriptOnly cutscene mode. This lets you skip cutscene by your own script rather than using automatic conditions.
- Deprecated DrawingSurface.UseHighResCoordinates. Also, assigning it will be ignored if game's "Allow relative asset resolutions" option is disabled.

Engine:
- Improved performance of hardware-accelerated renderers by not preparing a stage bitmap for plugins unless any plugin hooked for the particular drawing events.
- Reimplemented FRead and FWrite plugin API functions, should now work in 64-bit mode too.
- Completely removed old and unsupported record/replay functionality.
- Fixed potential bug which could cause DoOnceOnly tokens to be read incorrectly from a savedgame.
- Fixed DynamicSprite.SaveToFile() not appending ".bmp" if no extension was specified.
- Fixed IsMusicVoxAvailable() not working correctly in old games which use 'music.vox'.
- Added Scavenger's palgorithms plugin to the list of builtins, for ports that use ones.


KNOWN ISSUES:

- Reported by Snarky: need to find out which components need to be added to use AGS 3.5.0 on fresh Windows installation.
- Some weird sprite scaling bug in the room editor described in the posts above. According to user reports it may be fixed by restarting the editor. Unfortunately I was still unable to reproduce it on my own...
And of course the ones noted at github issue tracker: https://github.com/adventuregamestudio/ags/issues?q=is%3Aissue+is%3Aopen+label%3Abug





Quote from: Ghost on Fri 01/03/2019 09:59:57
Just to let you know, AGS has never been this sexy. And this comes from a man who refused to go beyond "the last CJ build" for a decade. Good stuff there, especially the camera functionality should be fun to play around with!

I think it is safe to tell now, I believe we are one step away from implementing multiple cameras, which may already be trivial except for defining where character speech should appear on screen, and maybe some other quirks which I could miss. This is not 100%, but I will definitely try to add this if time constraints won't prevent me.

Meanwhile, a small teaser of hard-coded cameras in a old test version :):
Spoiler
[close]

Neo_One

Will there be some kind of update for the Text parser?

Crimson Wizard

Quote from: Neo_One on Fri 05/04/2019 16:50:42
Will there be some kind of update for the Text parser?

What update do you have in mind? I did not have anything planned before.

Slasher

#249
I'm wondering why 'Exclude Room from Game' is no longer available....

As previously mentioned in the passed: Compiling a demo game from a full Game and only compiling Rooms that are not excluded and therefore reducing the Game exe when in Compiled folder.


I know that at one point this feature was 'buggy' as Chris reported...

Over to you Crimson.....

morganw

Quote from: Slasher on Fri 12/04/2019 08:26:44
I'm wondering why 'Exclude Room from Game' is no longer available....
Where would you normally find this option? I've not seen it before.

Crimson Wizard

Quote from: morganw on Fri 12/04/2019 10:39:23
Quote from: Slasher on Fri 12/04/2019 08:26:44
I'm wondering why 'Exclude Room from Game' is no longer available....
Where would you normally find this option? I've not seen it before.

It exists in 3.2.1. Never paid attention to this so idk when it dissapeared. But if it was in latest SVN version it might be possible to find out using git blame.
I believe it may work though. Room scripts are not connected to anything else, so this may be simply about not compiling / not merging into game data.

morganw

So it didn't disappear in the versions in this thread?

Quote from: Crimson Wizard on Fri 12/04/2019 11:38:58
Room scripts are not connected to anything else, so this may be simply about not compiling / not merging into game data.
Surely it breaks anything referencing the room directly, like ResetRoom?

Crimson Wizard

#253
Quote from: morganw on Fri 12/04/2019 11:50:45
Quote from: Crimson Wizard on Fri 12/04/2019 11:38:58
Room scripts are not connected to anything else, so this may be simply about not compiling / not merging into game data.
Surely it breaks anything referencing the room directly, like ResetRoom?

I meant that they won't cause any linking errors, game will run anyway. This is just as with any missing resource, if rest of the game can run without it then you may limit testing to script that does not address the room.

PS. we may also add DoesRoomExist function to script to test for a room (strange there's no such thing), which could also help with having optional game content.

morganw

Maybe such a thing would be better handled in the preprocessor?

Thinking about it a little harder, I guess you would just define a macro for DEMO and manage it yourself. Trying to do it in the scripting would probably mean every function call has to have a check around it 'if (DoesRoomExist(room)) { my_room_function() }', which doesn't really make sense when the result is always the same.

Crimson Wizard

#255
Quote from: morganw on Fri 12/04/2019 13:29:41
Maybe such a thing would be better handled in the preprocessor?

Thinking about it a little harder, I guess you would just define a macro for DEMO and manage it yourself. Trying to do it in the scripting would probably mean every function call has to have a check around it 'if (DoesRoomExist(room)) { my_room_function() }', which doesn't really make sense when the result is always the same.

It's up to the user to put these checks or not, and this is situational. It will probably not make sense for rooms that are basic part of the game, but may be useful for optional parts like add-ons and similar.

It's also a simple diagnostic tool, because right now there's no way to know if room resource is present or not at runtime. Rooms, as well as some other things in AGS, are designed to be able to add them as separate files into game directory.

EDIT: A possible example: someone likes to make a custom "go-to room selector" for game testing purposes. Right now they would have to hard-code room numbers. With DoesRoomExist or similar method they would be able to scan room numbers in a loop. Maybe a better solution is to return an array of available room indexes and even some other info (but in case of files on disk such info is potentialy volatile).

eri0o

About excluding a room, isn't the amount of storage occupied by a room like 10 sprites (5 frames plus masks) which is kind of insignificant versus the rest of the game, like a single music file will be the size of 20 rooms?

Crimson Wizard

#257
Quote from: eri0o on Fri 12/04/2019 17:03:15
About excluding a room, isn't the amount of storage occupied by a room like 10 sprites (5 frames plus masks) which is kind of insignificant versus the rest of the game, like a single music file will be the size of 20 rooms?

Depends, I guess. You may also omit full audio.vox if you like.
BTW that also may improve compilation time during testing period. Compiling room scripts take most of time afaik.

Crimson Wizard

#258
Still not "beta", yet did not want to delay update too much because there's a completely unplanned but interesting addition (see below).

I am currently trying to finalize multiple camera support. I gave myself around 1 week of time, and regardless of whether I make it or not we probably should officially announce 3.5.0 a beta as a next update, and then it will be testing + bug fixing + polishing existing features time.



AGS 3.5.0 - Alpha 13


Zip archive: http://www.mediafire.com/file/560eor7perwri0d/AGS-3.5.0-alpha13.zip/file
Linux build pack: https://www.dropbox.com/s/m0fpi4xa52vdp7v/AGS.3.5.0.9.Editor.Linux.Pack.zip?dl=0


Changes since 3.5.0 alpha 12:

Editor:
- Fixed Audio folders were displaying internal "AllItemsFlat" property on property grid.

Script API
- Implemented Dictionary and Set script classes supporting storage and lookup of strings and key/value pairs in sorted or unsorted way.
- Added Game.PlayVoiceClip() for playing non-blocking voice.

Engine:
- Removed 200 chars limit for DoOnceOnly token length.
- Reimplemented threaded audio, should now work correctly on all platforms.
- Made fps display more stable and timing correct when framerate is maxed out for test purposes.
- Fixed engine could not locate game data if relative path was passed in command line.
- Fixed GetLocationName returning trash instead of empty string when there's no viewport under the given coordinates.
- Temporarily removed Camera/Viewport from savedgames (there was a logic mistake in data format). I am planning to re-add them as soon as I implement multiple cameras (or after a short while if that takes too long).
- Fixed a bug in mp3/ogg decoder where it assumed creating an audiostream succeeded without actually testing one.

Linux:
- Support for OpenGL renderer.
- Use same FreeType library sources as Windows version, which suppose to fix TTF font glitches.
- Re-enabled threaded audio setting.


What is Dictionary and Set classes:

Dictionary class allows you to store string key/value pairs and look them up. Set class allows you to store unique strings that cannot repeat and check for their presence (or abscence).
Both classes support 4 modes, mode is constant and defined when you create a set or dictionary -
1) sorted, case-sensitive,
2) sorted, case-insensitive,
3) unsorted (undefined order), case-sensitive,
3) unsorted (undefined order), case-insensitive
Note that when we talk about case-sensitivity this only relates to keys. Values will always be same as you put them in.
Both classes can return their items in dynamic array (order of items in array will be same as in container).

Script example:
Spoiler

Code: ags

Dictionary *dic = Dictionary.Create(true, false); // create a sorted and case-insensitive dictionary
dic.Set("name", "Roger");
dic.Set("pos_x", "10");
dic.Set("pos_y", "20");

int pos_x = dic.Get("pos_x").AsInt;

[close]


KNOWN ISSUES:

- Reported by Snarky: need to find out which components need to be added to use AGS 3.5.0 on fresh Windows installation.
- Some weird sprite scaling bug in the room editor described in the posts above. According to user reports it may be fixed by restarting the editor. Unfortunately I was still unable to reproduce it on my own...
- Custom Viewport and Camera properties are not remembered in savegame. Temporary workaround is to save these in variables and restore custom camera in eEventRestoreGame event.
And of course the ones noted at github issue tracker: https://github.com/adventuregamestudio/ags/issues?q=is%3Aissue+is%3Aopen+label%3Abug



New multi-camera teaser:
;)
Spoiler

[close]

Crimson Wizard

Released Beta version, so closing this thread (continue here: https://www.adventuregamestudio.co.uk/forums/index.php?topic=57133.0)

For the reference, changes since last alpha 13 are:

- Support for multiple viewports and cameras.
- Moved Camera property to Game (because they ended up being in global game state rather than room's).
- Added Game.Camera, Game.Cameras and Game.CameraCount properties.
- Added Screen.Viewports, and Screen.ViewportCount properties.
- Added Camera.Create (static), Camera.Delete, Viewport.Create (static) and Viewport.Delete.
- Viewport's position is no longer limited by the visible screen (for example, you may move it half-offscreen if you like).
- Added Viewport.Visible and Viewport.ZOrder to help arranging multiple viewports on screen.

SMF spam blocked by CleanTalk