drawCanvas enlarges when host is mobile and peer is on PC!?

0 favourites
  • 4 posts
From the Asset Store
A space themed game with high quality 2D graphics and addictive music that provide hours of fun
  • edit 2: workaround was limited.

    If host is mobile, and the peer is on PC, the draw canvas enlarges x4.

    such a weird bug...


    edit 1: found a workaround

    on start of layout, detect device, when on mobile adjust variable sizes.

    In this case, set drawcanvas size to 2x viewport size.

    I'll need to add more "case by case" code now to adjust.

    For example, if host is PC or mobile then...

    if peer is pc or mobile then....

    the host needs to send a message indicating whether they are host or not, and PC peers then adjust their draw canvas accordingly.


    original problem

    I'm trying to think of the best way to word this, as I can't post example files.

    Basically, when two PC's play my game together, the drawcanvas behavior works fine.

    However, when a mobile user and a PC play together the drawCanvas plugin starts acting up.

    When the mobile hosts, the PC peer's canvas grows like x4 the size, effectively magnifying the drawing instead of displaying is correctly.



    Important to note: the drawCanvas's are not synced at all. So I'm really confused when the same code, on the same device (PC) will display data so differently depending on whether the host is a PC user or a Mobile user.


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • As can be read in the DrawingCanvas manual article

    Handling resizing and resolution

    By default, the canvas uses the same display resolution as the game. However the display resolution usually changes when the window is resized. For example in letterbox scale mode, when the window is resized larger the game displays the same content but at a larger size (using more pixels). The Drawing canvas object automatically changes the resolution of its canvas when this happens. This is destructive, though: the next draw to the canvas will clear it, because internally the drawing surface is destroyed and recreated at the new resolution.

    The reason it waits until the next draw to recreate the drawing surface is so that if you draw to it once, the same content is simply displayed stretched at the new resolution. This is often an acceptable result after drawing in On start of layout. Normally a better idea is to draw one-off content in the trigger On resolution changed - this also triggers on startup, and again any time the resolution changes, ensuring your content can increase in detail if the window is resized larger.

    Alternatively if you clear and re-render the canvas in Every tick, since it is always redrawing it will always draw at the current resolution. This approach is similar to how the runtime itself renders, although you may want to stop drawing if nothing is changing in the game, which is also what the runtime does.

    If you run in to a bug or issue in Construct 3, please post it to the GitHub issue tracker here:


    You must follow the bug report guidelines or your issue will be closed without investigation.

  • I appreciate the response.

    So, what I'm hearing is...

    Since a pc users window is larger, the fix is to... how do I avoid that unintentional stretch?

  • it seems to me that the snapshot is being loaded to large

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)