Compatibility

Web browsers do a great job allowing old sites to still work. But websites rarely do a great job allowing old web browsers to work. Which means that if you have an old device with an old web browser on it, the internet won't work for you. I don't know if it's this way by purpose, but this is one of the ways technology companies and software producers abuse you as a user.

My goal is to try to make my games work with all web browsers who support WebGL 1 on all hardware that supports WebGL 1. That at least makes my games playable on devices from around 2012-2014. Imagine that instead of buying a new game console for hundreds of dollars and games for almost a hundred dollars, you could get that old computer that has stopped functioning with modern software back from your basement, and turn it into a game machine that can play kbz.se games.

Imagine how much less hardware we could buy, how much less material would be wasted on devices that we throw away after 5 years anyway, and how much less electricity we would drain, if we didn't need to buy new computers and phones every half-decade, and if we also could begin using our old ones again (because the software didn't grow more and more resource-draining, but maybe even the opposite, because people programmed the programs to be efficient and backwards-compatible)!

I've written about this before on kbrecordzz.com
https://kbrecordzz.com/2023/03/21/the-console-feeling/
https://kbrecordzz.com/2024/11/writing-web-code-in-a-normal-way/
https://kbrecordzz.com/2024/11/making-backwards--and-forwards-compatible-web-programs/

Performance is one thing. I can only make it as good as I can. If the computer is too weak to play 3D games, it simply is. There are lots of things possible to improve, but there's also a limit here. There's no clear way to achieve this, you just have to be engineering and make it work. Different games will have different problems to solve. So I won't describe this in more detail here.

And you have to allow TLS 1.2 (HTTPS), or plain HTTP without an S at the end, which is a hard problem if I want to continue hosting my games on Neocities. If I use my own servers, it's easier to solve, but I'm not there yet.

Other than that, there are a couple of modern web browser features you have to live without, to make your game work in web browsers from 2012-2014. You have to rely on timeless and proven concepts in HTML and Javascript, and not use WebGL versions over 1. The standards say one thing, and web browsers try (or don't try) to follow the standards. The result of what the web browsers implement is the reality that we have to adapt to. Web browsers don't want to break old websites, even if the old features these sites use are by definition "deprecated" in the standards. This results in some technically deprecated features (like the HTML tag "font") being among the most dependable features of all. On this page I try to capture the reality of web browsers and what you can depend on and what you can't depend on.

Here are what I've found to not work:
HTML

CSS
* image-rendering: pixelated

Javascript
* let, const - use only "var" instead

* class, and other object oriented stuff?

* new URLSearchParams()

* document.createElement().href = "sajdasjk" - use document.createElement().setAttribute("href", "sajdasjk") instead!

* function hej(x = 3) - default parameter values - set default values in the function body instead

* navigator.vibrate()

* performance.now() - use Date.now()

* WebAudio API

WebGL
* pointsize in WebGL - max allowed pointsize varies on different platforms and implementations. Use planes made of triangles instead of pointsprites, at least if the sprites cover a larger part of the screen

* WebGL 2 and above - use WebGL 1 (experimental-webgl)

* WebGPU