Author Topic: AGS4 cleanup branch  (Read 1055 times)

AGS4 cleanup branch
« on: 10 Oct 2017, 22:20 »
Note: this topic is mainly targeted to AGS source developers.

As you probably know if you've followed the recent developments, I've started a branch named AGS4 whose purpose is to clean up the codebase from the old dead code and legacy features.
This is a requisite for future development, because others, like me, have faced the despair of trying to add new stuff while keeping the old stuff from breaking.

So we should diverge, AGS 3.4.1 "Classic" will be mantained separately since it's feature complete and able to play older games, while AGS4 will be the foundation for new features and refactoring.

This is the current battle plan.

I've already cut away some nasty stuff, but much more remains.
The branch is in a working state. Note that to open projects they must be first upgraded through the latest 3.4.1. As always, be sure to make a backup of the project.

Alone I won't be able to see it to the end FOR I HATE CODING but if we can coordinate and help each other identifying and cutting away the rotting parts, it won't be too long until we can finally make the code easier to deal with.

You can find me on AGS discord if you wish to discuss, share doubts or ask questions.


- Alan

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with web design
    •  
  • selmiak worked on a game that was nominated for an AGS Award!
Re: AGS4 cleanup branch
« Reply #1 on: 13 Oct 2017, 18:28 »
I am no source dev but this is great! Keep it up!

Atavismus

  • Amiga Rulez!
  • Atavismus worked on a game that was nominated for an AGS Award!
