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 - eri0o

#621
The Rumpus Room / Re: Guess the TV show
Sun 22/11/2020 14:43:41
Correct!  :-D (I will now wait indefinitely for a 3rd season :P)
#622
The Rumpus Room / Re: Guess the TV show
Sun 22/11/2020 02:15:07
one more of the same show.

#623
The Rumpus Room / Re: Guess the TV show
Sat 21/11/2020 00:16:10
(I really liked that season!) Here's mine:

#624
The Rumpus Room / Re: Guess the TV show
Fri 20/11/2020 21:01:46
The Crown?
#626
Hey Olleh19, I still need to figure out Flugerdufel problem. I use this module in my game, like my main use case is myself, which means if the problem doesn't affect me I tend to postpone solving - most from simply lack of time.

So you need to set the target character, basically the variable player points to a character, say cBob, when you assign player as target character, Rellax.TargetCharacter = player, you are actually assigning Rellax.TargetCharacter = cBob. Let's say now you change the player to cAlice, cAlice.SetAsPlayer(), NOW the player pointer will point to cAlice. But you have previously assigned the TargetCharacter as cBob. So you need to actually do something like this when changing player character:

Code: ags
cAlice.SetAsPlayer();
Rellax.TargetCharacter = player;


About parallax scrolling being stuttery it will depend on many things so I can't comment. I recommending using SetGameSpeed(60). Basically the parallax is an illusion and the math is made simple, the object posx/posy (X position, Y position) is increased/decreased (divided by 100, this way I mentally think in percentages) an additional amount when the camera scrolls. The code is simple enough to be posted below, I find it easy to follow. The pxo are the room objects, the variable naming is stolen from Ali's module.

Code: ags
void doObjectParallax(){
  int camx = _final_cam_x;
  int camy = _final_cam_y;

  for(int i=0; i<_pxo_count; i++){
    float parallax_x = IntToFloat(_pxo[i].GetProperty("PxPos"))/100.0;
    float parallax_y = IntToFloat(_pxo[i].GetProperty("PyPos"))/100.0;

    _pxo[i].X=_pxoOriginX[i]+FloatToInt(IntToFloat(camx)*parallax_x);
    _pxo[i].Y=_pxoOriginY[i]+FloatToInt(IntToFloat(camy)*parallax_y);
  }
}


So you set the room objects custom properties, and then you basically only use Rellax.EnableParallax = true on Room Load and you are done.
#627
@Flugeldufel Thanks, I had never noticed that issue.

It happens if you get to a lower than 12 distance between Current Camera Position and the Wanted Camera Position apparently.

For now you can replace the rellax.asc file with the content below.

rellax.asc

Spoiler
Code: ags
// Rellax
// 0.1.5~
// A module to provide smooth scrolling and parallax!
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// Before starting, you must create the following Custom Properties
// in AGS Editor, for usage with Objects.
// Just click on Properties [...] and on the Edit Custom Properties screen,
// click on Edit Schema ... button, and add the two properties below:
//
// PxPos:
//    Name: PxPos
//    Description: Object's horizontal parallax
//    Type: Number
//    Default Value: 0
//
// PyPos:
//    Name: PyPos
//    Description: Object's vertical parallax
//    Type: Number
//    Default Value: 0
//
//  The number defined on Px or Py will be divided by 100 and used to increase
// the scrolling. An object with Px and Py 0 is scrolled normally, an object
// with Px and Py 100 will be fixed on the screen despite camera movement.
//
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//
// based on Smooth Scrolling + Parallax Module
// by Alasdair Beckett, based on code by Steve McCrea.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

#define MAX_PARALLAX_OBJS 39

Character *_TargetCharacter;

Object *_pxo[MAX_PARALLAX_OBJS];
int _pxoRoomStartX[MAX_PARALLAX_OBJS];
int _pxoRoomStartY[MAX_PARALLAX_OBJS];
int _pxoOriginX[MAX_PARALLAX_OBJS];
int _pxoOriginY[MAX_PARALLAX_OBJS];
int _pxo_count;

int _cam_window_w, _cam_window_h;
float _scroll_x,  _scroll_y;
int _next_cam_x, _next_cam_y;
int _prev_c_x, _prev_c_y;
int _off_x, _off_y;
int _look_ahead_x = 48;
int _look_ahead_y = 16;

int _partial_c_height;
int _count_still_ticks;

bool _is_doRoomSetup;
bool _SmoothCamEnabled = true;
bool _ParallaxEnabled = true;

float _Abs(float v) {
  if(v<0.0) return -v;
  return v;
}

int _Lerp(float from, float to, float t) {
  return FloatToInt(from + (to - from) * t, eRoundNearest);
}

int _ClampInt(int value, int min, int max) {
  if (value > max) return max;
  else if (value < min) return min;
  return value;
}

