MODULE: Smooth Scrolling & Parallax v1.7.1

Started by Ali, Fri 07/12/2007 21:14:09

Previous topic - Next topic

Crimson Wizard

Quote from: vga256 on Sun 24/03/2019 17:25:50
Hi Ali! I'm porting (Chicky's) Guard Duty to Linux and Mac, and I noticed that I cannot seem to get targetCharacter to work in Linux. The exact same code works fine in Mac and Windows, but for some reason Linux seems to be completely ignoring targetCharacter?

Curiously, we have reported Linux-related bug many years ago: https://www.adventuregamestudio.co.uk/forums/index.php?topic=33142.msg636472912#msg636472912
but it was supposed to be fixed.

Try searching for "eOSLinux" in the script.

On the other hand, this may be a new engine's bug too.


Ali

Yes, originally the module would cause a fatal crash on Linux, so it was disabled by default. But, as you can see, that line is now commented out. Frankly I have no idea what the problem is. The module doesn't do anything fancy in terms of scrolling. It just decides where to setviewport based on the co-ordinates of a particular character. So I can't see why that wouldn't work on Linux.

I'm afraid I don't have a Linux OS here to test it on. But I would try to narrow down the cause of the problem. Does setting *targetCharacter in the script succeed (i.e. the pointer is changed to cCharacter2, but the screen doesn't move)? Or does it fail for some reason and the pointer stays set to cCharacter1?

For instance, if you modify game_start in the module to:

Code: ags
function game_start(){
  if (cEgo.Room == TEST ROOM)  targetCharacter = cCharacter2;
  else targetCharacter = player;
  
  system.vsync=true;
}
(Pseudocode)


And run the room, does it follow the other character instead?

vga256

#182
Pretty embarrassing that I didn't catch the     if (System.OperatingSystem != eOSLinux) line in the script XD
This must have been an old script that somehow didn't get updated to the commented version? I don't know how it happened, but nonetheless .. it's now commented out :D

Thank you - I've commented out the line and its matching closing brace, and will recompile with both. I'll update this thread when I see the outcome.

vga256

Recompiled and it's running perfectly in Linux now. Thanks again! :D

Monsieur OUXX

 

Blondbraid

Does anyone know how to install this module on the 3.5 AGS engine? The new changes have me a bit confused.


Ali

Sorry, I haven't used 3.5 at all yet. Maybe try Rellax, which seems more up to date?

Crimson Wizard

Quote from: Blondbraid on Wed 27/05/2020 15:06:17
Does anyone know how to install this module on the 3.5 AGS engine? The new changes have me a bit confused.

In General Settings set "Script compatibility level" to 3.4.1.

Blondbraid

Quote from: Ali on Wed 27/05/2020 15:18:55
Sorry, I haven't used 3.5 at all yet. Maybe try Rellax, which seems more up to date?
Well, I wanted to use this module as I'm working on a MAGS project and wanted to have something I was familiar with when working on a time limit, but I might try it out on my next project. Still, it would be interesting to see what you could do with this module for the latest version if you find the time for it.
Quote from: Crimson Wizard on Wed 27/05/2020 16:25:03
Quote from: Blondbraid on Wed 27/05/2020 15:06:17
Does anyone know how to install this module on the 3.5 AGS engine? The new changes have me a bit confused.

In General Settings set "Script compatibility level" to 3.4.1.
Thanks, I tried that and it seems to work!


Laura Hunt

Hi Ali, I'm having a bit of a problem with this module. Is it ok to post here (might be helpful in case anybody else has the same issue?), or should I PM you?

Ali

Yes, you can post it here for exactly that reason. The module is a little out-of-date now, but I'll help if I can.

Laura Hunt

Thank you!

The issue I'm having is that I want to activate smooth scrolling for only one room, but when I put SmoothScroll_ScrollingOn(); in my room_Load(), the viewport gets stuck to the top left corner and doesn't move from there.

My game's resolution is 320x200, and this room is 480x300. I'm using AGS 3.4.3 P1.

In case it helps shed some light, previous to this I have called SmoothScroll_ScrollingOff(); in game_start because I wanted to use the parallax effect for the main menu but not the smooth scroll functionality, because I'm scrolling the viewport with tweens instead.

Thanks again!

Ali

Is the target character (by default, the player character) in the room? If they are, then I'm not sure. If you want, you could PM me the room and I could have a look. You could also check whether the newer module Rellax works for you: https://www.adventuregamestudio.co.uk/forums/index.php?topic=57489.0

Laura Hunt

Well, that's interesting. The player character is indeed in the room, but for some reason it's not being set as the target character. I explicitely set targetCharacter = cTestCharacter; and everything works as it should, with one exception: the viewport "snaps" into place vertically after the room fades in. I thought the character might be too close to the edges, but it's happening regardless of where I start him off. Have you ever had this happen before?

Laura Hunt

#194
Managed to fix it, although I have no idea what's going on.

If I use cTestCharacter.SetAsPlayer() in the previous room, I get this weird viewport "snap" after the next room loads. But if I do player.ChangeRoom(51, 348, 217, eDirectionLeft) instead, then everything works fine.

In any case, I definitely need to explicitely set targetCharacter = player. For some reason, the module is not doing it automatically.

In any case, I managed to get it running, so thanks a lot for your help! :)

