Question on permenant variables


#1

I have tried and couldnt actually find any information on this, so apologies if ive just missed a thread explaining this.
Is it possible to create a variable that exists outside the game. So by that i mean, if i want users to bea ble to unlock things after multiple playthroughs?
I did notice a thread earlier talk about just sending that user back to the start instead of making an ending after the game, but i wanted to do it in a way where if a user has dont something, it is unlocked for the next game.
An example, if a user has played through and discovered magic, in their next game they can choose that their father was a magician, and as such it will effect the gameplay on any future playthroughs.
However if they decide they want to start the game again (hit restart halfway through that second play-through), they are still able to select the option to have their father have been a magician.

Does my question make sense? If not i can clarify further.


Playthrough > 1
#2

You could try working with a password? Like, if they discover one of those permanent variables, give them a password, and if they enter that password at the beginning of the next game, the permanent variables will spring into action? Something like that?

I’m sure there is a more immersive way in which this can be done, but for that you’d have to wait until one of the more experienced coders on the forum picks up on this thread (which I’m sure they will)


#3

Thanks man, i did think about the password but it just seems a little fiddly in that they need to keep the password saved somewhere when they want to enter it, and then people can just get the password easily off websites.
I like the idea of earning variables by exploring the game, which can unlock further story or bonuses. Feels like it adds a little bit to the replayability if done well.


#4

You could make the password something easy to remember, of course that doesn’t stop the problem of people cheating but if they want to cheat then they want to cheat. I think that’s the easiest way, to have an input password and then abracadabra as the password or something.

You can also send the player back to the start at the end instead of restarting. That causes issues though, it means they can’t just restart the game from the second playthrough. I think the password system is easier.


#5

You could probably make some sort of REALLY simple hashing or obfuscating algorithm for the password.

You’d then want to include the player’s character’s name in the password generation, so that the password itself will only work if the player chooses that same name a second time round. It’s not foolproof of course, any code you write to hash a password can simply be reverse engineered to unhash it, but it’ll take some small effort, so hopefully it’ll go *some* way towards putting people off cheating.

But I still think the easiest way to do this would be to utilize a save system, either CoG’s *show_password, my framework or your own solution.

Though you’d need to be clever about tweaking it to start from the beginning again - it’s still the easiest and most robust method I can think of.


#6

Alright, well its something that ill have a think about then.
It was just something i was thinking about in passing, im kinda just playing with it at the moment, but i might try this discussion again if i get more serious about wanting something like this.
Thanks guys :slight_smile:


#7

Very informative thread, thank you all.


#8

You could always just trust the player. Ask them if they’ve finished the game before and then have a few questions before the game starts to see what they can unlock. If they choose to cheat then so be it. They’ll lose out on the experience that you had planned, but that’s their decision.

You could also include things that only happen in the first playthrough. Let the player know that by choosing newgame+ they’re going to miss out on some things even if they unlock others. That might dissuade people from cheating on their first go.


#9

I think that the best way is still to just to loop back to the beginning of the game. You end up with a nice Legacy game without any of the unnecessary passwords and extra problems. :slight_smile:


#10

See I like the idea of the Legacy game, its exactly what i was aiming for the only issue i have is that i want people to be able to go back to the start of that game without losing the stuff from the game before.
The vision i was having was that when someone starts a new game they are able to choose what their father was if they have unlocked it.

So if they have discovered magic, they can choose that he was a mage, or if they managed to get knighted in a game, he was a nobleman. Doing this would unlock more possibilities in the next playthrough.

So i’d like the player to be able to restart the game mid game if they have accidentally made a choice they didn’t want to, but not lose the things they may have unlocked.
Further more i would like them to be able to always play with a mage ancestor if they have unlocked it once.

Maybe i could add a “restart” button to the stats screen which restarts it in the way i want to (i.e loop back to the start)
From what i understand i could just have boolean variables that change from false to true if they unlock them during the game, and as long as they don’t actually restart the game.
The only problem then is making sure the user sees that as the way to restart the game, and not have them click the restart button on the opening screen.

I have a vague recollection of the Choice of Romance games having options you can unlock by purchasing them. Something to do with being able to start as a life mage.
That must mean that there is the possibility of having variables that are permanently set outside of the game, i guess it just depends on whether we can use them or not.


#11

The games with unlockable variables do it with a *set paidcontent true and then an *if paidcontent I think. (Although not those exact commands.)

You could mail @dfabulich and ask him if what you want to do can be done.


#12

Ahhh that makes sense, so in essence there do exist variables of some sort at the “menu” level, but whether they are customizable or not is another thing.
Thanks, i might just send him a message regarding this, just so i know if its possible or not :slight_smile: