2017-07-02 22:06:21

The recent release of Dark Defender got me interested in making audiogames in javascript.
What libraries exist for doing things with audio? How complicated would it be to make a game in JS? How accessible is Electron?

“Can we be casual in the work of God — casual when the house is on fire, and people are in danger of being burned?” — Duncan Campbell
“There are four things that we ought to do with the Word of God – admit it as the Word of God, commit it to our hearts and minds, submit to it, and transmit it to the world.” — William Wilberforce

Thumbs up

2017-07-02 23:05:36


Great question! Glad people are getting interested!

Electron is pretty easy to setup. It's all done through the command line, and the tools are accessible.

There is a library called Sono which makes creating audio games pretty easy. For input I simply use JQuery, even though that's probably already overkill.

You're just gonna have to be aware what you're getting yourself into. This is a constantly changing thing, and implementations vary quite a bit from browser to browser, so it's going to be a fight sometimes figuring out what works, reporting issues, etc.

I'm working on a lane splitter type game for the browser. It should be done in relatively short time, week or two. You can take a look at the source if you're interested when it's up.

Wanna play my Games? Listen to my Music? Follow me on Twitter, and say hi~
Code is poetry.

2017-07-03 02:55:13

Is it possible to test offline, or are we still in the "must load from server" security mode?

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up

2017-07-03 08:34:31

I always test with a simple express server running in node, but you could use things like xampp if you want. The libraries make requests and you need something to answer them.

Wanna play my Games? Listen to my Music? Follow me on Twitter, and say hi~
Code is poetry.

2018-02-26 06:17:42

@Ghorthalon: Oriol told me about your audio game template for Node. Mind linking it here, or is it not available for everyone interested in JS?

I think I prefer the syntax of Python over JS, but people like Danny have had issues with Python and macOS so hopefully I can persevere and learn this for new games on macOS's sake.

Thumbs up

2018-02-28 12:17:36

Ghorthalon, I would like to see your Node environment. Have you used any of the existing engines like Phaser?
It would be nice if someone created something like create-react-app for audio games that allows for easy packaging, easy deploying on a server, and has all the things one needs to create audio games, like a sound library, event management, scene management, serialization, and everything else one needs to create a Swamp online. Also maybe some massive compression tools to help minify the assets. It would also be cool to start a repo of procedurally generated sounds, which would be significantly smaller than sound files. I don't think Sono allows for manipulation of oscillators, but WAD does and it also allows for using 3D Audio.
For normal user Interfaces, AccDC has fantastic accessible widgets and it is basically JQuery with a ton of widgets. I could see someone create a Castaways using this data grid that both blind and sighted players could play.

Also, there is a very nice implementation of python in the web browser which can use WAD, Sono and any javascript library, you just import it using python syntax.
(there are compilers that can make your code incredibly small, but I think Brython is just super fast and easy to use).

Frankly, developing Audio Games in the web browser should be easier than anything else, so it's just getting past these first few hurtles before it will become super easy. Also, there needs to be a learn javascript the hard way so people can quickly get up and running with Javascript.

Thumbs up

2018-02-28 21:19:59

*gets halfway through post 6, goes on a mental rant about all the ever-thickening layers of obfuscation and complexity to do basic things*
*Reads last two sentences*

I mean, I get that computers don't work like human minds. "i get that playing sound, for example, is a complicated task that you don't get for cheap until someone wraps it in a simple interface. The fact that no one can do this without it almost immediately becoming outmoded and requiring rebuilding from scratch every couple years, and that doing so takes another couple of years, repeat ad infinitum, is a special kind of frustrating. And the dozen other dependencies one needs to get anything else working are just... arcane things one must track down, like the flippin' Triforce.

You know what programming needs? Something that does this dependency bullcrap automatically. Instead of downloading the one thing you need, only to be sent on half a dozen fetch quests to get its dependencies, installing the one should check for the others, and offer to automatically get them if they aren't already installed. Less time questing, more time creating.
Javascript, as a language, is easy. Javascript, as something to make games with, is like having to build a whole woodshop, when all you get for free is a mallet and a tape-measure. And also, you have to design your products to fit with certain other products, which disqualifies them from fitting with some other products, but only some of the time, and depending on what month of what year it is.
Gah I wish console development was something resembling affordable. You get 5 years of consistency, and largely generalizable tools that are easy to find. Shame about the outrageous licensing fees and inaccessible development environments. Also the fact that there are 2-3 competing consoles at any given time, and people still on old consoles, but at least it's less chaotic than web development, pre and post "W3c standards alike.

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up