void doObjectParallax(){
  int camx = _next_cam_x;
  int camy = _next_cam_y;

  for(int i=0; i<_pxo_count; i++){
    if(_pxo[i].GetProperty("PxPos") !=0 || _pxo[i].GetProperty("PyPos") != 0) {
      float parallax_x = IntToFloat(_pxo[i].GetProperty("PxPos"))/100.0;
      float parallax_y = IntToFloat(_pxo[i].GetProperty("PyPos"))/100.0;

      _pxo[i].X=_pxoOriginX[i]+FloatToInt(IntToFloat(camx)*parallax_x);
      _pxo[i].Y=_pxoOriginY[i]+FloatToInt(IntToFloat(camy)*parallax_y);
    }
  }
}

void _enable_parallax(bool enable) { 
  _ParallaxEnabled = enable;
}

void _enable_smoothcam(bool enable) {
  if(enable == true){
    doObjectParallax();
  }

  _SmoothCamEnabled = enable;  
}

void _set_targetcharacter(Character* target) {
  _TargetCharacter = target;
}

// ---- Rellax API ------------------------------------------------------------

void set_TargetCharacter(this Rellax*, Character* target)
{
  _set_targetcharacter(target);
}

Character* get_TargetCharacter(this Rellax*)
{
  return  _TargetCharacter;
}

void set_EnableParallax(this Rellax*, bool enable)
{ 
  _enable_parallax(enable);
}

bool get_EnableParallax(this Rellax*)
{
  return _ParallaxEnabled;
}

void set_EnableSmoothCam(this Rellax*, bool enable)
{ 
  _enable_smoothcam(enable);
}

bool get_EnableSmoothCam(this Rellax*)
{
  return _SmoothCamEnabled;
}

void set_CameraOffsetX(this Rellax*, int offset_x)
{ 
  _off_x = offset_x;
}

int get_CameraOffsetX(this Rellax*)
{
  return _off_x;
}

void set_CameraOffsetY(this Rellax*, int offset_y)
{ 
  _off_y = offset_y;
}

int get_CameraOffsetY(this Rellax*)
{
  return _off_y;
}

void set_CameraLookAheadX(this Rellax*, int look_ahead_x)
{ 
  _look_ahead_x = look_ahead_x;
}

int get_CameraLookAheadX(this Rellax*)
{
  return _look_ahead_x;
}

void set_CameraLookAheadY(this Rellax*, int look_ahead_y)
{ 
  _look_ahead_y = look_ahead_y;
}

int get_CameraLookAheadY(this Rellax*)
{
  return _look_ahead_y;
}

// ----------------------------------------------------------------------------

void doSetOrigins (){
  _pxo_count=0; // Reset the total number of parallax objects to zero
  float cam_w = IntToFloat(Game.Camera.Width);
  float cam_h = IntToFloat(Game.Camera.Height);
  float room_w = IntToFloat(Room.Width);
  float room_h = IntToFloat(Room.Height);

  for(int i=0; i<Room.ObjectCount; i++){
    if (object[i].GetProperty("PxPos")!=0) {
 			_pxo[_pxo_count]=object[i];
      float parallax_x = IntToFloat(object[i].GetProperty("PxPos"))/100.0;
      float parallax_y = IntToFloat(object[i].GetProperty("PyPos"))/100.0;

      float obj_x = IntToFloat(object[i].X);
      float obj_y = IntToFloat(object[i].Y);

      // initial positions for reset
      _pxoRoomStartX[_pxo_count]= object[i].X;
      _pxoRoomStartY[_pxo_count]= object[i].Y;

      //Set origin for object:
      _pxoOriginX[_pxo_count] = object[i].X -FloatToInt(
        parallax_x*obj_x*(room_w-cam_w) / room_w );

      _pxoOriginY[_pxo_count] = object[i].Y -FloatToInt(
        parallax_y*obj_y*(room_h-cam_h) / room_h );

			if(_pxo_count<MAX_PARALLAX_OBJS) _pxo_count++;
		}
   }
  doObjectParallax();
}

void doRoomSetup(){
  Game.Camera.X = _ClampInt(_TargetCharacter.x-Game.Camera.Width/2, 
    0, Room.Width-Game.Camera.Width);

  Game.Camera.Y = _ClampInt(_TargetCharacter.y-Game.Camera.Height/2, 
    0, Room.Height-Game.Camera.Height);

  _next_cam_x = Game.Camera.X;
  _next_cam_y = Game.Camera.Y;
  doSetOrigins();

  ViewFrame* c_vf = Game.GetViewFrame(_TargetCharacter.NormalView, 0, 0);
  float scaling = IntToFloat(GetScalingAt(_TargetCharacter.x, _TargetCharacter.y))/100.00;
  _partial_c_height = FloatToInt((IntToFloat(Game.SpriteHeight[c_vf.Graphic])*scaling)/3.0);

  if (_ParallaxEnabled) _enable_parallax(true);
  else _enable_parallax(false);
  _is_doRoomSetup = true;
}