Re: AGS4 cleanup branch
« Reply #2 on: 14 Oct 2017, 09:22 »
I am no source dev but this is great! Keep it up!
Same here.
Great initiative indeed.
I really hope several dev here could coordinate on a single project and make AGS a modern engine (but I know it's uneasy to make ppl agreed).
Good luck!

Danvzare

  • The Man with No Name
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with voice acting
    •  
Re: AGS4 cleanup branch
« Reply #3 on: 16 Oct 2017, 15:26 »
I am no source dev but this is great! Keep it up!
+1 (nod)

Snarky

  • Local Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: AGS4 cleanup branch
« Reply #4 on: 18 Oct 2017, 10:15 »
Yeah, sorry to not be any help on this, but I can at least add some suggestions for stuff to clean up:

The AGS general settings pane is littered with unnecessary switches, and even a lot of them that aren't explicitly identified as backwards-compatibility options should be rooted out. I'm thinking particularly of "Automatically move the player in Walk mode", "Automatically walk to hotspots in Look mode" and "Override built-in inventory window click handling": there's no reason to provide any built-in behavior here rather than just script it in the appropriate game templates. It's just one more complicating factor when a developer has to try to figure out how the engine behaves. Similarly, the GUI visibility setting "When mouse moves to top of screen" should be eliminated. All this stuff is legacy from when AGS was an engine squarely focused on making games in the  Sierra SCI style, and it is superseded by newer, more general functionality.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
  • Radiant worked on a game that was nominated for an AGS Award!Radiant worked on a game that won an AGS Award!
Re: AGS4 cleanup branch
« Reply #5 on: 24 Oct 2017, 20:10 »
From this old bug report: almost nobody uses MIDI any more, and as a result numerous Windows/Linux systems don't come with MIDI drivers by default. However, AGS insists on initializing a MIDI driver on startup (as well as a MOD and XM driver), and if this fails then depending on system AGS may abort, or refuse to play any music at all (including OGG/MP3 music).

Likewise, I have no idea why the Preload image must be in the long-obsolete PCX format (last updated in 1991).

On the other hand, I'm not sure if I see the point in removing aliases to functions (e.g. RawDrawLine to Room.GetDrawingSurfaceForBackground().Drawline) when all the alias does is call an existing and retained function with some default parameters. It seems to me that all this does is make your new version less accessible to existing coders.

Re: AGS4 cleanup branch
« Reply #6 on: 24 Oct 2017, 21:06 »
On the other hand, I'm not sure if I see the point in removing aliases to functions (e.g. RawDrawLine to Room.GetDrawingSurfaceForBackground().Drawline) when all the alias does is call an existing and retained function with some default parameters. It seems to me that all this does is make your new version less accessible to existing coders.

Perhaps it's so, but since the ultimate aim is to refactor and improve, the less is there to keep track of, the better. It'll be chance to redo some things differently, for example I'd like to have audioclip instances instead of being returned an enigmatic audiochannel that may or may not be what I had instanced it from, colors should be 32bit and not 16bit + hacks for the first slots, etc.
AGS Classic is not going anywhere and AGS4 is a long term project.

In the meanwhile I think it's not a bad thing to put a stop to the use of deprecated functions, they confuse new users.

- Alan

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: AGS4 cleanup branch
« Reply #7 on: 24 Oct 2017, 21:29 »
From this old bug report: almost nobody uses MIDI any more, and as a result numerous Windows/Linux systems don't come with MIDI drivers by default. However, AGS insists on initializing a MIDI driver on startup (as well as a MOD and XM driver), and if this fails then depending on system AGS may abort, or refuse to play any music at all (including OGG/MP3 music).

I've mentioned this before, that it is not AGS that insists on initializing MIDI anymore. There is one Allegro API function that initializes all sounds, and all AGS can do is to try it with different parameters (MIDI/DIGI, no MIDI/DIGI MIDI/ no DIGI, etc) until it returns positive answer.
Some strange logic in Allegro library, that I could not understand at the time, prevents DIGITAL sound initialzation in case if MIDI support, or something related to it, is missing.

Either Allegro should be investigated and fixed, or AGS needs to move to another library, even if using another library (-ies) for sound only.
« Last Edit: 24 Oct 2017, 22:10 by Crimson Wizard »

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
  • Radiant worked on a game that was nominated for an AGS Award!Radiant worked on a game that won an AGS Award!
Re: AGS4 cleanup branch
« Reply #8 on: 25 Oct 2017, 10:59 »
I've mentioned this before, that it is not AGS that insists on initializing MIDI anymore. There is one Allegro API function that initializes all sounds, and all AGS can do is to try it with different parameters (MIDI/DIGI, no MIDI/DIGI MIDI/ no DIGI, etc) until it returns positive answer.
That's a good point, but it may be that the first function call (for MIDI+DIGI both, if I understand correctly) is causing problems in Allegro.

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: AGS4 cleanup branch
« Reply #9 on: 25 Oct 2017, 13:43 »
I've mentioned this before, that it is not AGS that insists on initializing MIDI anymore. There is one Allegro API function that initializes all sounds, and all AGS can do is to try it with different parameters (MIDI/DIGI, no MIDI/DIGI MIDI/ no DIGI, etc) until it returns positive answer.
That's a good point, but it may be that the first function call (for MIDI+DIGI both, if I understand correctly) is causing problems in Allegro.

Yes, it could be; I think this may be tested out by disabling MIDI in setup file ("midiid = 0"), then sound init will be called with DIGI/ no MIDI at the first try. If that works, unlike other attempts, then adding a MIDI-disabling switch will have an actual meaning.

Snarky

  • Local Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: AGS4 cleanup branch
« Reply #10 on: 30 Oct 2017, 08:19 »
Another thing to get rid of in 4.0: The "Run the next loop after this" option in the view editor, which is unnecessary since we can have unlimited frames per loop, and only causes confusion.

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
  • Radiant worked on a game that was nominated for an AGS Award!Radiant worked on a game that won an AGS Award!
Re: AGS4 cleanup branch
« Reply #11 on: 30 Oct 2017, 09:40 »
More legacy switches that could be deprecated:
* Anything related to 16-bit color depth
* Right-to-left operator precedence (the checkbox left-to-right defaults to ON, but AGS 2.6 and earlier assume right-to-left)
* Any alpha blending other than "proper"
* Non-anti-aliased TTF fonts
* Split resource files every X megabytes (a setting meant to distribute your game on floppy disks...)
* Being able to set for every individual sound and music file if it should be inside the EXE or not
* Integration with the Vista Game Explorer (which doesn't exist in newer windows versions), as well as the -registergame parameter
* Enhanced saved games should be on (the only reason not to is to save a bit of disk space)
* The low defaults for maximum sprite cache

Re: AGS4 cleanup branch
« Reply #12 on: 30 Oct 2017, 20:36 »
Operator precedence and alpha blendings other than "proper" have already been disposed.
Don't know about aliased ttf fonts, some might be designed to look good, assuming font hinting is in effect.
Splitting resource files might still have meaning, if the order of the resources is always the same. Could help when updating a game through steam, maybe.
Game Explorer is probably dead, so yeah we could get rid of it.
Enhanced save games is the option to double click on the save files to open them with the game, I don't think you were meaning that.

I also agree with Snarky about those old built-ins functionalities that would need a good look over

- Alan
« Last Edit: 31 Oct 2017, 07:30 by Alan v.Drake »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: AGS4 cleanup branch
« Reply #13 on: 31 Oct 2017, 00:21 »
* Non-anti-aliased TTF fonts
Don't know about aliased ttf fonts, some might be designed to look good, assuming font hinting is in effect.
I am also not sure about this, I recall seeing certain troubles with TTF anti-aliasing. That may depend on font, the size it is scaled to, and on library used to AA them (latest FreeFont used on Linux versus older version currently used on Windows).
Perhaps making Anti-aliasing an individual font's property could be a better decision? By the way, if I remember correctly, it is even technically possible to toggle font's AA at runtime.


* The low defaults for maximum sprite cache
Current new default is 128 MB.
« Last Edit: 31 Oct 2017, 00:23 by Crimson Wizard »

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: AGS4 cleanup branch
« Reply #14 on: 09 Nov 2017, 13:42 »
I agree with everything above, except (maybe) these:


* Non-anti-aliased TTF fonts
Don't know about aliased ttf fonts, some might be designed to look good, assuming font hinting is in effect.
I am also not sure about this

Me neither. Don't some people use this to generate multi-colored fonts? if there is an automated antialiasing it might mess uptheir carefully crafted font.


* Being able to set for every individual sound and music file if it should be inside the EXE or not
I don't this topic well enough : Couldn't that be helpful to upgrade just the EXE of a game without downloading the entire game again? I favor the principle of storing the resources outside of the EXE.
« Last Edit: 09 Nov 2017, 13:45 by Monsieur OUXX »
 

Radiant

  • AGS Baker
  • Mittens Knight
  • Return once more to the Two Kingdoms!
    • I can help with publishing
    •  
    • I can help with story design
    •  
  • Radiant worked on a game that was nominated for an AGS Award!Radiant worked on a game that won an AGS Award!
Re: AGS4 cleanup branch
« Reply #15 on: 18 Nov 2017, 13:09 »
I don't this topic well enough : Couldn't that be helpful to upgrade just the EXE of a game without downloading the entire game again? I favor the principle of storing the resources outside of the EXE.
I understand the point of not having certain resources inside the EXE.

I do not understand the point of setting for each individual sound file whether that particular sound file should be inside the EXE or not. In practice you either turn it on for ALL files, or off for ALL files.