Git Product home page Git Product logo

barnabus-vtt's Introduction

Barnabus VTT

Barnabus VTT is like Miro or Google Jamboard or Microsoft Whiteboard, but for tabletop RPGs.

Technology Stack

Barnabus VTT is built with:

General Architecture Notes

  • src\app.tsx loads everything in and sets up global event handlers
  • all the objects get rendered with src\components\board-objects\base.tsx
  • various ephemeral UI components (the selection box, the resize handles, etc.) are in src\components\in-camera-ui
  • various on clicks on objects and from App are handled in src\event-handlers.ts and determine what should happen based on what buttons a user is pressing, if they already have selected objects, etc.
  • the actual specific interactions that should take place are then handled in src/interaction-handlers.ts; moving objects, resizing objects, etc.

So a typical interaction flow is;

  • moving the mouse around -> triggering the onWindowMouseMove and in turn, an interaction handler such as interactionMoveObjects
  • letting go of the mouse -> triggering the onWindowMouseUp, which may trigger further interaction handlers

And all of those event and interaction handlers read and write state, read and write DOM nodes, etc.

"Easily Forgotten" Features TODO

  • locking objects

    • done very quick prototype, super broke, fix this up
    • its a bit better?
  • grouping objects

  • map markers?

  • dynamic lighting examples/inspo https://codepen.io/loktar00/pen/kYVbPz https://www.npmjs.com/package/visibility-polygon

  • send to back

  • bring to front

  • borders

  • opacity

    • for objects, probably?
    • for the sketching pen, maybe just make a highlighter tool
  • rounding/cropping

  • when you're dragging an object mark it as dragging, so we DONT show its toolbar

  • when the selected toolbar goes offscreen, maybe it should stay on screen? like right click menus in other apps

Refactor TODO

  • The resize utils code has become extremely gross, refactor the shit out of this.
  • the text box objects kinda work, mostly. but things get super fucky when you resize them, could do with going back to this at some point.
  • stop firing global key events when focused on a text box, all sorts of bugs to do with hitting delete and stuff.
  • the dynamic lighting needs to take into account only the tokens and walls inside the image thats relevant
  • sometimes deleting walls doesn't delete wall anchors correctly, and vice versa
  • when something is invisible we need it so that drag select doesn't select it

Motion Effects Notes

Performance Notes

if we get rid of using state as the core, we dont need the pre stuff. the state IS the pre stuff, and we just change against the dom directly

https://write.as/browserboard-blog/browserboard-update-everything-is-faster

https://stackoverflow.com/questions/25910500/1000-dom-elements-on-a-single-page

the browser is VERY sensitive to dom nodes - maybe its nested dom nodes?

when each object is like this:

<div>
  <img />
</div>

it works MUCH faster than when each object is like this:

<div>
  <img />
  <p>debug info</p>
  <p>debug info</p>
  <p>debug info</p>
  <p>debug info</p>
</div>

thats something we should take into account - hiding DOM nodes when they're effectively too small


average BitD charactr is 60 to 100 objects - the main sheet, then a bunch of dots, etc.

by the end of the bitd campaign, the entire board was 1588 objects, including all characters, etc.


https://github.com/wilsonpage/fastdom ???


maybe we should start doing mad shit like keeping all selected object dom nodes on the window so we don't have to recompute, etc. update: we did this, it works great, may god have mercy on our souls


so doing a test with 100 image objects..... when they're all bunched up on top of each other, chrome's performance drops to a crawl but when they're literally spread out and not on top of each other, everything is fine. very interesting, i wonder if this is a limitation in chrome itself.


bunch more testing; from what i can tell, chromes insane performance problems are literally only when theres like 50+ images stacked on top of each other AND they're taking up the whole screen which, i mean, will never happen? so fuck it? i tried with 2000 objects, 500ish more than the average BitD board and performance was not amazing, not shit. i think we're fine

barnabus-vtt's People

Contributors

thomascgray avatar tomcgray avatar

Watchers

 avatar  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.