void doSmoothCameraTracking(){
  if(_prev_c_x == _TargetCharacter.x && _prev_c_y == _TargetCharacter.y)
    _count_still_ticks++;
  else
    _count_still_ticks = 0;

  if(_TargetCharacter.x-Game.Camera.Width/2-Game.Camera.X<=-_cam_window_w/2 ||
     _TargetCharacter.x-Game.Camera.Width/2-Game.Camera.X>_cam_window_w/2 ||
     _TargetCharacter.y-Game.Camera.Height/2-Game.Camera.Y<=-_cam_window_h/2 ||
     _TargetCharacter.y-Game.Camera.Height/2-Game.Camera.Y>_cam_window_h/2 ||
     _count_still_ticks > 5){

    int x_focus=0,y_focus=0;
    if(_TargetCharacter.Loop == 2) x_focus = _look_ahead_x; // right
    else if(_TargetCharacter.Loop == 1) x_focus = -_look_ahead_x; // left
    else if(_TargetCharacter.Loop == 0) y_focus = _look_ahead_y; // down
    else if(_TargetCharacter.Loop == 3) y_focus = -_look_ahead_y; // up

    float y_multiplier;
    if(_count_still_ticks<=30) y_multiplier = IntToFloat(_count_still_ticks)*0.138 ;
    if(_count_still_ticks>30) y_multiplier = 5.0;

    float target_cam_x = IntToFloat(_ClampInt(_TargetCharacter.x + _off_x + x_focus - Game.Camera.Width/2,   0, Room.Width-Game.Camera.Width));
    float target_cam_y = IntToFloat(_ClampInt(_TargetCharacter.y + _off_y + y_focus - _partial_c_height - Game.Camera.Height/2,   0, Room.Height-Game.Camera.Height));
    float current_cam_x =  IntToFloat(Game.Camera.X);
    float current_cam_y =  IntToFloat(Game.Camera.Y);
    float lerp_factor_x = 0.04;
    float cam_distance_x = _Abs(target_cam_x - current_cam_x);
    
    if( cam_distance_x < 32.0 && cam_distance_x >= 1.0) {
      lerp_factor_x  = 0.913*Maths.RaiseToPower(cam_distance_x, -0.7268);
    }    

    _next_cam_x = _Lerp( current_cam_x, target_cam_x, lerp_factor_x );
    _next_cam_y = _Lerp( current_cam_y, target_cam_y, 0.01*y_multiplier);
  }

  _prev_c_x = _TargetCharacter.x;
  _prev_c_y = _TargetCharacter.y;
}

// --- callbacks --------------------------------------------------------------

function on_event (EventType event, int data){
  // player exits any room
  if (event==eEventLeaveRoom){
    for(int i=0; i<_pxo_count; i++){
      _pxo[i].X=_pxoRoomStartX[i];
      _pxo[i].Y=_pxoRoomStartY[i];
    }
    _is_doRoomSetup = false;
  }

  // player enters a room that's different from current
	if (event==eEventEnterRoomBeforeFadein){
    if(!_is_doRoomSetup){
      doRoomSetup();
    }
  }
}

function game_start(){
  
  System.VSync = true;
  _cam_window_w = 40;
  _cam_window_h = 40;
  _set_targetcharacter(player);
  _enable_parallax(true);
  _enable_smoothcam(true);
}

function late_repeatedly_execute_always(){
  if(_SmoothCamEnabled) doSmoothCameraTracking();
  if(_ParallaxEnabled) doObjectParallax();
  if(_SmoothCamEnabled) Game.Camera.SetAt(_next_cam_x, _next_cam_y);
  else {
    _next_cam_x = Game.Camera.X;
    _next_cam_y = Game.Camera.Y;
  }
}

function repeatedly_execute_always(){
  if(!_is_doRoomSetup) doRoomSetup();
}
[close]

This should fix for now, but I am not completely satisfied with the resulting camera movement, kinda wanted to be a bit smoother, so I need to think a little bit more. Please confirm that the above code temporarily solves for you.
#628
That state is easy to provide. I can give a try to this tonight and also check if the movement linked to animation can be set while walking - I really don't know.

I was also looking into adding more functions that would be used by the lerp, like those in the tween module, but have not yet figured the right way to do, but the idea would be so you could have a "spring" camera or other fun equations.
#629
I think it would be something that needs to run before the function that tells the character to go to place "x", so what could be done theoretically is a function that guesses from a x,y point if the target character moving to that spot would require the room to scroll. This is a guess from looking how the pathfinding is fed to the characters in ags.

To do this, we need to know the path the character will take and see if any step on it will cause the room to scroll.

I think the easiest way is to use a dummy character and make it walk instantly and then "break" when there's a scroll and feed this info to do the change before the Process Click / walk to is ran, and leave the handling of this to the developer.

In my game I do a simpler thing than this which is: rooms that scroll are always the "gliding type" and rooms that don't make the player character use the other type of movement. In rooms that scroll I try to minimize regions that don't scroll by either giving large black border (if interior) or having carefully placed obstacle (in exterior areas).
#630
Small update, adding some attributes to the module API!


  • Adds CameraOffsetX and CameraOffsetY so you can easily add an offset on the camera, useful when you have a big room and want to set the camera offset differently between areas. Offset is not set instantaneously, the transition when changing offsets is smooth.
  • Adds CameraLookAheadX and CameraLookAheadY so you can set the lookahead offset to your liking (defaults are 48 and 16). These are offsets that are added or subtracted depending the direction your target character is facing - for now, only supports 4 direction movement.

