Before I start, I'd like to note that I work in the Unity Engine, but the basic theoretical stuff should be similar just about anywhere.
It's not really hard to get the game's camera/World view or UI to scale to many types of devices with different pixel counts as long as they have the same aspect ratio. But devices in general, and especially mobile phones, have all sorts of variables, aspect ratios can be anywhere from 16:9 to 20:9, and there are all sorts of different types of notches too. For this question I'm primarily going to ask about the aspect ratio and not touch on notches for now to stay on topic, but if you could explain how I can handle notches, that would be a good bonus.
So, how do I make a game for a mobile device, that can be played in portrait and horizontal mode, on anything from small 16:9 screens like the Samsung Galaxy S5, to larger 19:9 aspect ratio (A notch) in the Google Pixel 4?
Unfortunately due to IP restrictions, I can't show art, and I can't reveal the core mechanic of the game. but I have created a general mock up of what the ideal world/UI scaling would look like:
The UI needs to be able to scale to the edges of the display like any other game. But the edges of the world need to be the edges of the screen (There needs to be walls that appear at on all 4 edges of the screen), however because the game is physics based, the walls can't actually move else it would cause inconsistencies between in the game from device to device.
I know what I'm talking about here is primarily theoretical, but as someone who doesn't know much about aspect ratios (or notches), how can I ensure my game works consistently on this range of devices?