Advertisement

Developing Apps/Games On Firefox OS ?!?

Started by July 21, 2013 10:33 AM
18 comments, last by SimonForsman 11 years, 1 month ago

I have been doing some reading about the new Firefox OS ( project "Boot to Gecko" ), and I have been quite a bit confused on how folks will be developing apps / games for it.

From what I read, the language that will be used will be pure HTML5 ( JavaScript ), which naturally raises a lot of questions.

* How do you use databases ?

* How do you manage user accounts ?

* How do you use I/O ( which JS isn't good at ) ?

I've asked the same questions in the official Mozilla forums, and they have no answers ... sad.png

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

Javascript does support file I/O... it's just horribly cumbersome to use because everything is forcefully asynchronous.

http://www.w3.org/TR/FileAPI/

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.
Advertisement

That's interesting topic smile.png

I think you can write your game in C/C++, then export the LLVM code with Clang and finally port it to FirefoxOS using emscripten (from LLVM to Javascript). Yet, I am completely confused myself too.

Check this game for instance.

Databases:

You can use IndexedDB API, which allows you to store a database in the client's storage (subject to their own policy restrictions), and efficiently index it even if it contains many items.

If you want to keep your database on your server you can do whatever you like there.

* How do you manage user accounts ?

As far as I understand, the device is assumed to have a single user. If multiple users can exist, they each have their own copy of the game which shares no data with the others (similar to, e.g. on Windows if you ran the game in a web browser).

If you mean server-side, then you can do it in any way you like. You can use localStorage to store the user's credentials then contact your server to do synchronisation or anything else you like (suppose you have a locally-runnable game, but you want to share "achievements" or some stuff like that).

* How do you use I/O ( which JS isn't good at ) ?

A variety of different ways depending on what you want. JS is fine at IO.

For loading "generic content", your game is simply a web application which happens to be loaded into the device memory for offline use. Therefore you can

a) Just ignore IO, and when you reference an image, it will lazily be loaded from the offline content store (NB: This is not a good idea in most cases, as your game might start playing before all its contents loaded, which will cause the player some confusion, especially if they are attacked by an enemy which isn't loaded yet)

b) Preload images etc, in the standard manner of a web application (You can create an Image object and set its .src property) (you can use "load" events to detect when they have completed loading; you can display a splash screen, loading progress bar etc)

c) Load other types of content using the respective APIs, for example load text files using XMLHttpRequest object (which is badly named; it can be used for non-XML content).

There is no "POSIX IO" API, you can't use open(), read(), close() to load a file. Javascript doesn't use these paradigms, but it doesn't mean it can't do IO.

Oh yes, you can also load binary data into typed arrays using XMLHttpRequest. But you knew that, right?


How do you manage user accounts ?
Oh Shippou you're being so retro. Look it's web. Let me write it again. WEB. WEB WEB WEB. It's no crappy logins nor anything anymore. You know those guys asking for multi-users? Oh, that's so last century! Just buy a device each one and everybody will be happy! Happyness! Why to have OpenOffice when you have gdocs, which you can get from anywhere! Look, it's the web!

I cannot believe this FirefoxOS thing myself.

Previously "Krohm"

Advertisement


Oh Shippou you're being so retro. Look it's web. Let me write it again. WEB. WEB WEB WEB. It's no crappy logins nor anything anymore. You know those guys asking for multi-users? Oh, that's so last century! Just buy a device each one and everybody will be happy! Happyness! Why to have OpenOffice when you have gdocs, which you can get from anywhere! Look, it's the web!

I know you're being sarcastic but remember we're indeed trying to go to extreme lengths to get rid of logins as much as possible. These days all services are expected to work directly with social network accounts which you will be already logged into (due to the cookies still being around).

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.


I know you're being sarcastic but remember we're indeed trying to go to extreme lengths to get rid of logins as much as possible. These days all services are expected to work directly with social network accounts which you will be already logged into (due to the cookies still being around).

And what about people without "social network accounts"? Locked out of the internet? The day newborn babies get an auto-generated set of Facebook/Twitter/LinkedIn/Google+ identities is the day I leave this planet. angry.png

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

A lot of folks are getting tired of creating 5,000,000 accounts for everything-single-site-in-existance ..

On a side not, no one ever said how to use JavaScript to listen to ports, and respond to incoming packets ... which is kinds very important with almost any app connected to the internet ( and don't say "load a web page" ).

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson


On a side not, no one ever said how to use JavaScript to listen to ports, and respond to incoming packets

Is it possible to do that? I keep hearing about a thing called XMLHttpRequest. I'm going through the Mozilla Developer Network those days with AJAX and that sort of things. They have nice "taste" in a certain sense.


I know you're being sarcastic but remember we're indeed trying to go to extreme lengths to get rid of logins as much as possible.

More seriously, how are you with fingerprint IDs? I'm fairly positive about those.

Previously "Krohm"

This topic is closed to new replies.

Advertisement