2018-02-28 22:38:11

Yes, this is the beauty and terrible thing about Javascript. No one tells you what you should do, instead they allow people to build the best libraries and share them on npm. This allows for incredible freedom, but extreme complexity and it leads to developer burnout quicker than in other languages.
You have the same problems of serialization, event management, and sound generation  in any language other than BGT. Javascript is used everywhere. It is the Most popular language in the world, just because it is the only language of the web (other than the very new web assembly).
projects that are newbie friendly have a cli tool that creates everything you need to develop with that project. This is what needs to happen with audio games.

Thumbs up

2018-03-01 14:22:07

Well CAE.
We actually have that for some languages. We have pip for python, npm for Node (and javascript) and don't even get me started on Java where we have Maven, Ant, Gradle and those were only what I could list on top of my head.
- NicklasMCHD

I'm me. Just me. No one else. Only meeee!

Thumbs up

2018-03-02 05:19:49

I'd learn Python, but why, out of the audio games in Python, not on the Mac yet?

Language wise, I think I'd rather learn Python, it's syntax seems a lot easier than Javascript. All of the Javascript games out thus far are on the Mac, because we don't have to depend on Windows only libraries like Tolk in order to get things going.
I wish that audiopygame was still being updated, but alas. Anything but BGT really... made one game with that and am not a fan of the syntax at all. I'd be curious what people think the best language to learn how to develop audio games is based on syntax.

Thumbs up

2018-03-02 12:16:59

You are going to get a biased response from this thread. As someone who has developed in both python and Javascript, the cross platform abilities of Javascript are unparalleled. The eas of learning in python are unparalleled.
I just built a project that required sound generation using python, and the only sound library I could think of that allowed this was libaudioverse. I developed this project, then realized my teammate only had a mac, so was never able to run my script. For most things though, python is pretty good for cross-platform development. But compared to Javascript, there is no comparison.
If you are in a rush and want to get a game out, I would say that the browser is the way to go. If you know a little python, then using something like Brython is your best bet. In Javascript, the best way to do things is to research for a little while (like maybe a week), on tools that you like, then once you have made your choice, stick with it and don't change unless there is a very good reason to. There are over 475,000 javascript libraries, and to keep from being overwhelmed, you need to limit yourself to the libraries that you have chosen. You can literally spend all your time looking at libraries, so in Javascript, find one and stick with it. It is difficult to go wrong with libraries in Javascript, so just find something that feels good to you.

For example, use sono for audio and use the ticker system in pyaudiogame along with brython. Then get an account on Amazon S3 or Github to host your webpage. That's all you need to do to start developing python in the web browser. There needs to be a tutorial for this, and I'll put it on my list of things to do.
Here is what I think should happen:
There should be something called webaudiogame that functions like create-react-app. The goal would be for someone to type something like:
webaudiogame python appName
and a dir called appName would be created with everything needed to develop audio games in brython. All one would need to do is enter the app dir, and type npm start to run the app in their web browser. There will be a tutorial on how to deploy to S3 or Github, and maybe even a tutorial on python using brython later on. The initial src folder will have some code that will show how to capture keyboard input, schedule events, manage sounds, and save.
The webpack server will have hot module reloading and the included packages will be, either sono or WAD (debate please), then some libraries that make saving and queueing events easy. Then a script to allow one to package their code in an executable, probably using Electron.
This would allow people to quickly develop audio games in the browser without spending lots of time looking for libraries.
What are your thoughts?
I can start this kind of thing, but as you see from pyaudiogame and the accessible Unity Template, I'm not good at maintaining or extending projects past the basics. So if I should spend the time creating something like this, then there should be some other contributors who can write tutorials, use the package, and write new modules.

Thumbs up

2018-03-02 14:37:57

