10 ms·
A lot of totally valid opinions out there about this, but I personally _love_ how the browser is becoming a very well-featured sandbox for shipping applications
by Waterluvian 4y ago
A lot of totally valid opinions out there about this, but I personally _love_ how the browser is becoming a very well-featured sandbox for shipping applications.
For personal fun and learning, I'm making a complete 2D video game in ideally less than 1MB. It has 60fps graphics, full spatial audio, and gamepad support, all because the browser has a lot of these APIs that didn't exist when I was starting out my career. The only issue I'm having so far with the user experience is the desire to assume complete control of your keyboard the way a traditional PC game would, because browsers really don't want you to own _every_ key.
- djbusby 4y agoAre you using A-Frame? https://aframe.io/ https://aframe.io/
- Waterluvian 4y agoWow that's snazzy! But no, I'm using PixiJS because my game is 2D.
- croes 4y ago>because browsers really don't want you to own _every_ key. Wouldn't be really a sandbox anymore if they could
- cyral 4y agoAnd theres a LOT more APIs than people realize: https://developer.mozilla.org/en-US/docs/Web/API https://developer.mozilla.org/en-US/docs/Web/API Some interesting ones: - Screen recording/capture - Battery status - Barcode Detection - Bluetooth - Sensors (e.g. Accelerometer) - Wake/screen lock - Color picker - Vibration - MIDI - USB - Contacts picker - Presentation (AirPlay, Chromecast) - Virtual reality
- shusaku 4y agoAny former geocities member us surely aware of the MIDI capability!
- andyhedges 4y agoCouldn't you play a WAV too? But they were too massive at the time for most peoples bandwidth.
- mattl 4y ago<bgsound>
- monocasa 4y agoNot just playing MIDI files, but interfacing with MIDI controllers (including ones that weren't designed to be accessible over the web leading to RCE).
- lucideer 4y agoThese are all Javascript APIs. I think what's particularly notable about the OP is that it's HTML.
- cyral 4y agoYes but the person I'm replying to is talking about JS APIs
- spaghettiToy 4y agoI'm here for the JS comments. I'm amazed at how quickly I can throw together a front end feature in JavaScript on my otherwise html site. Really all of web impressed me over the desktop/app counterparts. I wrote and read to/from a php database with less than 2 hours of time. Laravel has me doing user authentication + useful coding in less than 40 hours after the tutorial.
- megous 4y agoMost of these are not available in chrome or firefox.
- naillo 4y agoOld enough to remember when the accelerometer didn't require permission to access.
- dheera 4y agoYeah you could use the vibration API and accelerometer API as a very low bitrate TX/RX system for devices on the same table and close enough. No permissions required.
- chrisweekly 4y agoI vaguely recall there being some early-days accelerometer-based webapps that absolutely destroyed batteries, because the high-resolution accelerometer checks required responsible throttling / debouncing. So gating it behind permissions makes some sense to me.
- codethief 4y agoMe too but I'm glad it does now and I don't have fear (web) apps that exploit the accelerometer as microphone.
- adrr 4y agoIt was useful an API to detect if a client was faking their user agent or was a bot. When I worked for a neo bank we abuse all the APIs to detect if client was a real person or not without having to use captchas.
- tinus_hn 4y agoUnfortunately many of these leak identifying datapoints so due to abuse they are now blocked.
- whywhywhywhy 4y agoUSB/Bluetooth is underrated because it means you can ship hardware products that can have their firmware updated or connect and sync with a web service without having to build/ship/maintain a whole app for it that will eventually stop working after an OS update.
- spaghettiToy 4y agoIs Bluetooth good yet? I had issues as recent as last year's new products. But otherwise I love the concept of hardware access with HTML. The embedded guy in me thinks the future is going to be crazy. I can't quite wrap my head around the possibilities.
- autoexec 4y agoMy guess is that hardware access with HTML will mostly bring about remote exploits and massive privacy problems. I disable all of it. I also keep Bluetooth disabled on my mobile devices. It's used extensively to ID and track people and their devices. For things that don't move and are only ever paired to a single thing (like a speaker) it works fine. Most of the complaints I hear about bluetooth are from people who pair multiple devices to a single source and want to easily switch between them.
- david12345 4y agoHell, you can even root an android phone via the browser! https://protonaosp.org/install/web https://protonaosp.org/install/web
- easrng 4y agoA lot of those are Chrome-only.
- robotnikman 4y agoOne thing I miss about adobe flash was the software available to create flash games and animations. It was relatively easy to use and felt like it had a good combination of graphical tools and scripting to allow you to create what you wanted I wish there was something similar for but for modern browsers, taking advantage of HTML5 and all the browser API's available now which previously required a plugin like adobe flash. As you mentioned the API's and capabilities are there, built right into the browsers now. I just wish the tooling was better.
- codetrotter 4y agoThe Adobe Flash authoring software has a successor called Adobe Animate. I’ve only ever exported to MP4 video files with Animate, but I know Animate has some HTML5 export options. But I don’t know how comfortable it would be to use for creating graphics and animations for actual JavaScript games and/or web applications.
- mkl95 4y agoWebGPU feels like a godsend, I hope it gains popularity ASAP.
- Waterluvian 4y agoYeah! Any time I've tried to use WebGL... pain.
- merelysounds 4y ago> I personally _love_ how the browser is becoming a very well-featured sandbox for shipping applications. Same. My latest project is a waveform generator for wavetable synthesizers [1]; there are visualizations, as well as handling audio (not real time but still). I was surprised that I could build that as a web app and achieve good UX and performance. [1]: https://merely.xyz/waves https://merely.xyz/waves
- srcreigh 4y agoYou’re down. I want to see your site! When can I see it? And your domain is really cool too. I presume it’s like a self deprecating math joke.
- merelysounds 4y agoI had a typo in url (wrote .xys instead of .xyz, fixed now), thanks for letting me know. The .xyz pun was not intended, but it does make a lot of sense for a math related app. Thanks for spotting that too!
- srcreigh 4y agoCool! some early feedback: - Very hard for me to find the play button.. took like 10s of looking. I looked at the segment buttons - Accidentally, I got some really cool sounds by mashing the play button to overlay it. Not sure why it gets distorted if it should be playing the same waves. But it sounds cool
- angrygoat 4y agoThis is very cool, although I was just playing around with it and my cat cast me a filthy look and raced away at high speed. Your warning about playing the sounds is well given! :)
- gofreddygo 4y agoI know nothing about this. It looks cool. I want to learn more. Where do I start ? DDG search does not help much [1], [2] Any pointers ? 1: https://duckduckgo.com/?q=waveform+generator+for+wavetable+synthesizers&ia=web https://duckduckgo.com/?q=waveform+generator+for+wavetable+s... 2: https://duckduckgo.com/?q=wavetable+synthesizers&ia=web https://duckduckgo.com/?q=wavetable+synthesizers&ia=web
- lucideer 4y ago100% And also doing this declaratively makes it so much easier to secure & build well-thought-out privacy & consent UX around. An imperative API has so many variations on implementation approach for the end-developer / API consumer that the combinatorics become much more challenging for browser implementers. (obviously imperative APIs for doing this already exist, but the existence of this declarative API at least makes limiting imperative API access less draconian/severe as a measure).
- secondcoming 4y agoWhy would anyone want, or let, a webpage assume full control of their keyboard?
- dekhn 4y agossh terminal
- Waterluvian 4y agoMe, because I want to see how much I can make a web browser video game feel like a native game. Other than that... I'm not sure even I'd want to allow a webpage to do that.
- dekhn 4y agoI used to think the browser could be a sandbox, but its evolution to one has been mighty slow- decades to pick up some basic features any desktop application developer has been able to take advantage of, easily, for decades.
- z3t4 4y agoIf you make a manifest file and listen to the install event users can add your game to their home screen. Aka. PWA. Then you can listen to most keys! Works for chrome on desktop and all major mobile browsers. Safari don't have the install event and need to be "installed" manually I have made a web editor that uses this. There is an example pwa app Https://webide se/
- osrec 4y agoThanks for saying this, as I know a lot of people on HN have very negative feelings towards this trend. Personally, I feel the browser is a great way to stop reinventing the wheel, and the APIs abstract away a lot of the heavy lifting. They pretty much get you 80% of the way there, and the last 20% is where you can really add the stamp of "uniqueness" to your implementation. The fact that the browser is also heavily sandboxed is another big benefit. I personally feel safer using a web app than a native app on any device, any day. You just don't know what a native app might be doing in the background, but with a web app, I feel things are much more transparent. I can potentially see a future where you could deploy docker-like containers directly from the browser, while keeping the same fine grained controls that a browser allows. Then it really would make the web a truly flexible, infrastructure agnostic application delivery platform.
- ryandrake 4y agoIt just feels like every time software developers can't (or won't) build things cross-platform, users end up with bigger and bloatier solutions and poorer experiences. First, it was cross-platform UI toolkits and OS abstractions like Qt (require users to use a big, "lowest common denominator compromise" library ) Then, it was web apps (require users to provide a browser) Then, it was Electron and friends (ship the whole browser with the application) Then, Docker and containers (ship the whole OS with the application) Where do we go from here? Ship an entire physical PC to the user pre-loaded with the application? We keep trading away the end user's resources and convenience to gain developer's time and resources. All to keep (badly) solving the "Well, it works on my computer" class of problems.
- MR4D 4y ago> Ship an entire physical PC to the user pre-loaded with the application? Ironically, that’s essentially what IBM did with mainframes. Another example of what’s old is new again.
- arghwhat 4y agoEh? Mainframes are and always were general purpose computers, and run stufd like Linux just fine. Nowadays they are mainly meant as machines with extreme reliability guarantees, from things like running multiple processors in lockstep to detect spontaneous processor errors, but they're still just computers. While their cost makes them hugely impractical for .øst usecases, mainframes do have some really cool tech, including their new CPU designs with quite interesting cache layouts.
- johnfn 4y agoWe're certainly veering off-topic, but I'd love to hear about which game engine you ended up using!
- Waterluvian 4y agoBecause the entire point is to learn and not actually to ship a product, I wrote my own. The biggest libraries I use that I didn't write are HowlerJS for audio, PixiJS for graphics, and React for UI. The actual "game engine" is a very primitive one I wrote myself. You can see it here: https://github.com/ablakey/kestrel/blob/master/src/Engine.ts https://github.com/ablakey/kestrel/blob/master/src/Engine.ts One of the best things about NIH-ing my own engine is that I don't need to make it generic, meaning one less layer of abstraction to complicate implementation and debugging.
- amalcon 4y agoI recognize that this kind of thing is useful to the developer, of course, and we've gotten a lot of neat things this way. My worry is basically that the absent functionality is the best thing about the web as a user. Take the notification API: One of the nice things about web pages and apps is that they stop bothering me once I close them; not so if I accidentally permit notifications! Fortunately I can turn that whole feature off, but at first I found myself wondering who ever thought that would be a good idea. Yes I picked an extreme example, and I don't actually mind some of these things. I wish there were a permission pop-up before playing sound at all. Also, WebGL does concern me, since heavy GPU usage can draw a lot of power. Things like gamepad support and spatial audio (if they are behind permission pop-ups) don't really bother me, though.
- johnfn 4y agoI don't know, this seems like a good compromise to me. Some apps (calendar) would be absolutely crippled without them. For everything else, I've just never turned them on in the first place. > I wish there were a permission pop-up before playing sound at all The browser can't actually play sound unless 1) it's triggered as the result of a user action (such as a mouse click) or 2) if you've often listened to sound on that page in the past.
- amalcon 4y agoMy answer to this is that the calendar just does not need to be a web app. Weakening a primary advantage of everything else on the web just so that my calendar can be a web app seems like a poor trade-off. Re: sound, "Triggered as the result of a user action" is not a high enough bar.
- lcnPylGDnU4H9OF 4y ago> the calendar just does not need to be a web app And the chat app, and the email app, and the social media app (other opinions about social media notwithstanding). I think each of these things have their own legitimate use for notifications. I guess it's the point of "weakening a primary advantage". I don't see how it's weakened (or rather, I don't see how it's a problem) when the notifications are on a per site permission. Especially so when the notifications can be turned off completely per browser. > Re: sound, "Triggered as the result of a user action" is not a high enough bar. I'm with you on this. Although it took until this thread for me to realize that sound at all should be a permission.
- coding123 4y agoThe thing I don't like about the browser becoming that is that every web page will now have tons of prompts. Something we were trying to kill off with IE years ago because too many people just click "accept". The thing I like about it is what you just said.
- LAC-Tech 4y agoI personally _love_ how the browser is becoming a very well-featured sandbox for shipping applications. For me the big thing holding it back is IndexedDB. Actually in the process of designing a software solution that needs to work on desktop and mobile, and be able to write mission critical data while offline. As much as I'd love to just make one responsive web app - I just can't trust the safari or even chrome browsers to not /dev/null users data if it feels like it.
- valenterry 4y agoYes! And that's much better than Apps, where you are forced into an unfavorable ecosystem.
- dahfizz 4y agoI love the idea of a good cross platform sandbox to ship apps. I think it's really unfortunate that we chose a web browser to be that application platform. The underlying technology is terrible. HTML and CSS are for displaying documents. Things which should be trivial to add to an application UI (add a ListView, anchor element X to be left of element Y, etc) are nigh impossible without using some bloated toolkit anyway. JS is a slow and brittle language to work with. The fact that the web became an application delivery platform is an unfortunate historical accident that I am not sure we can recover from. If we devoted 10% of the engineering that went into "web technology" into an actual dedicated cross platform application platform, it would be way better than the web is today. Faster, less bloat, better technology so that we don't need frameworks on frameworks to do a hello world, etc.
- lmkg 4y agoThere is a possible future where HTML and JavaScript are relegated to historical shims for WASM and <canvas>. I don't know if this is a good future or not, but you want a future with cross-platform apps freed from "web technologies" that's probably the one that's most achievable from the state of things today.
- rgersten 4y agoAny chance you’re blogging about the process? I’d love to follow along, as I dream of doing the same thing one day.
- Waterluvian 4y agoI really really should. I want to un-abandon my home page and maybe start writing about it there. FWIW the code is here: https://github.com/ablakey/kestrel https://github.com/ablakey/kestrel
- na85 4y ago>A lot of totally valid opinions out there about this, but I personally _love_ how the browser is becoming a very well-featured sandbox for shipping applications. Unfortunately what's convenient for you as a developer is more often than not hostile and awful UX for me as a user. Too often, developer convenience trumps good UX.