There is a new version of the forums ready for testing. Please post here if you're willing to help test!

Author Topic: MODULE: mode7 0.3.0  (Read 1377 times)

Re: MODULE: mode7 0.3.0
« Reply #20 on: 18 Apr 2022, 12:02 »
Overlays happened to be the most useful kind of object in todays AGS when you need a large number of moving and transformed (scaled etc) sprites on screen.
* overlays are designed unlimited (limited only by the program memory)
* they are rendered as a texture and thus accelerated by the graphics card (if you run with Direct3D / OpenGL render).
* it's a tiny structure without any superfluous properties that may screw logic up if not taken care of.

Before 3.6.0 room objects and characters could be more performant, as overlays did not support scaling for some reason, but since 3.6.0 beta Overlays may be scaled too
(https://www.adventuregamestudio.co.uk/forums/index.php?topic=59842.msg636645302#msg636645302)

PS. There's currently a serious issue remaining with overlays that they don't share a sprite reference, but make a bitmap copy; i believe this should be taken care of in the future.
« Last Edit: 18 Apr 2022, 12:57 by Crimson Wizard »

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: MODULE: mode7 0.3.0
« Reply #21 on: 18 Apr 2022, 13:14 »
But seriously, the ordering impacted more in frame rate when going for a low resolution. At low resolution, traversing the array for bubblesort took a ton of time. I attempted a quicksort too, but it did not improve at all (if you search the advanced technical forums I have done a quicksort in AGS script there at some point).

Ordering was very expensive to do on each frame, thus for dynamic sprite based software render in the module there's probably things to investigate in ordering algorithms.

Ah, so when working with overlays you just set the Z-order to be the distance, and the driver takes care of the sorting. I was thinking of the Z-order as the sorting order, and figured you would still need to re-sort them whenever you moved.

I think you could probably optimize something similar for the draw sorting, where you build the sort order as you calculate the object distances (and possibly leverage the idea that most things will remain in the same order as in the last frame), but clearly that adds a lot of complexity.

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • Best Innovation Award Winner 2021, for contributions to the ready-to-use UI designs and elements that mimic the most iconic designs we all know and love, most notably Tumbleweed Verbs and 9-verb MI Style UI, as well as additional UI helper modules such as CustomDialogGUI and ButtonHelper.
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: mode7 0.3.0
« Reply #22 on: 18 Apr 2022, 19:58 »
This module + demo games really looks super cool. I'd never thought to see mode7 that fluent with just plain AGS script.
But there's more to it than just drawing on an overlay instead of a room's surface, right?


And is there a particular thread discussing the new possibilities with overlays? All I remember is that when I did my weather module back in 2008, overlays were rather limited.

Re: MODULE: mode7 0.3.0
« Reply #23 on: 18 Apr 2022, 20:20 »
And is there a particular thread discussing the new possibilities with overlays?

There's not that much to mention, this is a relevant part of the change list (you may find it in the 3.6.0 release thread):
Quote
- Added Overlay.Width and Height properties, that let you freely scale existing Overlay.
- Added readonly Overlay.GraphicWidth and GraphicHeight properties that let read original overlay's graphic size (for textual overlays too).
- Added Overlay.Transparency property.
- Added Overlay.ZOrder property that lets you sort Overlays on screen among themselves and GUI.

EDIT: oh right, and also quite important
Quote
- Removed Overlay limit.

So basically overlays at the moment are the only graphical object in game that a) is not limited b) may be created and deleted in script.
« Last Edit: 18 Apr 2022, 20:57 by Crimson Wizard »

eri0o

Re: MODULE: mode7 0.3.0
« Reply #24 on: 18 Apr 2022, 20:23 »
Hum, I need to write the manual entry, but the gist is:

Overlays are unlimited (it used to be possible to have at maximum 20 overlays)
You can move them on screen, set width and height, and transparency. You can also set their Z order.

Other than this you can now access directly the portrait and text overlays used by the engine sierra speech (and other speech modes I think).


Here's an example game to play around:
keysAndCups.zip

Edit: CW answered too, but yeah. That does already makes it useful to do things. Like, I can probably do a cutdown version of my imgi module to provide a scripted hardware accelerated GUI if I remove the scrolling component from that module.

Here's a demo I placed hidden above: https://ericoporto.github.io/agsjs/trees/

Has to be run in a desktop computer with a mouse, WASD walks, C switches in and out of the Ship, mouse movement looks around or set direction. As you click, the game will enter fullscreen, and grab the mouse and set the mouse to infinity mode - this is still a bit hackish in the Web port, so as you exit the fullscreen the mouse will be released and not work in it anymore...
« Last Edit: 18 Apr 2022, 20:43 by eri0o »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • Best Innovation Award Winner 2021, for contributions to the ready-to-use UI designs and elements that mimic the most iconic designs we all know and love, most notably Tumbleweed Verbs and 9-verb MI Style UI, as well as additional UI helper modules such as CustomDialogGUI and ButtonHelper.
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: MODULE: mode7 0.3.0
« Reply #25 on: 18 Apr 2022, 20:44 »
Ah okay, thanks for the clarification.
I might have some more question, but I'll start a separate thread.

Back to topic ;)
« Last Edit: 18 Apr 2022, 20:46 by abstauber »