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

#1561
Ok, I reverted to SDL 2.28, and now the CI build seems to be working. If anyone is interested to try the new video commands out, here's a download link:

https://cirrus-ci.com/task/4992651611602944
#1562
Quote from: imagazzell on Wed 28/02/2024 07:03:37My apologies if this has been addressed elsewhere that I couldn't find (I did search), or if this is the wrong place to be asking, but has the Sprite Cache size limit been increased at all in either 3.6.0 or this new build, or is it still capped at 512 MB, as in 3.5.1?

Hello. The Sprite Cache size was never capped in the engine. What is limited is the numbers shown in "setup" program, which are chosen arbitrarily, judging by the average AGS games demand. But it's still possible to set your own value in the "Default Setup" pane in the editor, or config file directly.

Another thing to keep in mind is that AGS engine was a 32-bit program, and could not exceed 2 GB of total memory on Windows.


Quote from: imagazzell on Wed 28/02/2024 07:03:37My game is hi-res and has a number of big (both in dimensional size and length) animations, and runs like a slug on some systems. I imagine a larger cache size limit (at least 1 GB / 1024 MB), in addition to the other performance enhancements you guys have been working on, could help.

There are few things to mention here about 3.6.1 version.
1. The selection in setup program has been increased to 1 GB for a 32-bit engine and 2 GB for a 64-bit engine.
2. Besides sprite cache, there's now a "texture cache" that speeds up game run with Direct3D/OpenGL renderers, and for those renderers it's now more important than the sprite cache. Often it's better to keep texture cache at high values (if you have enough system and video card memory), and sprite cache at moderate levels.
3. OTOH, caches help when images and animations repeat. But they don't help when animation or image is shown for the first time, because loading takes time. For this purpose we added experimental functions called Game.PrecacheSprite and Game.PrecacheView. These are meant to be cache number of sprites or views prior to certain scene, e.g. during some "loading" screen.
4. The 32-bit engine for Windows is now built with a certain flag, which lets it use up to 4 GB of RAM. In theory one may also use 64-bit engine that can use even more than that, but we do not distribute it along with AGS Editor at the moment, there are some remaining organizational issues. Maybe we eventually will do this.


All that said, I usually advise to also look for opportunities to optimize the game. There may be ways to reduce amount of memory an animation requires, thus reducing time it is loaded and prepared for display, and increase number of animations which may be loaded into a cache.
#1563
Are you using standard InventoryWindow control to display items, or something else?

If the standard one, then the first thing I'd check is ItemWidth and ItemHeight properties in your InventoryWindow.

If these are not the case, then please post your on_mouse_click script where you coded item selection.
#1564
I did not have an internet connection for couple of days, but now I was able to push a proper script API. Here's how it looks like:

Code: ags
enum PlaybackState {
  ePlaybackOn = 2,
  ePlaybackPaused = 3,
  ePlaybackStopped = 4
};

builtin managed struct VideoPlayer {
  import static VideoPlayer* Open(const string filename, bool autoPlay=true, RepeatStyle=eOnce);
  /// Starts or resumes the playback.
  import void Play();
  /// Pauses the playback.
  import void Pause();
  /// Advances video by 1 frame, will pause video when called.
  import void NextFrame();
  /// Changes playback to continue from the specified frame.
  import void SeekFrame(int frame);
  /// Changes playback to continue from the specified position in milliseconds.
  import void SeekMs(int position);
  /// Stops the video completely.
  import void Stop();

  /// Gets current frame index.
  import readonly attribute int Frame;
  /// Gets total number of frames in this video.
  import readonly attribute int FrameCount;
  /// Gets this video's framerate (number of frames per second).
  import readonly attribute float FrameRate;
  /// Gets the number of sprite this video renders to.
  import readonly attribute int Graphic;
  /// The length of the currently playing video, in milliseconds.
  import readonly attribute int LengthMs;
  /// Gets/sets whether the video should loop.
  import attribute bool Looping;
  /// The current playback position, in milliseconds.
  import readonly attribute int PositionMs;
  /// The speed of playing (1.0 is default).
  import attribute float Speed;
  /// Gets the current playback state (playing, paused, etc).
  import readonly attribute PlaybackState State;
  /// The volume of this video's sound, from 0 to 100.
  import attribute int Volume;
};

Basic code example now is:
Code: ags
VideoPlayer *video = VideoPlayer.Open("video.ogv", true, eRepeat);
if (video)
{
    Overlay *over = Overlay.CreateGraphical(0, 0, video.Graphic);
    Wait(100);
    over = null;
    video = null;
}