If I'm not wrong, the biggest reason to start this project is cross platform support right? In that case, there's a unity project you're already running. And trust me, you'll be far more pleased if you could complete the unity project. The reason is that even if you manage to successfully complete the java script project and even if it works, there's no way that  that can overpower unity. Unity already got cross platform support and unity is specially designed for game development. And the fact that unity is so much popular is alone enough to prove that it's something. So for above reasons, I'd suggest to continue the unity project and then do the java script  thing if you really want. Please note that I didn't want to discourage you or anything, I just said what I had in my mind after reading your posts. One thing which comes into mind is that you might worry about will people really use it? And the answer to that can be, If people see that a project is not improved in a long while or is worked on very slowly then it's regarded as discontinued. People only like to use a library which is being worked on. So after people start to see that your project is improving at a good pace there's no doubt the project has potential to throw out BGT from the market.

There once was a moviestar icon.
Who prefered to sleep with the light on.
They learnt how to code, devices sure glowed,
and lit the night using python.

Thumbs up

2018-03-02 14:54:27

You're forgetting that Unity isn't really accessible...

Thumbs up +1

2018-03-03 21:00:45

@Frastlin: those are some great ideas.
I've started reading Thinking Python and have a good general idea of these concepts, however I think I learn better. by example. Someone suggested I can use Chris Toth's Sound Lib library for sounds, Pygame for the game, and accessible Output for screen reader support.
The trouble for me then is, first of all how to use sound_lib? There doesn't seem to be any reference anywhere on it's usage.
Then, there's what to do with Pygame. If I'm not using it for sounds, I should use it for game logic?
And then since this is ideal a cross-platform game, which was why Sound Lib was suggested to me, what version of accessible Output will work with Python3 while also working with macOS as well.
I guess someone asking these questions should stick with BGT for a bit, but nope. I can't deal with the brace syntax and all that. That said, CodeRunner seems to do a good job at closing blocks and things of that nature, so I might not have as much trouble as I did with BGT. If I go with Javascript it'll have to do.

Thumbs up

2018-03-03 22:34:08

Pygame is for things like keyboard input, the game window, simple 2d graphics, and rectangles if you're using int precision. Pyglet seems to have overtaken pygame in popularity, fwiw.

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up

2018-03-03 23:57:03 (edited by cartertemm 2018-03-03 23:58:29)

sound_lib is quite easy to use.
Note: untested code ahead.

import sound_lib
from sound_lib import output, stream
s=stream.FileStream(file="some random filename")

now it's up to you. Play or modify some properties
, the properties shown here aren't required, but here for demonstration

s.pan=0 #-1=left, 1=right
you can now either
s.play() #plays the sound normally
s.play_blocking() #play and wait until the sound is done before continuing

Their are many more options, I recommend creating the objects and then using dir. Dir is an extremely helpful function for finding attributes no matter the type, and is a lifesaver for undocumented code. the help function will give the function signature, and doc string if their is one. Also have a look at sound_lib/output.py, stream.py, recording.py, etc depending on what your trying to do.

Thumbs up

2018-03-04 11:34:45

The problem is that I don't have the time to actually build very good games. I want to help other people build games on the web, but I'm not sure how to do that. Reading these comments hints to me that there needs to be less complexity around tools. As a sighted developer, Unity is pretty much the tool. We don't have anything like that for audio games.
What needs to happen with Unity is a blind person partnering with a Unity expert to finish building the tools in the accessible Unity template so they can make a game. The Unity expert needs to be very well-versed in how scripting Unity itself works. I was working with Michelle, the maker of Crafting Kingdom, but I haven't been able to get a hold of her for a while. I'm also not developing unity games at the moment.
The problem with Unity games are that they only use canvas in the web browser, so if you wanted to build something that had any real elements, then it wouldn't work.
So until this team of developers really spends some TLC making tools for blind developers to develop in Unity, then it is not going to be the most accessible. Right now you could probably build a sidescroller in Unity using C#.
The existing tools are to use whatever libraries you can get in python:
may be another resource.
Or use brython with sono or WAD. The webaudio interface is not going to change any time soon and you really have some great functionality in Brython, even though it is a transpiler.

Thumbs up