Giter VIP home page Giter VIP logo

foundryvtt-hot-pan's Introduction

Hot Pan & Zoom! for Foundry VTT

Hot Pan & Zoom! Logo Take control over your players' canvas position and zoom (manually or by macro) for demonstrations and cinematics.

"One Thing to Pan Them!
One Thing to Find Them!
One Thing to Zoom them
And to the GM's Canvas Bind Them!"

Video demo on youtube

Hot Pan & Zoom! Demo

Hot Pan & Zoom! - Video demo on youtube

What does it do ...

Are you tired of your players complaining about things like...

  • "Hey, where's my token gone again?"
  • "Where the h... are you (the GM)? I think you've lost us! What are you trying to show us over there?"

It happens to me quite often that I (as the GM) like panning and scrolling around, enthusiastically trying to demonstrate something in the scene to my players, but I tend to forget that they cannot follow me on their screens! So I am frequently losing their attention without noticing.

And a more fancy thing: I like scripting big macros for playing cinematic animation sequences that do a lot of stuff across the scene. But then I forget that most of it won't be noticed by the players, as it happens to take place in a far-away corner of the scene that they are currently just not looking at! :(

This is why I've created this whole thing.

It is a systems-agnostic utility for keeping players' canvas position & zoom in sync with the GM's screen.

For instance, it allows to take over control of the players' canvas for a short time to draw their attention to important things ("Hey! Have a look at THIS!").

And it comes in handy for cinematic reasons, like in the animation sequence shown in the video demo. Feel free to experiment!

Changelog

Latest Version
1.0.2 2023-02-21
  • Example macro(s) now provided as compendium pack:
    Find included a compendium pack with a default macro that can easily be adjusted to your needs.
    Find further explanations inline in the macro's code:
    Hot Pan & Zoom! - Macro Compendium
Click to see older versions
Release Date Changes
1.0.1 2023-02-20
  • More intuitive Macro API:
    Use HotPan.switchBack() now instead of HotPan.switchOff(restoreStateBefore=true)
    (Old function still valid, but flagged as deprecated. Migration recommended.)
  • Stability workaround for Macro API:
    Toggling within a single macro script (switchOn() => switchOff()/switchBack(), toggle() => toggle()) was unreliable.
    Some weird asynchronicity / threading behaviour which I couldn't really understand.
    . Added some await / Promise logic, plus updated documentation about macro usage (new troubleshooting section).
    Any feedback on better solutions highly appreciated!
1.0.0 2023-02-18 Going out into the world!

This "canvas sync" is currently a pure GM feature. It does not support players to use it yet (maybe to come in a later release).

Upcoming features

Feel free to follow the "dev" branch on GitHub to stay tuned: https://github.com/coffiarts/FoundryVTT-hot-pan/tree/dev

Some things I am considering to do (feedback welcome!):

  • small: include ready-to-use macros for the most basic functions in the package => DONE (Rel. 1.0.2)
  • medium: expose some more features for usage in macros, e.g. better control over UI notifications
  • big: allow players to request screen control as well (probably needs some socket-based mechanism for GM approval at runtime, so this might be complex)

Tech stuff

Adjustable module settings (i.e. game settings)

This screenshot shows the default values.

(!) Note that especially the UI notification messages can be configured to your needs.

Hot Pan & Zoom! settings

Control it by macro!

The module runs automatically in the backend as a module, but it can also easily be controlled through macro code.

The module comes with its own macro compendium pack containing just one prebuilt example. Use and modify this according to your needs:

Hot Pan & Zoom! - Macro compendium

The macro uses the exposed class HotPan - just like this, it's a no-brainer:

Hot Pan & Zoom! macro example

Some variants:

// Toggle specifically on and off (pretty obvious)
HotPan.switchOn();
HotPan.switchOff(); // If this doesn't work, refer to "Troubleshooting" below

// If your macro should not rely on HotPan being installed, to prevent runtime issues,
// use it optionally (by using "?")
HotPan?.switchOn();

// And now the advanced scenario:
// Use HotPan (optionally) in a macro running a multi-step animation sequence,
// AND prevent that the GM's preference (active state of the mod) is not overridden afterwards:

// Step 1: activate Hot Pan & Zoom!
HotPan?.SetOn();

// Step 2: Run all your fancy animation stuff and watch the players' map view following yours
<...>

// Step 3: When all is done, switch of HotPan again, but gracefully: If the user setting was ON before,
// you don't want to set it to OFF now!
// This is done by using the switchBack() method instead of switchOff().
HotPan?.switchBack();  // If this doesn't work, refer to "Troubleshooting" below

Compatibility and Dependencies

  • Hot Pan & Zoom! uses socketlib for sending sync messages between the GM's session and the clients.
  • Developed and tested on Foundry VTT 10.2xx, with Chrome as the players' client.
  • DISCLAIMER: Be aware that I have developed and tested this mainly in local network sessions (including plain localhost connections)! So I can't claim to have run tough reality checks with this. So I am very to know how it works out for others!

Troubleshooting

Switching off after switching on inside the same macro fails

Toggling within a single thread (like a macro script) (e.g. switchOn() => switchOff()/switchBack(), toggle() => toggle()) can be unreliable. It's some weird asynchronicity / threading issue I haven't fully understood.

Workaround:

// Toggle on (as usual)
HotPan.switchOn();
<...>
// But for switching off, encapsulate function calls within setTimeout():
setTimeout(function(){HotPan.switchOff()}, 100);
<or>
setTimeout(function(){HotPan.switchBack()}, 100);
<or>
setTimeout(function(){HotPan.toggle()}, 100);

This might be an ugly solution caused by my noob-i-ness, any better ideas highly appreciated!

foundryvtt-hot-pan's People

Contributors

coffiarts avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.