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

Author Topic: MODULE: rellax 0.2.2  (Read 9962 times)

Re: MODULE: rellax 0.1.4
« Reply #40 on: 15 Jan 2022, 09:58 »
I see, thanks for replying!

Could I alter these values manually in the module code, or will I break something? From what I gather, I might need to change the 0.04 value in line 272, as well as the 40x40 box in lines 307 and 308:

Code: Adventure Game Studio
  1.   _cam_window_w = 40;
  2.   _cam_window_h = 40;

Is this correct? Anything else I might want to tweak? :)

Ah it can also be the still ticks. Can you make your game 60fps instead of 40fps? It should take half a second on a 60fps game, I can also expose the still ticks, these were made for when a character falls it falls downwards, it only matters if the movement is done without leaving the box borders.

The game is already set to 60 (it might look like it has a lower fps because the gif is captured at 33 fps).
« Last Edit: 15 Jan 2022, 10:00 by Laura Hunt »

Re: MODULE: rellax 0.1.4
« Reply #41 on: 15 Jan 2022, 12:32 »
So I managed to find a workaround by commenting out these lines in order to set the still ticks to a fixed value of 30:

Code: Adventure Game Studio
  1. void doSmoothCameraTracking(){
  2.   //if(_prev_c_x == _TargetCharacter.x && _prev_c_y == _TargetCharacter.y)
  3.     //_count_still_ticks++;
  4.   //else
  5.     _count_still_ticks = 30;

By doing this, now the camera follows the character as soon as it moves, instead of waiting until it stands still, so yay I guess :-D (disclaimer: as mentioned above, the game runs at 60 fps but the gif was captured at 33 fps, so it doesn't look as smooth here as it does in-game).



I've tried with different values below 30 and also with 31 (as from what I can see, all values greater than 30 yield the same result) and 30 seems to be the smoothest. However, although the camera scroll in itself is smooth, the character's movement still looks a little bit jerky. Is there any other parameter I could tweak further in order to improve this?

« Last Edit: 15 Jan 2022, 12:41 by Laura Hunt »

eri0o

Re: MODULE: rellax 0.1.4
« Reply #42 on: 15 Jan 2022, 13:04 »
The only way I found to truly unjerk the movement is to not use movement linked with animation. In my games I only use it in rooms where the camera doesn't move, and every other rooms I don't. The usage of still ticks and the box alleviates it but only works if the character still moves reasonably fast.

Set your playable Character MovementLinkedToAnimation (anti-glide) to off and see how well it works. If the room has lots of scrolling the gliding is not very perceptible.

You can of course edit the code of the module, I want to update it so it's possible to change these values without doing so, because then it should be easier to everyone. :)

Re: MODULE: rellax 0.1.4
« Reply #43 on: 16 Jan 2022, 08:18 »
Set your playable Character MovementLinkedToAnimation (anti-glide) to off and see how well it works. If the room has lots of scrolling the gliding is not very perceptible.

It does look better! The only issue is that unlinking movement and animation means I don't quite have the same fine degree of control over the character's movement speed, but for now it's a good solution :)

Re: MODULE: rellax 0.1.4
« Reply #44 on: 21 Feb 2022, 21:03 »
Hello,

I have a question regarding this module.

Is there a way to snap camera to the player x/y position on room load?(before fade in)
It looks weird when the camera moves when entering new area.
I would like the camera to be at the center(including offset) when entering new room.

Can this be achieved?

Thanks

Re: MODULE: rellax 0.1.4
« Reply #45 on: 21 Feb 2022, 21:17 »
I've just seen this module, it looks great!!!

I've basically made an entire game, with lots of parallax, using ABK's Smooth Scrolling + Parallax module. Do you think it's possible to sort of "upgrade" to rellax from this or best to stick to the ABK module (I'm worried it might cause chaos with the existing code!)? It would be amazing to get truly smooth scrolling, which this new module seems to be able to do.

Many thanks,
Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

eri0o

Re: MODULE: rellax 0.2.1
« Reply #46 on: 02 May 2022, 02:36 »
Updating to 0.2.0!
  • additional StandstillCameraDelayY, CameraLerpFactorX, CameraLerpFactorY, CameraWindowWidth and CameraWindowHeight attributes;
  • defaults have changed, hopefully they are more useful for Adventure Games;
  • Camera interpolation now uses a float camera position and this position is synced occasionally to the Camera, this should fix the issue reported by Flugeldufel here...;
  • demo is now built using AGS 3.5.1.17;

If someone would like to come up with a demo room that uses parallax and is a more traditional adventure game room, please hit me up, I did not have any ideas and also Adventure Game assets are hard to come by, so if you have an abandoned one, or have the art chops, send it my way.

I will at some point answer other things, I am still thinking about Laura's issue with traditional AGS walking characters that have MovementLinkedToAnimation, so far the only way I could come up is to have an additional character with anti glide off and move both at the same time, with the camera targeting the second... Unfortunately that is not very portable to put in a module...

Hello,

I have a question regarding this module.

Is there a way to snap camera to the player x/y position on room load?(before fade in)
It looks weird when the camera moves when entering new area.
I would like the camera to be at the center(including offset) when entering new room.

Can this be achieved?

Thanks

Updating to 0.2.1!

Not sure if I understood, made a new 0.2.1 release, added AdjustCameraOnRoomLoad property, default is true, it should quickly adjust the camera on room load, you can set it to false to keep the old behavior if you miss it! Please verify if this is enough.



I am currently investigating if there are better ways to provide smoothness as the current implementation may not be as smooth in some cases, like low resolution and slow characters... Finding lots of interesting stuff in other places too.

I am also investigating a camera specific to following a character walking a path, if I can estimate the time it takes for the character to reach the destination and I know the destination, I can do something similar to a camera tween to that instead of directly tracking the player, and in this way I can ignore the stepped interval the character normally moves on screen.
« Last Edit: 02 May 2022, 18:24 by eri0o »

Re: MODULE: rellax 0.2.1
« Reply #47 on: 02 May 2022, 22:50 »
Not sure if I understood, made a new 0.2.1 release, added AdjustCameraOnRoomLoad property, default is true, it should quickly adjust the camera on room load, you can set it to false to keep the old behavior if you miss it! Please verify if this is enough.

Hey, I don't get any notifications on ags forums so I missed it, but I happened to update rellax today and used those extra variables, unfortunately that did not help.
The code is doing it's job, but there is another function that overrides that.
I have put an issue on github with a bit more specific information.

A way of "resetting" the camera would be great, I just don't want any movement when I change the room, the camera should be at the end position.

eri0o

Re: MODULE: rellax 0.2.2
« Reply #48 on: 03 May 2022, 00:44 »
Hey! Thanks for the well written GitHub issue! I was able to understand and track down the issue! I made a new 0.2.2 release, I think it's working now, please verify!

I am also working on a new implementation which will make the camera work slightly different when it's tracking a character that is following a path vs a character that is walking by some other way, the idea is the character following a path we can guess how long it will take for the character to get there, and loosely track the camera towards it, instead of following the character steps. The problem with this approach is that while the whole world looks non-jerky, the character itself is looking a bit weird so far, balance both is being a bit hard...

I also did not forgot shaun, I am thinking about if I should figure a compatibility mode for people coming from Ali's module, haven't figured that yet though...
« Last Edit: 03 May 2022, 00:51 by eri0o »

Re: MODULE: rellax 0.2.2
« Reply #49 on: 03 May 2022, 02:47 »
Hey! Thanks for the well written GitHub issue! I was able to understand and track down the issue! I made a new 0.2.2 release, I think it's working now, please verify!

I am also working on a new implementation which will make the camera work slightly different when it's tracking a character that is following a path vs a character that is walking by some other way, the idea is the character following a path we can guess how long it will take for the character to get there, and loosely track the camera towards it, instead of following the character steps. The problem with this approach is that while the whole world looks non-jerky, the character itself is looking a bit weird so far, balance both is being a bit hard...

I also did not forgot shaun, I am thinking about if I should figure a compatibility mode for people coming from Ali's module, haven't figured that yet though...

Thanks for the update, tested and it works great!

eri0o

Re: MODULE: rellax 0.2.2
« Reply #50 on: 09 May 2022, 00:25 »
Since 0.2.1 of rellax, I switched the camera position to use a float, and clamp to int positions when using it. I recently had an idea to move the viewport too along with the camera, with the residue of these positions!

Code: Adventure Game Studio
  1.     Game.Camera.SetAt(FloatToInt(_next_cam_x), FloatToInt(_next_cam_y));
  2.     Game.Camera.SetSize(320, 180);
  3.  
  4.     int residue_x = FloatToInt(_next_cam_x * 4.0, eRoundNearest) - FloatToInt(_next_cam_x) * 4;
  5.     int residue_y = FloatToInt(_next_cam_y * 4.0, eRoundNearest) - FloatToInt(_next_cam_y) * 4;
  6.    
  7.     Screen.Viewport.SetPosition(-residue_x, -residue_y, Screen.Width, Screen.Height);

Above is an example of a game screen that is 1280x720, when the game camera is for a 320x180 game. This gives us an extra 0.25 times 4 positions we can move around

The effect looks like this: video_1.mp4, video_2.mp4.

It needs some adjustments, but with this, the camera smoothness can be made much better for lower resolution games. This is not yet implemented in rellax, but I am looking into and just thought I would share it here - the experimental commit is here.

Of course, going this route you need to have all your GUIs scaled up to compensate, which is not trivial as we are now in AGS... But, this is interesting still.
« Last Edit: 09 May 2022, 01:06 by eri0o »