Armory as Web Application - Data Management?


How can I manage all the inputs, scores, users etc. (data) from my web application in general? Any experiences?


When you say manage, do you mean saving the input data either to a server or to the local computer?


Thanks Alexander for response.

In my case both methods would be very interesting. If you have any ideas in a certain direction - I would be most grateful :slight_smile:

I must admit, I probably won’t need prepared code to implement, just a technical explanation how you would achieve this. I don’t know if I need to script extra lines in the actual game or if I have to write extra Back-End programs.



Hey Till,

Well, technically it should be possible and there’s probably quite a few ways to do it, the question is mainly which is the easiest. - In either way, I think Javascript calls are necessary, I just can’t remember how exactly to do it, although if Armory doesn’t have some high-level function for making javascript calls, I’m sure Kha probably has some backend ways to do it.

In the first case - Web Application to Local Machine - I think the easiest way would be to make a javascript call to a your own file load/save system functions or even a 3rd party framework (would probably be the easiest, since a lot of browsers have their own quirky code and prefixes and what not). To be more specific:

In the second case - Web Application to Server - You’ll obviously need a server (can be a hosted one, that you use for your own website if you have one), and it needs to accept some sort of input, it can something as simple as a call to a PHP site with a GET header (like on websites, where you see something like (the variables being user, and the highscore), it’s just a quick example, and probably should be done with more secure methods (POST/REST if PHP, or python based or whatever, it’s merely an example for a concept idea). More specifically:

  • Make your game, and have your stuff ready that needs to be managed
  • Upon saving data, have your js calls ready to be able to make some AJAX calls (asynchronous calls through javascript to your server). I think you can use the jQuery library both for this and the local file saving thing (not sure about the latter).
  • Have your server page ready to handle the data that it should store in a database (for example a php page storing in a MySQL database).
  • Done!

I can’t really judge if this seems easy or hard to do, considering what I’ve written, but in essence it shouldn’t be too hard, and (unless someone else is willing) I might be able to come up with some proper examples, if interested.



Not sure how handy but also updated those examples:

Shows both haxe -> js and js -> haxe calls, that part should be easy.


Nice, that’s even easier than I’d have thought!

I’ve made a quick example based on Lubos’ call_js example file. Basically, it’s as easy as adding a little library file in a bundled folder and adding a bit in the haxe file:

  1. Add the small js library in the bundled folder (you can also just include it in the actual CallJS.hx file, but I’ve always found escaping characters a nightmare to work with).

  2. Edit the CallJS file with the code shown in step 3.



  1. This part of code loads the saving function from the “SavingFunctionLibrary.js” (inspired from here) and in this section you can choose your own file name (green) and your save data (blue), your save data can just be escaped to be a haxe variable containing your save data from your game etc.

  2. Click on the cube from Lubos’ initial example file, and you’ll now get a save prompt, allowing your users to save their data - This should work with most browsers supporting the W3C standards/api/and-so-on…:

I’ve attached the file as an example below:

Link to Download

I’ll probably add an example with PHP and SQL on how to save data to a server at a later stage.

Read external data

Thanks for the quick guidance.

Thank you so so much Alex. I’m literally speechless. The quality and quantity of your answers are even more than what I expected. I’m deeply grateful for your ultimate contribution on this subject. I keep in my - if I have some Web Dev question - I might contact you directly, if you don’t mind…^^

I need to mention that your screenshots and explanations help me alot and I know this is not taken for granted. So I really really appreciate your support!

Thanks Till



Happy to help! - and yeah, as for web dev stuff feel free to ask anytime :slight_smile:


@Naxela do you propose then a simple data read from a file, like reading a json file for example ?


Yeah, if the file isn’t too large, a simple “select local gamefile” prompt (and upload if it’s server based) would probably suffice - as for the format, I think JSON is a nice bet on a fitting format (at least it’s very easy to parse both browser- and server-side), another one could be XML (I personally prefer this) - plus both JSON and XML is supported by CastleDB if you’d need that too. Otherwise, if you prefer it even simpler, there is YAML, but I’ve never used it that much


@Naxela if interested, I put the solution I use finnally for reading a local json file on this link Read external data