Most of the functionality works, except Seek, and few less important getters.
I found that APEG does not provide a Seek function, so either it has to be added there, or we should look for a different library for working with ogg theora decoder, or even write one ourselves. Maybe this should be a next task after this API is implemented.




On a side note, I have some problems with my PC, it looks like one of my hard-drives is dying, which causes all kinds of weird problems (i just did not figure out whether it's a system drive, or other one). So I may be disappearing sometimes.




Quote from: eri0o on Mon 26/02/2024 20:23:09
Quote from: Crimson Wizard on Sat 24/02/2024 05:24:21Of course the sync mechanism should still be implemented later for safety.

I am curious what would this sync mechanism be, would this require one thread to talk with the other through some messaging?

The basic idea is to count how much video and audio had played in time units, and when the difference reaches certain threshold, then either skip the data from one that is behind, or pause the one that got ahead.
#1565
Default AGS transitions are blocking everything in the room, including background animations. Maybe this is not a particularly good design, but so it is right now.

If you like a different behavior, then make your own transition effect:
1. Set AGS transition to Instant.
2. Create a empty fullscreen GUI with black background.
3. In "before fade-in" event set GUI visible and Transparency 0.
4. In "after fade-in" event emulate fading effect changing GUI's Transparency from 0 to 100 in a loop, and remove it completely after with Visible = false.

Use "on_event" global function in GlobalScript instead of room events, this way you won't have to repeat same code in each room:
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Event.html#on_event

Code: ags
function on_event(int event, int data)
{
    if (event == eEventEnterRoomBeforeFadein)
    {
        gFadeOut.Visible = true;
        gFadeOut.Transparency = 0;
    }
    else if (event == eEventEnterRoomAfterFadein )
    {
        while (gFadeOut.Transparency < 100)
        {
            // adjust numbers to change the fade-in speed
            gFadeOut.Transparency = gFadeOut.Transparency + 2;
            Wait(1);
        }
        gFadeOut.Visible = false;
    }
}

You may do opposite (fadeout) effect on eEventLeaveRoom event.
#1566
Quote from: WiseFrog on Sun 25/02/2024 20:26:51I tried to use that module before but I don't really understand how to use it correctly.

To be fair, that module's organization and explanation may be complicated, it was not the most successful module design, and I have this problem that I tend to document things in overly technical manner... Maybe it has to be rewritten.

I suggest to skip to TypedTextHelper description, and stick to using its functions.
I think that in your case it might be something like:

Code: ags
int tw_id = lText.Typewriter(text, eNoBlock);
// Wait while typewriter is running and no mouse or key is pressed by player
while (TypewriterRunners.IsActive[tw_id] && WaitMouseKey(1) == 0) { }
// Interrupt typewriter if it was still running
if (TypewriterRunners.IsActive[tw_id])
    TypewriterRunners.Cancel(tw_id);


But then, your own code seems almost working, except you do not have to write your own WaitUntilKeyPressed, and just use existing WaitMouseKey or WaitInput AGS function.
#1567
Yes, what Khris said, Display is for showing blocking text only, for non-blocking display there are several variants:
- GUI with a label;
- textual Overlays;
- drawing over a DrawingSurface (like, on a sprite, or room background);
#1568
Quote from: keithfishbiscuit on Sun 25/02/2024 13:52:59What would happen if I load a view resolution of HD quality image or above into the panorama module or panorama3d?

You could simply try yourself and tell what happened :).
#1569
Format is one way, another is Append:

Code: ags
String s = "one";
s = s.Append("two");
s = s.Append("three");

Which to use is usually a matter of convenience, but I think that a single Format runs faster than multiple Appends, because each Append creates a new String copy.
#1570
Quote from: eri0o on Sat 24/02/2024 17:06:24Kinda itching to find some library that can handle this in a performant effective way to do this in a higher resolution through a plugin. I think it still would be something around 1280 x 720 if besides the plugin it's wanted to have animations and things going on...

If in plugin, then this might be done "simply" by rendering a real 3D box. There's an example of a D3D & SpriteVideo plugins that render textures on screen. But it should also be possible to render a 3D scene to a texture, and let display that texture anywhere.

To be fair, AGS could also do that, except there's no script API to set such things up.
#1571
Quote from: Rik_Vargard on Sat 24/02/2024 11:51:27I export my videos at 30fps so it could be some frames problem but I'm not sure; I didn't think about that.

The video that you linked in that other forum thread ("End Credits 01") appears to be 24 fps. This may be found by checking Media Info in a video player program.
#1572
So, I completely forgot about this issue, but something I realized while experimenting with video playback is that currently AGS stores framerate as a integer, which may cause it to loose precision. E.g. videos sometimes have weird framerate like 29.97, and saving that as an integer would convert it to 29, loosing ~1 frame per second.
(I think this should be fixed in an upcoming version 3.6.1.)

I wonder if something similar happens here too... but maybe this is a separate problem.

While I remember about this, I should finally check out the video that @Rik_Vargard posted in another thread.
#1573
Quote from: eri0o on Sat 24/02/2024 00:56:02I noticed that further in the video it becomes noticeable there is some audio and video desync. I don't know if this is an SDL problem though, maybe it's better to wait they solve your issue before looking into the desync...

Alright, so this is happening simply because fps was stored as int, loosing precision (your video has a framerate of 29.97, which means it lost ~1 frame per second when converting). Pushed a fix for this, and now it plays fine to the end. Of course the sync mechanism should still be implemented later for safety.
#1574
Quote from: eri0o on Sat 24/02/2024 00:56:02I noticed that further in the video it becomes noticeable there is some audio and video desync. I don't know if this is an SDL problem though, maybe it's better to wait they solve your issue before looking into the desync...

Video player must have a desync check itself in any case, comparing total length of audio and video output.

Quote from: eri0o on Sat 24/02/2024 00:56:02One curious thing though, I set the Overlay width and height once - the video is 640x360 but I resize down the overlay to 320x180. I thought I would had to keep resizing the overlays in rep_exec_always but it turns out it's keeping the size even though the graphic is updated. I am mentioning this because I think it was discussed at some point what happens when a new sprite slot is set to the overlay but I don't remember if this is intended or not when the sprite slot is kept but just it's contents are updated.

Overlay should keep the size so long as that's the same sprite slot assigned.
#1575
Well, I opened a ticket for them: https://github.com/libsdl-org/SDL/issues/9127

No idea yet whether this is because of the error in Scalar conversion functions that they already fixed, or it's just a coincidence.
#1576
They have the actual commit that sais "Fixed memory corruption when resampling S16 t F32" (and this is the case with the video):
https://github.com/libsdl-org/SDL/commit/384fcea585573db4e5707c249746008f25a0fbac

I noticed that when I build SDL, it comes with SSE2 functions, such as SDL_Convert_S16_to_F32_SSE2.
The fix was related to SDL_Convert_S16_to_F32_Scalar. As a theoretical possibility, maybe this function will run if one builds SDL2 without SSE2 support. Or maybe some other reason why it would fallback to the Scalar functions.

I wish there were a way to tell which conversion func is getting called at runtime.
#1577
Quote from: eri0o on Fri 23/02/2024 15:43:32https://github.com/libsdl-org/SDL/issues/9099

This issue is about audio format AUDIO_S8, the APEG has audio in AUDIO_S16SYS.
#1578
Quote from: keithfishbiscuit on Fri 23/02/2024 16:09:34I see, may be I was not being 100% clear, I am aiming using pre rendered graphic, myst exile used pre rendered graphic as well, just panorama, and I am hoping the panorama module can do some magic for me...

Panorama module renders 3D "box" in real-time (of course it uses prepared wall graphics), but it does this with ags script and "software drawing" (drawing pixels and parts of bitmaps on bitmaps), and this is slow without graphics card acceleration.

I was not aware of "Myst Exile", checking this now, it seems to have either real-time 3D scenes, or some tricks to emulate these...
#1579
Quote from: keithfishbiscuit on Fri 23/02/2024 15:19:51how high resolution can panorama module can support these days?? been thinking doing a game like myst exile with riven style more realism graphic...but want to pump up the resolution

Given it draws 3D in script, using "software drawing", that will load CPU instead of relying on graphics card, and is pretty slow. It will slow down linearly with the increase of resolution.
I recall that the old 320x200 game using this module ran on around 28-30 fps for me in AGS 3.6.1. It will get only slower if resolution increases.

For a hi-res 3D in AGS I would recommend writing a plugin that can draw proper 3D gfx using Direct3D or OpenGL. Or use a different engine.

On another hand, as far as I know, "Myst" did not use real-time 3D rendering. Instead it was using prerendered backgrounds. You can do same with AGS without a problem.
#1580
I found that it works with the old SDL2.dll (2.28.0) which I've been using for a while, but not with the SDL2.dll which comes from the CI (2.30.0).

EDIT:
The crash is happening when calling SDL_ConvertAudio with the new SDL2 2.30.

EDIT2:
The regular music plays, so this is either something specific to the sound format that the particular video uses, or any mistake in sound processing that did not cause trouble until now.
SMF spam blocked by CleanTalk