Pasting with drawing canvas for split screen local MP

1 favourites
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • IIRC, with R0J0's paster/canvas plugins, the method was to shift the viewport, paste it to the canvas, then move the viewport back, resulting in two views. Please correct me if I'm wrong, since I never actually tried that plugin myself.

    Is this not possible with C3's drawing canvas due to the paste object action only happening at the end of each rendering frame and outside of the normal order of events and actions?

  • From the sound of it that is the case. I can understand it is more performant to do the pasting when everything else is drawn, but it does nerf its use in a lot of ways.

  • How do you do it in C3?

  • I had an idea to swap multiple canvas objects for each view from an off screen playing area to the viewport every other tick. So you would be seeing what happened one frame in the past.

    Seemed super clunky though, haven't tried it yet.

    The other way that has always worked is to basically render a copy of every object for every player, offset and on their own layer with blending modes to split the screen.

  • Is this not possible with C3's drawing canvas due to the paste object action only happening at the end of each rendering frame and outside of the normal order of events and actions?

    FYI that doesn't happen, it draws where the objects are at the time of the paste action. I think you're referring to an old bug where that happened, but the bug was fixed.

  • Oh! Sorry for the confusion. I was going by the manual entry where it said "If an object is destroyed the same tick that you paste it, it will not be drawn, since drawing happens at the end of the tick."

    I couldn't get it to work the way I imagined in a quick experiment. I'll give it another shot, must have done something wrong.

  • The object is rendered at the end of the tick, but it's drawn at the position it was at the time of the paste action.

  • Looks like I had the wrong approach.

    Attempt 1:

    Anchor canvas to viewport

    Clear canvas

    System scroll to Player 2

    Paste everything to canvas

    System scroll to Player 1 (or scrollto behavior)

    Didn't work.

    Attempt 2:

    Clear canvas

    Move canvas object to player 2

    Paste objects to canvas

    Move canvas to viewport

    Scrollto Player 1 behavior

    Didn't work

    Attempt 3:

    Clear Canvas

    Scrollto Player 1

    Anchor canvas to viewport

    Offset every object by the difference between player 1 and player 2

    Paste to canvas

    Return objects to original position

    Works!

    I can see issues with the timing for my first try as I don't know how the behaviors order in terms of the event sheet stack. I would have hoped the second method would work... If i manually paste on trigger, I can move the canvas object around with the "stamped" image, so I would assume it works similarly within a tick.

    Also opacity changes don't seem to be recorded either.

    + (no conditions)

    -> DrawingCanvas: Clear canvas rgba(0, 0, 0, 0)

    -> Sprite: Set opacity to 100

    -> Sprite: Set position to (-200, 0)

    -> DrawingCanvas: Paste object Sprite without effects

    -> Sprite: Set opacity to 20

    -> Sprite: Set position to (0, 0)

    The canvas "copy" is saved at 20 opacity.

    Should I put it in a bug report? Or working as intended? Ref: dropbox.com/s/gg5kdjvbe4ovsck/splitscreenc3pminimal.c3p

    Edit: Formatting. Line breaks not working?

  • oosyragThe link works. But how would I incorporate this into a split-screen, two-player game?

    Thanks

    Give me a Pixel

  • You'll be interested in this part in particular:

    Offset every object by the difference between player 1 and player 2

    Paste to canvas

    Return objects to original position

    The canvas portion of the screen will show the area around one player, while the normal viewport will show the area around the other.

    I'll make a more usable example later.

  • hmm. I don't know if that would be a good idea. For a big game, there would be a lot of objects to move (Even if you put them in families). Also, if you don't move the player with them, then the enemies can move and hurt the player when they shouldn't. I have another idea that might b worth checking out: construct.net/en/forum/construct-3/general-discussion-7/split-screen-effect-144701

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • oosyrag

    Anyway, how's that example coming? If it works I am very eager to use it. I've tried nearly everything I can think of!

  • I assumed from your reply that you were not interested in this method so I didn't revisit it. It was a pretty quick modification though.

    dropbox.com/s/p2ilod6sl892gga/splitscreenexample.c3p

  • Dude, that is so cool! Thanks for sharing!

  • How would I keep the canvas in the right side of the screen? When blue player is around the edge, the canvas moves around. Any help with this?

    Also when I disable the unbounded scrolling, it's even worse (I never enable unbounded scrolling in my projects).

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