Dev Blog #1
How Sharklet is built
Hey everyone! I'm making Sharklet, an Airbus A320 flight simulator for Roblox. It's not out yet, but I wanted to show you what's going on behind the scenes. In this first dev blog I'll go over how the plane flies, how the cockpit works, and how I got the whole world into Roblox.
How the plane flies
Instead of pushing the plane around with a couple of forces, Sharklet works more like the flight sims you'd play on PC.
I split the wings, tail and body into lots of small pieces. Many times every second, the game works out how the air hits each piece and how much lift and drag it makes. Then it adds it all up to move the plane.
Because of that, a lot of real stuff just happens on its own without me scripting it:
- One wing can stall before the other, so the plane rolls if you get too slow.
- Flaps change how much lift the wing makes.
- The air coming off the wing changes how the tail flies.
The landing gear doesn't use Roblox physics either. Each wheel checks where the ground is, and the leg squishes like a spring when you land. A tyre model handles rolling, braking and grip, and anti-skid stops the wheels from locking up.
Fly-by-wire: the plane helps you fly
On the A320, the stick doesn't move the control surfaces directly. You tell the flight computers what you want, and they move the controls for you. Pull back and you're asking the plane to pull up. Let go and it keeps flying the way it's going.
The computers also keep you safe. They won't let you stall, and they won't let you tip the plane too far nose up, nose down or sideways. Airbus calls these rules "laws". If some of the computers break, the plane drops down to simpler laws with less protection, just like the real one.
The cockpit actually works
Every system in the plane is built from the same parts as the real one, hooked up the same way. Here are a few:
- Hydraulics: three separate systems called green, blue and yellow, each at 3,000 PSI. Engine pumps and electric pumps power them. One system can help another through a power transfer unit, and if things go really wrong a little wind turbine pops out of the plane to keep the blue system going.
- Electrical: generators, batteries and buses (think of a bus as a big power strip). If a generator cuts out, power switches over to another source, and the screens react to that short gap like they do on the real plane.
- Fire protection: each engine and the APU has two fire sensor loops. Each engine has two fire extinguishers, and the APU has one.
- And more: fuel, bleed air, cabin pressure, anti-ice, oxygen and doors.
Since everything is connected, breaking one thing affects other things. The ECAM is the two screens in the middle of the panel. It keeps an eye on every system. When something goes wrong, it sounds an alert, tells you what's wrong and what to do about it, and shows you the page for that system. There are pages for the engines, bleed air, cabin pressure, electrical, hydraulics, fuel, APU, doors and oxygen, wheels and flight controls. You can even break things on purpose from the failures menu to practise.
Flight plans and autopilot
The MCDU is the little keyboard and screen where you set up your flight. You type in where you're going, how you're getting there, and how heavy the plane is. The flight computer then works out where you are, what speeds to fly, and when to start coming down.
The autopilot can fly the whole thing for you: climbing, cruising, flying holds and going around. It can fly approaches all the way down to an automatic landing, flare included, and keep you lined up on the runway after you touch down.
I follow the real A320 manuals for how all of this works. I also have over 140 test scripts that run the systems outside of Roblox and check that they still work, so fixing one thing doesn't break something else.
The whole world in Roblox
Roblox can't load the whole Earth at once, so my world server builds the ground around you in tiles while you fly. The shape of the land comes from real elevation data, and the colours come from satellite photos at about 10 metres per pixel. The ground close to you is detailed, the ground far away is simpler, and new ground loads in ahead of you.
You might know that the further you get from the middle of a Roblox map, the more things start to shake. To fix that, the game moves the whole world back around you every 4,096 studs, so the cockpit stays smooth no matter where you fly.
Buildings and roads come from real map data. Forests and lakes get added from the land data too, and shorelines have waves.
Real airports
Airports are built from detailed layout data, with real runways, taxiways, lines and signs. They're lit up at night too, with runway lights, the PAPI lights that show if you're too high or too low on approach, and taxi signs that turn on after dusk.
Real weather
Airports all over the world post short weather reports called METARs, usually every hour. Sharklet reads the ones near you and mixes them together to work out the clouds, wind, visibility, temperature and air pressure. A METAR only says how much cloud there is and how high the bottom of it is, so the game works out the cloud type and how tall it is from the rest of the report. It keeps checking for new reports as you fly, and the sky changes smoothly when they update.
The clouds are fully 3D, so you can fly up to them, through them and out on top of them. It gets bumpy inside them, too. Rain hits the windows, and lightning flashes inside storm clouds, with sound to go with it.
Day and night
Where the sun is sets the colour of the light and the sky, from midday through sunset to night. After dark, cities light up, the moon shows the real phase for that date, and away from the city lights you can see the Milky Way.
What's next
The first release will be the A320. After release, I'm planning a Boeing 737 too. Join the Discord to follow along and see new stuff as I make it. Thanks for reading!
Join the Discord