<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mia</title>
    <description>The latest articles on DEV Community by Mia (@mia_b266f3da8278efe1d1cb1).</description>
    <link>https://dev.to/mia_b266f3da8278efe1d1cb1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4279444%2F1d7bfd0c-9d9e-4089-acce-edc94b62a910.png</url>
      <title>DEV Community: Mia</title>
      <link>https://dev.to/mia_b266f3da8278efe1d1cb1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mia_b266f3da8278efe1d1cb1"/>
    <language>en</language>
    <item>
      <title>One keyboard, two cameras. Building a split-screen ski race in Three.js</title>
      <dc:creator>Mia</dc:creator>
      <pubDate>Thu, 03 Dec 2026 01:56:41 +0000</pubDate>
      <link>https://dev.to/mia_b266f3da8278efe1d1cb1/one-keyboard-two-cameras-building-a-split-screen-ski-race-in-threejs-3m65</link>
      <guid>https://dev.to/mia_b266f3da8278efe1d1cb1/one-keyboard-two-cameras-building-a-split-screen-ski-race-in-threejs-3m65</guid>
      <description>&lt;p&gt;I’m working on Northbound, a Christmas browser game with a local ski race. Two people can sit at the same computer and race downhill. Santa uses WASD, and Holly uses the arrow keys.&lt;/p&gt;

&lt;h2&gt;
  
  
  One canvas, two camera views
&lt;/h2&gt;

&lt;p&gt;Both skiers are in the same Three.js scene, and each has a camera that follows them down the hill. Each frame, I render the scene twice into one canvas.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;setViewport()&lt;/code&gt; sets the half of the canvas each camera renders into. &lt;code&gt;setScissor()&lt;/code&gt; keeps that render inside its half. Each camera gets an aspect ratio based on the width of its own view, so the scene stays in proportion when the browser window changes size.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens when both players reach the same gift?
&lt;/h2&gt;

&lt;p&gt;That turned out to be the more interesting part. The race updates both players first, then checks where each skier’s movement path crossed the gift’s pickup area during that frame. The earlier contact gets the gift. On an exact tie in both contact time and distance, priority alternates by gift position.&lt;/p&gt;

&lt;p&gt;The result is one shared gift on the course. As soon as one skier claims it, it disappears from both views.&lt;/p&gt;

&lt;p&gt;You can &lt;a href="https://santagameonline.com/santa-ski-race/two-player/" rel="noopener noreferrer"&gt;try the two-player race in your browser&lt;/a&gt; with a keyboard and a friend.&lt;/p&gt;

&lt;p&gt;If you’ve built split-screen in Three.js, how do you handle objects that should be visible to only one player? I’d be curious to hear how you manage that across render passes.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post was drafted with AI assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>gamedev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