Now, I really liked having a very tiny API but I recently needed to do some more things with it in a game and decided it was best to add to the module itself. If someone has needs here when using it, please write and we try to figure out a solution.
#631
Ha! Thanks Privateer Puddin!  ;-D
#632
I have no idea who wrote this but I found it very interesting:
http://www.edenwaith.com/blog/index.php?p=112 | backup

Spoiler

Porting Adventure Game Studio Games to the Mac
18th April 2020 | Games

During the 1980s, there was a plethora of competing computer systems
(Atari, Apple \]\[, DOS, Macintosh, Amiga, etc.), which was instrumental
in encouraging Sierra On-Line to develop their AGI and SCI game engines
to support many of these systems. Since those game engines were
interpreters, it was the game engine which needed to be ported, but the
resources and code could remain fairly consistent, which reduced the
effort to bring the games to multiple platforms.

After things shuffled out and settled down to two or three platforms
during the 1990s, most games came out for DOS/Windows. Only a handful of
games were ported to the Mac, and even if they were, it was often years
later. In an effort to come up with a more platform neutral solution, I
developed for my Master's Thesis the [Platform Independent Game
Engine](http://www.edenwaith.com/downloads/pige.php) which was based off
of cross-platform frameworks like C++, OpenGL, and OpenAL. This was more
of a proof of concept than a full fledged tool for game development.

Several months ago, Steven Alexander of Infamous Quests fame directed me to a
way that shows how games created with the Adventure Game
Studio  can be ported to the Mac with minimal effort. (Note: Minimal to the level that it doesn't involve
having to rewrite 80% of the code to support another platform.) The
process to take the resources from the Windows version of an AGS game
and turn it into a Mac application only takes a couple of minutes and
does not require fragile third party frameworks like Wine. However, the
process does not end there after copying a couple of files.

This article will detail several areas to help add the extra polish to
make your game port feel like a proper Mac app by designing an
appropriate app icon, configuring the Info.plist, and finally code
signing and notarizing the app for security. I'll demonstrate porting
the hypothetical game Knight's Quest (where you play the intrepid
adventure Sir Club Cracker and roam the countryside picking up anything
which hasn't been nailed down) and how to add the extra polish to make
it into a "proper" Mac application.

Porting
The aforementioned link to the Adventure Game Studio Forum post details
one method how to set up AGS to create a Mac version of a game.
Fortunately, there is already a gameless AGS shell application which can
be modified for your game to work on the Mac without having to go
through a number of convoluted steps to retrofit the Adventure Game
Studio to work on the Mac to develop an application.
Download
the pre-compiled shell Mac application which is built for version 3.4.4
of AGS. This is an empty app, but we will soon populate it with the
required game assets. Mac apps are bundles, essentially a folder with a
collection of additional folders and files contained within. To port an
existing Windows AGS game, we will need to move a couple of the Windows
assets into the appropriate locations in the Mac app.

Right-click on the file [code single]AGS.app[/code] and select Show Package Contents
from the context menu. This will reveal the barebones contents of the
app. Inside the Contents folder is an Info.plist, a MacOS folder (which
contains the AGS executable), PkgInfo, and an empty Resources folder.

Take the executable file (.exe) of your Windows game (*not* the
winsetup.exe file that comes with some AGS games) and rename it to
[code single]ac2game.dat[/code]. If you run the [code single]file[/code] command against the [code single]ac2game.dat[/code]
file, you will see it is still a Windows executable file.

    $ file ac2game.dat
    ac2game.dat: PE32 executable (GUI) Intel 80386, for MS Windows

Next, copy the ac2game.dat, acsetup.cfg, audio.vox, music.vox,
speech.vox, and any other support files (such as files ending in .dll,
.tra, .000, .001, etc.) to the Resources folder. Your project may not
have all of these files, but most projects will contain at least
ac2game.dat, acsetup.cfg, and audio.vox.

Next rename the app bundle from AGS to the name of your game.

...and now the port is done\! Really. That wasn't so difficult, was it?
Except, it's not quite a polished Mac app, yet. To have the proper
look and feel of a proper Mac app, we still need to add that extra
shine.

One of the first things you'll notice about an app is its icon. Like so
many things in life, it's important to make a good first impression. The
same applies here. Right now, the app has a generic looking icon. For so
many years, icons were limited to small, pixelated blobs, but modern Mac
icons come in a wide range of resolutions from a tiny 16x16 to a
glorious 1024x1024.

If you have an older Mac on hand, use Icon Composer (one of the many
utilities which comes along with Xcode), otherwise, use an app like
Icon Slate to create a Mac
icon file (icns).

If you are starting with this barebones AGS app, the next section will
not apply, but this situation did come up with one app I helped port to
the Mac where the app's icon was set using an old fashioned resource
fork, a throwback of the Classic Mac OS days. If you need to check if
there is a icon resource fork present, go to the Terminal and [code single]cd[/code] into
the app bundle, then list the files contained. If you see a file that
says [code single]Icon?[/code], then there is a resource fork hidden within to represent
the app's icon.

Code: ags
    % cd SomeOtherGame.app
    $ ls -la
    total 2568
    drwxr-xr-x@  4 chadarmstrong  staff  128 Jan  1 14:15 .
    drwxr-xr-x  11 chadarmstrong  staff  352 Jan  1 20:33 ..
    drwxr-xr-x@  6 chadarmstrong  staff  192 Jan  1 14:15 Contents
    -rw-r--r--@  1 chadarmstrong  staff    0 Nov 26 08:26 Icon?


To remove the resource fork, either delete [code single]Icon?[/code] from the command
line, or if you prefer a more visual method, right-click on the app and
select the Get Info menu. In the Get Info window, click on the app icon
in the top left of the window, then hit the Delete key on your keyboard.



Other resource forks might still be lurking within the app, but we will
take care of those later.

Place the app icon file into the Resources folder of the app bundle.
Next, we will modify the Info.plist to add the app icon and other
important details.

Info.plist
The skeleton AGS app contains an Info.plist, which can be opened up in
any text editor or Xcode. A couple of additions, modifications, and a
deletion are necessary to properly customize for your game.

  - Update the bundle identifier (CFBundleIdentifier) to be unique to
    your game (e.g. com.companyname.productname)
  - Update the Bundle name (CFBundleName) and Display name
    (CFBundleDisplayName) with your game's name. The CFBundleExecutable
    should remain as AGS
  - Update the version (CFBundleShortVersionString) and build number
    (CFBundleVersion)
  - Add the human-readable copyright (NSHumanReadableCopyright)
  - Add name of the app icon (CFBundleIconFile)
  - Remove the [code single]UIStatusBarHidden[/code] key since this is for iOS and
    probably not necessary for a Mac port unless there is ever an iOS
    version.
  - Add the category type: [code single]LSApplicationCategoryType[/code]. Since this is
    the Adventure Game Studio, let's assume that many games being
    made with this IDE will be adventure games, so the
    [code single]LSApplicationCategoryType[/code] should be set to
    [code single]public.app-category.adventure-games[/code].
  - The Info.plist in the skeleton AGS app bundle contains a bunch of
    other odd cruft (such as DTSDKBuild) which probably can be removed,
    but I leave it in for now since it doesn't seem to hurt anything.

Following is a subset of the Info.plist file with the necessary changes.
Code: xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        .
        .
        .
        <key>CFBundleDisplayName</key>
        <string>Knight's Quest</string>
        <key>CFBundleName</key>
        <string>Knight's Quest</string>
        <key>CFBundleIdentifier</key>
        <string>com.edenwaith.kq</string>
        <key>CFBundleShortVersionString</key>
        <string>1.0</string>
        <key>CFBundleVersion</key>
        <string>1</string>
        <key>LSApplicationCategoryType</key>
        <string>public.app-category.adventure-games</string>
        <key>NSHumanReadableCopyright</key>
        <string>Copyright © 2020 Edenwaith. All Rights Reserved</string>
        <key>CFBundleIconFile</key>
        <string>KQ-Icon</string>
        .
        .
        .
    </dict>
    </plist>


Now when you launch the app, the new app icon will appear in the Dock.

Code Signing
Code signing is one of those things which has given me several new grey
hairs over the years. If code signing wasn't enough, Apple has now added
yet another layer of security with app notarization. Notarizing an app
does require several additional steps, but it has fortunately proven to
have not been too harrowing of an experience to figure out and
implement. If you are going to make an app for macOS Mojave, Catalina,
or later, it is a good idea to both code sign and notarize the app so
macOS will not pester the player with annoying warnings about the
validity and security of the app.

I have written
about about code signing
before, so this is not a brand new topic, but with the introduction of
notarization, there is some new information to share.

With the introduction of Xcode 11, there are new types of development
and distribution certificates (e.g. Apple Development, Apple
Distribution), but for this example, I use the older style Developer ID
Application certificate for signing the app for distribution.

Let's start by verifying that the app is not code signed:

    $ codesign --verify --verbose=4 Knight\'s\ Quest.app
    Knight's Quest.app: code object is not signed at all
    In architecture: x86_64
   
    $ spctl --verbose=4 --assess --type execute Knight\'s\ Quest.app
    Knight's Quest.app: rejected
    source=no usable signature

This looks as expected. The next step is to code sign the app bundle. In
the past, we would use a command like the following:

Code:
 codesign --force --sign "Developer ID Application: John Doe (12AB34567D)" MyGreatApp.app/


However, with the introduction of notarization, there is a new set of
options to add to further harden the code signing process: `--options
runtime`

Code: ags
codesign --force -v --sign "Developer ID Application: John Doe (12AB34567D)" --options runtime Knight\'s\ Quest.app


If everything works as hoped, you will see a successful message like
this:

Code: ags
Knight's Quest.app/: signed app bundle with Mach-O thin (x86_64) [com.edenwaith.kq]


If the code signing was successful, skip to the next section about
Notarization.

Unfortunately, it is far too easy for things to go wrong. With some apps
I've helped port, there would be resource forks or other Finder info
hidden somewhere in the app, so I'd see an error message like this one:

Code: ags
SomeOtherGame.app: resource fork, Finder information, or similar detritus not allowed


This error is due to a security hardening change that was introduced
with iOS 10, macOS Sierra, watchOS 3, and tvOS 10. According to Apple:

Code signing no longer allows any file in an app bundle to have an
extended attribute containing a resource fork or Finder info.

The first time I saw this error, I determined that the "offending" file
was the icon file, so I used the following command:

Code: ags
find . -type f -name '*.icns' -exec xattr -c {} \;


In one case, the problem was because I had added a Finder tag on the app
bundle. Removing the tag fixed the problem. With another instance, some
other file was causing issues, but I was not able to immediately
discover which was the suspect file.

To ferret out the problem, I used the [code single]xattr[/code] command to see what
extended attributes were available in the app bundle.
Code: ags

    $ xattr -lr Knight\'s\ Quest.app/
    Knight's Quest.app//Contents/_CodeSignature: com.apple.quarantine: 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's Quest.app//Contents/MacOS/AGS: com.apple.quarantine: 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's Quest.app//Contents/MacOS: com.apple.quarantine: 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's Quest.app//Contents/Resources/audio.vox: com.apple.quarantine: 01c1;5e2e7a68;Firefox;7587AE66-F597-423C-8787-1DAE23ECA136
    Knight's Quest.app//Contents/Resources/ac2game.dat: com.apple.quarantine: 01c1;5e2e7a68;Firefox;7587AE66-F597-423C-8787-1DAE23ECA136
    Knight's Quest.app//Contents/Resources/acsetup.cfg: com.apple.quarantine: 01c1;5e2e7a68;Firefox;7587AE66-F597-423C-8787-1DAE23ECA136
    Knight's Quest.app//Contents/Resources: com.apple.quarantine: 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's Quest.app//Contents/Info.plist: com.apple.lastuseddate#PS:
    00000000  CD 72 0D 5E 00 00 00 00 B4 1E 64 2C 00 00 00 00  |.r.^......d,....|
    00000010
    Knight's Quest.app//Contents/Info.plist: com.apple.quarantine: 0181;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's Quest.app//Contents/PkgInfo: com.apple.quarantine: 0181;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's Quest.app//Contents: com.apple.quarantine: 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C
    Knight's Quest.app/: com.apple.quarantine: 01c1;5e0d5c84;sharingd;E82F3462-E848-4A3A-846C-C497474C0E1C


To clean up the extraneous resource forks (and other detritus), use the
command:

Code: ags
xattr -cr Knight\'s\ Quest.app/


Once the cruft has been removed, verify with [code single]xattr -lr[/code] again and then
try code signing the app once more. Perform one more set of
verifications to ensure that things look good.

Code: ags
    $ codesign --verify --verbose=4 Knight\'s\ Quest.app
    Knight's Quest.app: valid on disk
    Knight's Quest.app: satisfies its Designated Requirement
    
    $ spctl --verbose=4 --assess --type execute Knight\'s\ Quest.app
    Knight's Quest.app: accepted
    source=Developer ID


Notarization
Now on to the new stuff\! The first thing you'll need to do is generate
an app-specific password for
this app. Log in to [Manage Your Apple ID
page](https://appleid.apple.com/#!&page=signin) with your Apple
developer credentials. Under the Security section, tap on the **Generate
Password...** link. In the pop up, enter in a description for the app
(e.g. Knight's Quest), and then an app-specific password will be
generated. The app-specific password will be a sixteen character
password that will look similar to this: [code single]wcag-omwd-xzxc-jcaw[/code] . Save
this password in a secure place\! You will need this password for
notarizing the app.

The next step will involve packaging the app to be notarized. It can be
packaged as either a zip archive (zip), disk image (dmg), or an
installer package (pkg). Since this is just a single app bundle, a zip
file will work.

Code: ags
    // Zip up the app
    ditto -c -k --sequesterRsrc --keepParent *app KQ.zip


For the next step, if your Apple ID is only part of a single developer
account, you can skip ahead. However, if your Apple ID is associated
with multiple accounts (such as multiple companies), then you will need
to obtain more specific information before notarizing the app.
Otherwise, if you try to notarize an app and your Apple ID belongs to
multiple accounts, you will see this error:

`Error:: altool[7230:1692365] *** Error: Your Apple ID account is
attached to other iTunes providers. You will need to specify which
provider you intend to submit content to by using the -itc_provider
command. Please contact us if you have questions or need help. (1627)`

To get the list of providers linked to your Apple ID, use this command:

Code: ags
 xcrun iTMSTransporter -m provider -u john.doe@edenwaith.com -p wcag-omwd-xzxc-jcaw


This command will output a bunch of cruft, but ends with:

Code: ags
    Provider listing:
       - Long Name -     - Short Name -
    1  John Doe            JohnDoe18675309
    2  Acme, Co.       AcmeCo


In this hypothetical example, the developer John Doe has his own
personal Apple developer account and also belongs to Acme's developer
account, as well. For this project, John will use his personal account,
so he will use the short name of [code single]JohnDoe18675309[/code], which will be used
as the ASC provider value in the following command. Again, you can omit
the [code single]asc-provider[/code] option for the notarization call if your credentials
are associated with only a single team.

To notarize the app, you will use the application launcher tool
([code single]altool[/code]), which can also be used for other purposes (such as
uploading the app to
Apple's servers). The format of notarizing is as follows:

Code: ags
 xcrun altool --notarize-app --primary-bundle-id com.example.appname --username APPLE_DEV_EMAIL --password APP_SPECIFIC_PASSWORD --asc-provider PROVIDER_SHORT_NAME  --file AppName.zip


For our example, we filled in the blanks with the following values:

  - primary-bundle-id : com.edenwaith.kq
  - APPLE\_DEV\_EMAIL : john.doe@edenwaith.com
  - APP\_SPECIFIC\_PASSWORD : wcag-omwd-xzxc-jcaw
  - asc-provider : JohnDoe18675309
  - AppName.zip : KQ.zip

Code: ags
xcrun altool --notarize-app --primary-bundle-id "com.edenwaith.kq" -u john.doe@edenwaith.com -p wcag-omwd-xzxc-jcaw --asc-provider JohnDoe18675309 --file KQ.zip


For a more in depth break out of what each of these options mean, refer
to Davide Barranca's [excellent
post](https://www.davidebarranca.com/2019/04/notarizing-installers-for-macos-catalina/)
on this topic.

This process can take awhile, depending on how large your file is, since
it needs to get uploaded to Apple's servers and be notarized.
Unfortunately, this potentially long wait time comes with consequences
if there is an error. One reason notarization might fail is if you need
to accept Apple's terms of agreement (which may have also been updated),
so you might see an error like:



Code: ags
     /var/folders/pv/xtfd6hjn7hd8kpt70q0vwl8w0000gq/T/15A31C27-F6AF-48E8-9116-A30A7C76AD03/com.edenwaith.kq.itmsp - Error Messages:
             You must first sign the relevant contracts online. (1048)
     2020-04-11 11:23:19.745 altool[22640:1119844] *** Error: You must first sign the relevant contracts online. (1048)


One approach to fix this is to log in to the Apple developer portal and
check to see if new terms of service need to be reviewed. If so, agree
to the terms, and wait a couple of minutes before trying to notarize
again. You can also check Xcode's license agreement from the Terminal by
typing in the command:

Code: ags
sudo xcodebuild -license


However, if everything works properly with uploading the file, you will
get a message like this:

Code: ags
    No errors uploading 'KQ.zip'.
    RequestUUID = 2de2e2f9-242f-3c78-9937-1a7ef60f3007


You'll want that RequestUUID value so you can check on the notarization
status to see if the package has been approved yet. After uploading your
app, the notarization process typically takes anywhere from several
minutes to an hour. When the process completes, you receive an email
indicating the outcome. Additionally, you can use the following command
to check the status of the notarization process:

Code: ags
    $ xcrun altool --notarization-info 2de2e2f9-242f-3c78-9937-1a7ef60f3007 -u john.doe@edenwaith.com -p wcag-omwd-xzxc-jcaw
    No errors getting notarization info.
    
              Date: 2020-01-04 22:44:42 +0000
              Hash: adf86725dec3ab7c26be17178e07efaf3b2806f743fefd0dd1059f68dcf45398
        LogFileURL: https://osxapps-ssl.itunes.apple.com/itunes-assets/Enigma123/v4/a5/15/64/2d...
       RequestUUID: 2de2e2f9-242f-3c78-9937-1a7ef60f3007
            Status: success
       Status Code: 0
    Status Message: Package Approved


Once the package has been approved, we can move on to the stapling the
ticket to the app.

Stapler
At this point, the app has been validated and notarized, so if an app
launches, macOS will check with the servers and verify that the app has
been properly notarized. However, if the computer is not online, then it
cannot perform this step, so it is useful to staple the ticket to the
app for offline usage.
Code: ags

    xcrun stapler staple -v KQ.app


Once again, a ton of text will scroll across the Terminal. If it works,
the last line should read: [code single]"The staple and validate action worked!"[/code]

For sanity's sake, validate that stapling worked:

Code: ags
    stapler validate Knight\'s\ Quest.app
    Process: Knight's Quest.app
    The validate action worked!


However, if the stapling hasn't been completed, there will be an error
like this:

Code: ags
    $ stapler validate Knight\'s\ Quest.app/
    Processing: Knight's Quest.app
    Knight's Quest.app does not have a ticket stapled to it.


For a final verification, use [code single]spctl[/code] to verify that the app has been
properly signed and notarized:

Code: ags
    $ spctl -a -v Knight\'s\ Quest.app
    Knight's Quest.app: accepted
    source=Notarized Developer ID


Notice that this check varies slightly from when we first did this check
before the notarization â€" the source now says [code single]Notarized Developer ID[/code].

[h3]Final Packaging[/h3]
Now that the game has been ported, code signed, and notarized, it is
time to package it up for distribution. There are a variety of ways to
do so, whether via an installer, a disk image, or a zip archive. If you
are distributing the game via download from your website, you'll
probably want to bundle the game and any other extras (such as README
files, game manuals, etc.) into a single containing folder. If you are
going to upload the game to Steam, then you may not want an enclosing
folder.

To be a good internet citizen, make sure when the zip archive is
created, that any Mac-specific files are removed, such as the .DS\_Store
file and \_\_MACOSX, which stores excess metadata and resource forks.

Code: ags
zip -r KQ.zip . -x ".*" -x "__MACOSX"


This example zips up everything in the current directory, but excludes
any dot files and any unwanted metadata. With the game packaged up, it's
ready to go\!

[h3]Ported Games[/h3]
It has been a pleasure and joy to help bring a number of adventure games
to the Mac. Below is the list of AGS games I've helped port. I highly
recommend that if you enjoy adventure games, give them a try\! I hope
that this extensive tutorial has been useful in learning how to port
games developed with the Adventure Game Studio to the Mac, in addition
to learning how to code sign and notarize a Mac application. If you
would like assistance in porting, contact me via
e-mail or
Twitter.

  - Space Quest 2 VGA
    by Infamous Adventures
  - King's Quest 3 VGA
    by Infamous Adventures
  - Order of the Thorne - The King's Challenge by
    Infamous Quests
  - Quest for Infamy
    by Infamous Quests
  - Feria D'Arles by Tom
    Simpson
  - The Crimson Diamond by Julia
    Minamata
  - Stair Quest by No More For
    Today Productions

[h4]Resources[/h4]
  - Adventure Game Studio
  - AGS engine Mac OS X port
  - Notarizing macOS Software Before Distribution
  - Customizing The Notarization Workflow
  - Your Apps and the Future of macOS Security
  - Apple ID - Create Per App-Specific Passwords
  - Using app-specific  passwords
  - How to Notarize Your Software on macOS
  - App Notarization: A Quick Primer
  - Apple Ramps Up Fight against Malware with Notarization, Stapling, and Hardening
  - Replacing Application Loader with altool
  - Notarization Provider IDs
  - Selecting iTunes Provider for Notarization
  - Technical Q\&A QA1940 Code signing fails with error 'resource fork, Finder information, or similar detritus not allowed'
  - Signing and Notarizing macOS Apps for Gatekeeper
  - Codesigning and notarizing your LC standalone for distribution outside the Mac Appstore
  - Signing and Notarizing for Catalina
  - Dev Journal â€" Automate notarizing macOS apps
  - Mac zip compress without \_\_MACOSX folder?
  - Compress without .DS\_Store and \_\_MACOSX
  - Notarizing installers for macOS Catalina
  - Notarize a Command Line Tool
  - Building and delivering command tools for Catalina


© 2001 - 2020 Edenwaith - http://www.edenwaith.com/

[close]
#633
Here's how the thing you asked got implemented: https://github.com/adventuregamestudio/ags/blob/760635024c547face5ee423d62ccbf9abc7976f8/Engine/ac/display.cpp#L311

Maybe it helps to figure out how to add this in the module. :/
#634
AGS has a time for which things are ignored after the end of a speech, the unforgettable Game.IgnoreUserInputAfterTextTimeoutMs. This prevents spurious clicks after ending the speech, by blocking input for some milliseconds every time text is skipped or ends by timeout. Maybe there's a way to implement it in SpeechBubble?

#635
(if someone is feeling adventurous, you can implement AGS Script bindings and recreate the objects for a cpprest-sdk plug-in: https://github.com/microsoft/cpprestsdk )
#636
I also added a mention in the manual and a page (originally written by MorganW) there: https://adventuregamestudio.github.io/ags-manual/TroubleshootingWindowsZoneID.html

Curious, which AGS are you using? I think in the latest one it should detect and offer a pop up to unlock.
#637
Maybe someone can improve my description or suggest a different game:

The snowy weather, the snuggly clothes, family, great meals and magical portals to North Pole. If you want something to do while you wait for the gifts season to come again during your nights, play A Christmas Nightmare.

https://www.adventuregamestudio.co.uk/site/games/game/2398-a-christmas-nightmare/
#638
Thank you Ali! You are awesome! I used your module for so much for so long! And you make cool games, and you are fun and have beautiful hair :]

---

Edit:

Pushed a minor bug fix update:

  • Prevents wrong position updates by moving calculations to late repeatedly execute always.
  • Fix crash by wrong player loop when loading a new room.
#639
Basic changes are:

- use of AGS 3.5.0 Camera API, even though a single camera.
- parallax on y axis
- fractional parallax, instead of pre-defined values


Additionally, but totally subjective:
- algorithm works better for the specific demoed case of a character that jumps in a platform.
- code is simpler and easier to understand and modify (like, zone based scrolling like NES Zelda is easy to mod to achieve it)

"Bug" still present:
- character with movement linked to animation moving fast will produce "ghosting" when scrolling as the previous module did. I tried a ton of things and decided is just best to not have movement linked to animation with large scrolling areas and fast characters.

Known issue:

I need to close an issue opened on GitHub and release a new version of this.
#640
Engine Development / Re: AGS engine iOS port
Wed 29/01/2020 23:44:04
Someone used it the month before this to port a game and did a pr with their changes. I do not have Apple hardware to check. Using it requires some familiarity with XCode and iOS.
SMF spam blocked by CleanTalk