Ali

I'm not sure why that's happening, but I'm glad you've found a workaround! Sorry I haven't been able to keep this up-to-date.

Ali

#196
Based on Laura's issue, I'm going to add a couple of known issues which are work-aroundable.

If your character changes view from a tall to a short sprite, the module screen will snap into a new position. This is because it's aiming for the 'head' of the sprite. To get around this, switch targetCharacter to a dummy character (at the same co-ordinates) while you make the transition.

If you're playing as a different character to the player character at game start, and the module has been off, then when you switch it on you the camera will pan from the old character it was following to the current character*. To get around this, set the targetCharacter to the player before calling ChangeRoom, so the camera starts out looking in the right place.

Similarly, if you change a player's X and Y position in room_load, the module will pan from where they used to be to where they are now. If you can, include the desired co-ordinates in the ChangeRoom function. If not, try using a Dummy character who's already in the right place.

*This would be desirable behaviour if you were using it to pan between characters in a cutscene, etc.

Laura Hunt

#197
Edit: Ali and I posted at exactly the same time, but his explanation is so much better than mine, so I'm editing mine out so as not to add any confusion :)

Thanks again Ali for going above and beyond the call of duty!

rongel

I had similar problems with Smoothscroll that were connected to changing the player character. I didn't understand what was going on, but simpy using the targetCharacter  = player again seems to have fixed the situation. Feels good that I can remove my own messy fixes!

Thanks Ali, Laura and Crimson Wizard!
Dreams in the Witch House on Steam & GOG

my2k

sorry for some thread necromancy....

so I don't know if this has been addressed, this is as close as I've seen, but:
when I'm moving and the screen is smooth-scrolling, if I click on a character and dialogue begins, the dialogue scrolls along with the room- not the gui, not anything else, JUST the drawn "character.SayAt(etc);" type dialogue. I'm trying to figure out how I can have the dialogue stay along with the GUI, where the view below the dialogue box keeps moving but the dialogue box itself doesn't. I can't set GUIs' PxPos as 0, so it's not possible to keep it stationary.

if I use
  cEgo.StopMoving();
  SmoothScroll_StopScroll();

it'll have the screen slow to a stop- which is great anywhere else- but it unfortunately is a bit lengthy when waiting for dialogue to display. Ideally it'd slow to a stop as normal but that dialogue wouldn't move.

Do we know why JUST the dialogue seems to keep moving with the scrolling screen but the GUI doesn't? how can I keep that dialogue stop moving?
 

Quote from: Ali on Tue 17/03/2009 09:56:30
Nickel & Mr Matti: That looks really cool, and it ran very smoothly for me too. I like the way you've modified the numbers, and there's nothing wrong with the maths. The problem is that objects with PxPos of 0 are ignored by the script and aren't added to the array of parallax objects. It's the default value, so it's needed to create non-parallax which stay in place.

To make it work, use a PxPos of 1 in the script for the segment where you currently use 0, and use 2 where you currently use 1. Changing the corresponding numbers on the nearest two objects made it work properly for me.

Hope that helps!

Dualnames: Thanks for the tip. I always disliked Sierra Speech, but now it's personal.

*Shakes fist at Sierra style dialogue*

I'll add that note the next time I update the module. Thanks!

SMF spam blocked by CleanTalk