["User Accounts" when playing a Twine story] If we build it: user accounts

Greetings!
I’m at the National Democratic Institute (NDI) and we’re interested in using games in some of our educational programming. We built a basic games platform in-house but have now decided to pivot to using Twine. One feature that we had and would be useful in Twine is the ability for a user to log in and have their own account. Does this already exist? If not, could you help me scope / ballpark the work it would take so that we can consider hiring a developer to contribute that to Twine?
Many thanks!
Derek

1 Like

When you say “user” and “account” do you mean a person playing one of the games that you produce (like in a classroom setting with a save system) or “user” in the sense of one of the developers who works on the games to create them?

Ah, thanks. By ‘user’ I mean the player, who would be able to save progress and come back to play again / play subsequent levels.

I don’t know if it exists already, but if you do hire someone to implement it, hire greyelf. Greyelf is the best.

1 Like

FYI, I answered this question over at r/twinegames in your “can players have accounts where they can login and return to saved game?” thread.

1 Like

If this is for multiple people using a single physical PC, the simplest option is to give them each individual user accounts on that PC. Then the browser will automatically keep their save data separate.

If it’s for a “net cafe” style thing where there are multiple physical PCs at a single location, you can do something similar but use network/roaming profiles, so they’ll get the same user profile regardless of which physical PC they log into. It’s possible to extend this to multiple physical locations that are part of the same network “chain” as well, though that requires more infrastructure.

If it’s for something entirely Internet-based, that’s trickier; you’d have to replace the default internal-browser-storage-based system with something server-based instead.

1 Like

Is there any reason you’ve chosen Twine for your game engine? It’s not really meant for multiple users since it’s implementation is 100% client-side. The architecture you need is for some type of non-web game runner that has server side control. Modifying Twine to implement a server-side save mechanism (and the authentication) would not be trivial. You might be better off with something like Inform and a web client to display the story. I worked on something like this many years ago (github fyrevm/zifmia) and also a web client implementation (fyrevm-web), but neither could be considered ready for what you’re looking for.

It might be better to define your requirements and ask this forum for advice. So far we’re getting “login/users/save/restore”, but what gaming requirements do you have?

1 Like

Based on who’s asking, this is the most likely scenario.

But if Twine does everything else they need, then it’s just a somewhat minor modification and there isn’t really a better alternative that I’m aware of.

Of course, that’s assuming that Twine does everything else they need. More details on exactly what they need the login for and how they’re using Twine would be necessary to determine that.

Exactly.

I took a cursory look at how Twine handles hooks in JavaScript. You’d need to replace the hooks for SaveGame, LoadGame, and SavedGames (list of saved games). You’d need to add some type of login that Twine respected. For a professional JavaScript developer, this is probably a week or two of work (including design, testing). The login aspect would require some type of authenticating back-end, but the rest could remain client-side.

Similarly, building something similar for FyreVM-Web would be slightly more complex, since the saved data has to be stored somewhere…LocalStorage may not be appropriate for Inform-based save files. It would need a relatively complex back-end server to handle processing. I’d estimate a professional JavaScript developer would take two to four weeks to implement something sound with FyreVM-Web.

First, it’s not related to Twine so much as the particular story format used.

Second, I’ve already done all of that except for the server stuff in SugarCube, and it didn’t take that long. SugarCube makes it pretty easy.

@Pace Thank you for the great praise and your confidence in my skills… :smile:

It would be remiss of me not to point out there are a number of other people that visit this site who are likely equally as skilled as myself… TheMadExile and @HiEv being two of them…

How necessary is it that accounts be authenticated? @derek_ndi, would it solve your problem if users could pick a save to load from and were instructed to save their games with their name or ID number (eg. “save_KitParsing.save,” “save_HanonO.save,” etc.)? Or is it important that they have an “account,” not just that different players can be at different points in the game on the same machine?

1 Like